refactor: format markdown files using prettier, fix spelling concerns, reduce Taskfile bloat
This commit is contained in:
608 files changed
+63317
-10219
No files matched your search
+14
-3
@@ -5,7 +5,12 @@ import { onMounted, ref } from "vue";
|
||||
import ChatLauncher from "@/chat/ChatLauncher.vue";
|
||||
import CommandPalette from "@/components/command-palette/CommandPalette.vue";
|
||||
import Topbar from "@/components/topbar/Topbar.vue";
|
||||
import { Alert, AlertAction, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import {
|
||||
Alert,
|
||||
AlertAction,
|
||||
AlertDescription,
|
||||
AlertTitle,
|
||||
} from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { hidden, loadCapabilities } from "@/lib/capabilities";
|
||||
@@ -66,10 +71,16 @@ onMounted(() => {
|
||||
<Alert v-if="authenticationRequired" variant="destructive" class="mb-4">
|
||||
<AlertTitle>Dashboard authentication required</AlertTitle>
|
||||
<AlertDescription>
|
||||
Open the dashboard URL Archie logged at startup to establish a new authenticated session.
|
||||
Open the dashboard URL Archie logged at startup to establish a new
|
||||
authenticated session.
|
||||
</AlertDescription>
|
||||
<AlertAction>
|
||||
<Button variant="outline" size="sm" :disabled="retrying" @click="retryAuthentication">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
:disabled="retrying"
|
||||
@click="retryAuthentication"
|
||||
>
|
||||
{{ retrying ? "Retrying…" : "Retry" }}
|
||||
</Button>
|
||||
</AlertAction>
|
||||
|
||||
@@ -17,7 +17,12 @@ const tokens = computed(() => tokenizeJson(props.text));
|
||||
|
||||
<template>
|
||||
<template v-if="tokens">
|
||||
<span v-for="(token, i) in tokens" :key="i" :class="tokenClass(token.kind)">{{ token.text }}</span>
|
||||
<span
|
||||
v-for="(token, i) in tokens"
|
||||
:key="i"
|
||||
:class="tokenClass(token.kind)"
|
||||
>{{ token.text }}</span
|
||||
>
|
||||
</template>
|
||||
<template v-else>{{ props.text }}</template>
|
||||
</template>
|
||||
</template>
|
||||
+21
-5
@@ -1,5 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { fmtValue, LEVEL_COLOR, levelKind, shortTime, type LogEntry } from "@/lib/log";
|
||||
import {
|
||||
fmtValue,
|
||||
LEVEL_COLOR,
|
||||
levelKind,
|
||||
shortTime,
|
||||
type LogEntry,
|
||||
} from "@/lib/log";
|
||||
|
||||
/**
|
||||
* Shared log-entry rendering. Both the daemon-wide log page and a task's own
|
||||
@@ -15,18 +21,28 @@ const fields = () => Object.entries(props.entry.fields ?? {});
|
||||
<div
|
||||
class="grid grid-cols-[62px_52px_1fr] items-baseline gap-3 border-b border-border px-1 py-2 hover:bg-accent"
|
||||
>
|
||||
<span class="font-mono text-fg-subtle">{{ shortTime(props.entry.time) }}</span>
|
||||
<span class="text-[10px] font-semibold tracking-[0.04em]" :class="LEVEL_COLOR[levelKind(props.entry.level)]">
|
||||
<span class="font-mono text-fg-subtle">{{
|
||||
shortTime(props.entry.time)
|
||||
}}</span>
|
||||
<span
|
||||
class="text-[10px] font-semibold tracking-[0.04em]"
|
||||
:class="LEVEL_COLOR[levelKind(props.entry.level)]"
|
||||
>
|
||||
{{ (props.entry.level || "info").toUpperCase() }}
|
||||
</span>
|
||||
<span class="flex min-w-0 flex-wrap items-baseline gap-2">
|
||||
<span class="break-words text-foreground">{{ props.entry.message || props.entry.msg || "" }}</span>
|
||||
<span class="break-words text-foreground">{{
|
||||
props.entry.message || props.entry.msg || ""
|
||||
}}</span>
|
||||
<span
|
||||
v-for="[k, v] in fields()"
|
||||
:key="k"
|
||||
class="max-w-full truncate rounded-sm bg-muted px-2 text-fg-muted"
|
||||
>
|
||||
<span class="text-fg-subtle after:opacity-60 after:content-['=']">{{ k }}</span>{{ fmtValue(v) }}
|
||||
<span class="text-fg-subtle after:opacity-60 after:content-['=']">{{
|
||||
k
|
||||
}}</span
|
||||
>{{ fmtValue(v) }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -14,9 +14,12 @@ const props = defineProps<{
|
||||
segments: Array<{ label: string; value: number; kind?: StatusKind }>;
|
||||
}>();
|
||||
|
||||
const total = computed(() => props.segments.reduce((a, s) => a + (s.value || 0), 0) || 1);
|
||||
const total = computed(
|
||||
() => props.segments.reduce((a, s) => a + (s.value || 0), 0) || 1,
|
||||
);
|
||||
|
||||
const partWidth = (value: number) => `${((value / total.value) * 100).toFixed(1)}%`;
|
||||
const partWidth = (value: number) =>
|
||||
`${((value / total.value) * 100).toFixed(1)}%`;
|
||||
const fill = (kind?: StatusKind) => STATUS_FILL[kind ?? "idle"];
|
||||
</script>
|
||||
|
||||
|
||||
@@ -6,7 +6,12 @@ import { computed } from "vue";
|
||||
* number carries the precision.
|
||||
*/
|
||||
const props = withDefaults(
|
||||
defineProps<{ series: number[]; stroke?: string; width?: number; height?: number }>(),
|
||||
defineProps<{
|
||||
series: number[];
|
||||
stroke?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}>(),
|
||||
{ stroke: "var(--ok)", width: 220, height: 34 },
|
||||
);
|
||||
|
||||
@@ -14,7 +19,10 @@ const points = computed(() => {
|
||||
const max = Math.max(...props.series, 1);
|
||||
const min = Math.min(...props.series, 0);
|
||||
const span = max - min || 1;
|
||||
const step = props.series.length > 1 ? props.width / (props.series.length - 1) : props.width;
|
||||
const step =
|
||||
props.series.length > 1
|
||||
? props.width / (props.series.length - 1)
|
||||
: props.width;
|
||||
|
||||
return props.series
|
||||
.map(
|
||||
|
||||
@@ -3,7 +3,14 @@ import { TrendingDown, TrendingUp } from "@lucide/vue";
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Card,
|
||||
CardAction,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import Sparkline from "./Sparkline.vue";
|
||||
|
||||
/**
|
||||
@@ -31,9 +38,15 @@ const props = withDefaults(
|
||||
{ series: () => [], goodDirection: "up" },
|
||||
);
|
||||
|
||||
const dir = computed(() => (props.trend == null ? null : props.trend >= 0 ? "up" : "down"));
|
||||
const good = computed(() => (dir.value == null ? null : dir.value === props.goodDirection));
|
||||
const trendIcon = computed(() => (dir.value === "up" ? TrendingUp : TrendingDown));
|
||||
const dir = computed(() =>
|
||||
props.trend == null ? null : props.trend >= 0 ? "up" : "down",
|
||||
);
|
||||
const good = computed(() =>
|
||||
dir.value == null ? null : dir.value === props.goodDirection,
|
||||
);
|
||||
const trendIcon = computed(() =>
|
||||
dir.value === "up" ? TrendingUp : TrendingDown,
|
||||
);
|
||||
const trendLabel = computed(() => `${Math.abs(props.trend ?? 0).toFixed(1)}%`);
|
||||
</script>
|
||||
|
||||
@@ -41,7 +54,9 @@ const trendLabel = computed(() => `${Math.abs(props.trend ?? 0).toFixed(1)}%`);
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{{ props.label }}</CardTitle>
|
||||
<CardDescription v-if="props.compare">{{ props.compare }}</CardDescription>
|
||||
<CardDescription v-if="props.compare">{{
|
||||
props.compare
|
||||
}}</CardDescription>
|
||||
<CardAction v-if="dir">
|
||||
<Badge :variant="good ? 'ok' : 'danger'">
|
||||
<component :is="trendIcon" />
|
||||
@@ -51,7 +66,10 @@ const trendLabel = computed(() => `${Math.abs(props.trend ?? 0).toFixed(1)}%`);
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div class="text-3xl font-semibold tracking-[-0.03em]">
|
||||
{{ props.value }}<span v-if="props.unit" class="ml-1 text-lg text-fg-muted">{{ props.unit }}</span>
|
||||
{{ props.value
|
||||
}}<span v-if="props.unit" class="ml-1 text-lg text-fg-muted">{{
|
||||
props.unit
|
||||
}}</span>
|
||||
</div>
|
||||
<Sparkline
|
||||
v-if="props.series.length > 1"
|
||||
|
||||
@@ -3,11 +3,30 @@ import { computed, ref, watch } from "vue";
|
||||
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import { Field, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import {
|
||||
Field,
|
||||
FieldDescription,
|
||||
FieldGroup,
|
||||
FieldLabel,
|
||||
} from "@/components/ui/field";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { eventTypeLabel, type EventType } from "@/captures/event-types";
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import {
|
||||
draftFromBinding,
|
||||
@@ -47,26 +66,43 @@ const draft = ref<BindingDraft>(emptyDraft());
|
||||
watch(
|
||||
open,
|
||||
(isOpen) => {
|
||||
if (isOpen) draft.value = props.binding ? draftFromBinding(props.binding, props.mappings) : emptyDraft();
|
||||
if (isOpen)
|
||||
draft.value = props.binding
|
||||
? draftFromBinding(props.binding, props.mappings)
|
||||
: emptyDraft();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
const typeMappings = computed(() => mappingsForEventType(props.mappings, draft.value.eventTypeId));
|
||||
const typeMappings = computed(() =>
|
||||
mappingsForEventType(props.mappings, draft.value.eventTypeId),
|
||||
);
|
||||
|
||||
// A mapping belongs to one event type, so changing the type clears a mapping
|
||||
// that no longer fits it.
|
||||
watch(
|
||||
() => draft.value.eventTypeId,
|
||||
() => {
|
||||
if (!typeMappings.value.some((m) => m.id === draft.value.mappingId)) draft.value.mappingId = "";
|
||||
if (!typeMappings.value.some((m) => m.id === draft.value.mappingId))
|
||||
draft.value.mappingId = "";
|
||||
},
|
||||
);
|
||||
|
||||
const workflow = computed(() => props.workflows.find((w) => w.id === draft.value.workflow));
|
||||
const declaredInputs = computed(() => Object.entries(workflow.value?.inputs ?? {}).sort(([a], [b]) => a.localeCompare(b)));
|
||||
const mappingFields = computed(() => props.mappings.find((m) => m.id === draft.value.mappingId)?.fields ?? []);
|
||||
const stringParams = computed(() => paramsForType(mappingFields.value, "string"));
|
||||
const workflow = computed(() =>
|
||||
props.workflows.find((w) => w.id === draft.value.workflow),
|
||||
);
|
||||
const declaredInputs = computed(() =>
|
||||
Object.entries(workflow.value?.inputs ?? {}).sort(([a], [b]) =>
|
||||
a.localeCompare(b),
|
||||
),
|
||||
);
|
||||
const mappingFields = computed(
|
||||
() =>
|
||||
props.mappings.find((m) => m.id === draft.value.mappingId)?.fields ?? [],
|
||||
);
|
||||
const stringParams = computed(() =>
|
||||
paramsForType(mappingFields.value, "string"),
|
||||
);
|
||||
|
||||
// The constant sentinel stands for "no parameter": Select items cannot carry
|
||||
// an empty value.
|
||||
@@ -104,7 +140,8 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
<DialogHeader>
|
||||
<DialogTitle>{{ title }}</DialogTitle>
|
||||
<DialogDescription>
|
||||
A binding is not armed until it is approved, and editing one drops it back to pending approval.
|
||||
A binding is not armed until it is approved, and editing one drops it
|
||||
back to pending approval.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -123,7 +160,11 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem v-for="type in props.eventTypes" :key="type.id" :value="type.id">
|
||||
<SelectItem
|
||||
v-for="type in props.eventTypes"
|
||||
:key="type.id"
|
||||
:value="type.id"
|
||||
>
|
||||
{{ eventTypeLabel(type.id, props.eventTypes) }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
@@ -135,11 +176,21 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
<FieldLabel for="binding-mapping">Field mapping</FieldLabel>
|
||||
<Select v-model="draft.mappingId" :disabled="!typeMappings.length">
|
||||
<SelectTrigger id="binding-mapping" class="w-full">
|
||||
<SelectValue :placeholder="draft.eventTypeId && !typeMappings.length ? 'No mappings for this event type' : 'Pick a mapping'" />
|
||||
<SelectValue
|
||||
:placeholder="
|
||||
draft.eventTypeId && !typeMappings.length
|
||||
? 'No mappings for this event type'
|
||||
: 'Pick a mapping'
|
||||
"
|
||||
/>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem v-for="mapping in typeMappings" :key="mapping.id" :value="String(mapping.id)">
|
||||
<SelectItem
|
||||
v-for="mapping in typeMappings"
|
||||
:key="mapping.id"
|
||||
:value="String(mapping.id)"
|
||||
>
|
||||
{{ mapping.name }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
@@ -149,8 +200,15 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="binding-filter">Filter</FieldLabel>
|
||||
<Input id="binding-filter" v-model="draft.filter" class="font-mono text-xs" placeholder='severity in ["high", "critical"]' />
|
||||
<FieldDescription>Optional CEL over the mapping's parameters.</FieldDescription>
|
||||
<Input
|
||||
id="binding-filter"
|
||||
v-model="draft.filter"
|
||||
class="font-mono text-xs"
|
||||
placeholder='severity in ["high", "critical"]'
|
||||
/>
|
||||
<FieldDescription
|
||||
>Optional CEL over the mapping's parameters.</FieldDescription
|
||||
>
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
@@ -161,7 +219,11 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem v-for="workflow in props.workflows" :key="workflow.id" :value="workflow.id">
|
||||
<SelectItem
|
||||
v-for="workflow in props.workflows"
|
||||
:key="workflow.id"
|
||||
:value="workflow.id"
|
||||
>
|
||||
{{ workflow.name }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
@@ -172,23 +234,37 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
<Field v-for="[name, spec] in declaredInputs" :key="name">
|
||||
<FieldLabel :for="`binding-input-${name}`">
|
||||
Input <span class="font-mono">{{ name }}</span>
|
||||
<span class="text-fg-muted">({{ spec.type }}{{ spec.required ? ", required" : "" }})</span>
|
||||
<span class="text-fg-muted"
|
||||
>({{ spec.type }}{{ spec.required ? ", required" : "" }})</span
|
||||
>
|
||||
</FieldLabel>
|
||||
<div class="grid grid-cols-2 items-start gap-3">
|
||||
<Select :model-value="inputSource(name)" @update:model-value="setInputSource(name, $event)">
|
||||
<Select
|
||||
:model-value="inputSource(name)"
|
||||
@update:model-value="setInputSource(name, $event)"
|
||||
>
|
||||
<SelectTrigger :id="`binding-input-${name}`" class="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem :value="CONSTANT">Constant</SelectItem>
|
||||
<SelectItem v-for="field in paramsForType(mappingFields, spec.type)" :key="field.name" :value="field.name">
|
||||
<SelectItem
|
||||
v-for="field in paramsForType(mappingFields, spec.type)"
|
||||
:key="field.name"
|
||||
:value="field.name"
|
||||
>
|
||||
{{ field.name }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Input v-if="!inputDraft(name).param" v-model="inputDraft(name).value" class="font-mono text-xs" placeholder="value" />
|
||||
<Input
|
||||
v-if="!inputDraft(name).param"
|
||||
v-model="inputDraft(name).value"
|
||||
class="font-mono text-xs"
|
||||
placeholder="value"
|
||||
/>
|
||||
</div>
|
||||
</Field>
|
||||
|
||||
@@ -200,14 +276,23 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem :value="NO_PARAM">A pinned or configured repo</SelectItem>
|
||||
<SelectItem v-for="field in stringParams" :key="field.name" :value="field.name">
|
||||
<SelectItem :value="NO_PARAM"
|
||||
>A pinned or configured repo</SelectItem
|
||||
>
|
||||
<SelectItem
|
||||
v-for="field in stringParams"
|
||||
:key="field.name"
|
||||
:value="field.name"
|
||||
>
|
||||
Parameter {{ field.name }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FieldDescription>A parameter must hold owner/name and name a configured repo.</FieldDescription>
|
||||
<FieldDescription
|
||||
>A parameter must hold owner/name and name a configured
|
||||
repo.</FieldDescription
|
||||
>
|
||||
</Field>
|
||||
|
||||
<Field v-if="takesRepository(workflow) && !draft.repoParam">
|
||||
@@ -222,10 +307,10 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
</Field>
|
||||
</div>
|
||||
<FieldDescription>
|
||||
Optional. A pin is both halves or neither, so leave both blank to use the single configured repo.
|
||||
Optional. A pin is both halves or neither, so leave both blank to
|
||||
use the single configured repo.
|
||||
</FieldDescription>
|
||||
</Field>
|
||||
|
||||
</FieldGroup>
|
||||
|
||||
<!-- Beside the buttons, not at the top: the dialog scrolls, and Save is
|
||||
@@ -236,7 +321,9 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
</Alert>
|
||||
|
||||
<DialogFooter class="mt-4">
|
||||
<Button type="button" variant="outline" @click="open = false">Cancel</Button>
|
||||
<Button type="button" variant="outline" @click="open = false"
|
||||
>Cancel</Button
|
||||
>
|
||||
<Button type="submit" :disabled="props.saving">
|
||||
<Spinner v-if="props.saving" data-icon="inline-start" />
|
||||
{{ props.saving ? "Saving" : "Save" }}
|
||||
|
||||
@@ -6,10 +6,19 @@ import { Button } from "@/components/ui/button";
|
||||
import { TableCell, TableRow } from "@/components/ui/table";
|
||||
import BindingStatusBadge from "./BindingStatusBadge.vue";
|
||||
import { eventTypeLabel, type EventType } from "@/captures/event-types";
|
||||
import { bindingEventType, repoPin, type Binding, type MappingOption } from "./binding-draft";
|
||||
import {
|
||||
bindingEventType,
|
||||
repoPin,
|
||||
type Binding,
|
||||
type MappingOption,
|
||||
} from "./binding-draft";
|
||||
|
||||
/** One saved binding's summary row. */
|
||||
const props = defineProps<{ binding: Binding; mappings: MappingOption[]; eventTypes: EventType[] }>();
|
||||
const props = defineProps<{
|
||||
binding: Binding;
|
||||
mappings: MappingOption[];
|
||||
eventTypes: EventType[];
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
edit: [binding: Binding];
|
||||
approve: [binding: Binding];
|
||||
@@ -22,30 +31,52 @@ const emit = defineEmits<{
|
||||
<TableCell class="font-medium">{{ props.binding.name }}</TableCell>
|
||||
<TableCell class="font-mono text-fg-muted">
|
||||
<div class="flex items-center gap-2">
|
||||
{{ eventTypeLabel(bindingEventType(props.binding, props.mappings), props.eventTypes) }}
|
||||
{{
|
||||
eventTypeLabel(
|
||||
bindingEventType(props.binding, props.mappings),
|
||||
props.eventTypes,
|
||||
)
|
||||
}}
|
||||
<Badge v-if="props.binding.unsigned" variant="warn">Unsigned</Badge>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell class="max-w-56 truncate font-mono text-xs text-fg-muted" :title="props.binding.filter">
|
||||
<TableCell
|
||||
class="max-w-56 truncate font-mono text-xs text-fg-muted"
|
||||
:title="props.binding.filter"
|
||||
>
|
||||
{{ props.binding.filter || "—" }}
|
||||
</TableCell>
|
||||
<TableCell>{{ props.binding.workflow || "—" }}</TableCell>
|
||||
<TableCell class="font-mono text-fg-muted">{{ repoPin(props.binding) }}</TableCell>
|
||||
<TableCell class="font-mono text-fg-muted">{{
|
||||
repoPin(props.binding)
|
||||
}}</TableCell>
|
||||
<TableCell><BindingStatusBadge :status="props.binding.status" /></TableCell>
|
||||
<TableCell>
|
||||
<div class="flex items-center justify-end gap-1">
|
||||
<Button variant="outline" size="sm" @click="emit('edit', props.binding)">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@click="emit('edit', props.binding)"
|
||||
>
|
||||
<Pencil data-icon="inline-start" />
|
||||
Edit
|
||||
</Button>
|
||||
<!-- Only a pending binding can be approved. An armed binding is
|
||||
already firing, so the button would be a no-op -- or worse, a
|
||||
misleading one. -->
|
||||
<Button v-if="props.binding.status === 'pending_approval'" size="sm" @click="emit('approve', props.binding)">
|
||||
<Button
|
||||
v-if="props.binding.status === 'pending_approval'"
|
||||
size="sm"
|
||||
@click="emit('approve', props.binding)"
|
||||
>
|
||||
<Check data-icon="inline-start" />
|
||||
Approve
|
||||
</Button>
|
||||
<Button variant="outline" size="sm" @click="emit('delete', props.binding)">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@click="emit('delete', props.binding)"
|
||||
>
|
||||
<Trash2 data-icon="inline-start" />
|
||||
Delete
|
||||
</Button>
|
||||
|
||||
@@ -9,5 +9,7 @@ const props = defineProps<{ status?: string }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Badge :variant="statusKind(props.status)">{{ statusLabel(props.status) }}</Badge>
|
||||
<Badge :variant="statusKind(props.status)">{{
|
||||
statusLabel(props.status)
|
||||
}}</Badge>
|
||||
</template>
|
||||
@@ -110,6 +110,10 @@ async function handleDelete(binding: Binding): Promise<void> {
|
||||
@save="handleSave"
|
||||
/>
|
||||
|
||||
<DeleteBindingDialog :binding="deleting" @confirm="handleDelete" @cancel="deleting = null" />
|
||||
<DeleteBindingDialog
|
||||
:binding="deleting"
|
||||
@confirm="handleDelete"
|
||||
@cancel="deleting = null"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2,9 +2,20 @@
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Table, TableBody, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import BindingRow from "./BindingRow.vue";
|
||||
import type { EventType } from "@/captures/event-types";
|
||||
import type { Binding, MappingOption } from "./binding-draft";
|
||||
@@ -32,7 +43,9 @@ const rows = computed(() => props.bindings ?? []);
|
||||
// that, where a blanket "cannot reach archied" would be false about a daemon
|
||||
// that answered.
|
||||
const failureTitle = computed(() =>
|
||||
props.failure?.kind === "unconfigured" ? "Bindings are not configured" : "Cannot reach archied",
|
||||
props.failure?.kind === "unconfigured"
|
||||
? "Bindings are not configured"
|
||||
: "Cannot reach archied",
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -48,7 +61,8 @@ const failureTitle = computed(() =>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No bindings yet</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
Create one from a saved field mapping to turn a captured webhook into a workflow.
|
||||
Create one from a saved field mapping to turn a captured webhook into a
|
||||
workflow.
|
||||
</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
@@ -70,7 +84,9 @@ const failureTitle = computed(() =>
|
||||
<TableBody>
|
||||
<template v-if="loading">
|
||||
<TableRow v-for="row in 3" :key="row">
|
||||
<TableCell v-for="col in 7" :key="col"><Skeleton class="h-4 w-full" /></TableCell>
|
||||
<TableCell v-for="col in 7" :key="col"
|
||||
><Skeleton class="h-4 w-full"
|
||||
/></TableCell>
|
||||
</TableRow>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
||||
@@ -36,13 +36,15 @@ function onOpenChange(open: boolean): void {
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Delete "{{ props.binding?.name }}"?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
It stops dispatching immediately and cannot be recovered. Captured events for its source keep
|
||||
arriving; they just stop starting tasks.
|
||||
It stops dispatching immediately and cannot be recovered. Captured
|
||||
events for its source keep arriving; they just stop starting tasks.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction variant="destructive" @click="confirm">Delete</AlertDialogAction>
|
||||
<AlertDialogAction variant="destructive" @click="confirm"
|
||||
>Delete</AlertDialogAction
|
||||
>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
@@ -53,7 +53,10 @@ export interface MappingOption {
|
||||
|
||||
/** The mappings that belong to one event type, which are the ones a binding
|
||||
* on that type can use. */
|
||||
export function mappingsForEventType(mappings: MappingOption[], eventTypeId: string): MappingOption[] {
|
||||
export function mappingsForEventType(
|
||||
mappings: MappingOption[],
|
||||
eventTypeId: string,
|
||||
): MappingOption[] {
|
||||
if (!eventTypeId) return [];
|
||||
return mappings.filter((m) => m.event_type_id === eventTypeId);
|
||||
}
|
||||
@@ -75,8 +78,13 @@ export function takesRepository(workflow?: WorkflowOption): boolean {
|
||||
}
|
||||
|
||||
/** A mapping's parameters a workflow input of this type can read. */
|
||||
export function paramsForType(fields: MappingField[], type: string): MappingField[] {
|
||||
return fields.filter((f) => type === "any" || f.type === "any" || f.type === type);
|
||||
export function paramsForType(
|
||||
fields: MappingField[],
|
||||
type: string,
|
||||
): MappingField[] {
|
||||
return fields.filter(
|
||||
(f) => type === "any" || f.type === "any" || f.type === type,
|
||||
);
|
||||
}
|
||||
|
||||
/** One input's assignment as the editor holds it: a parameter name, or the
|
||||
@@ -96,7 +104,9 @@ export function constantValue(text: string, type: string): unknown {
|
||||
case "string":
|
||||
return text;
|
||||
case "number":
|
||||
return text.trim() !== "" && !Number.isNaN(Number(text)) ? Number(text) : text;
|
||||
return text.trim() !== "" && !Number.isNaN(Number(text))
|
||||
? Number(text)
|
||||
: text;
|
||||
case "bool":
|
||||
return text === "true" ? true : text === "false" ? false : text;
|
||||
default:
|
||||
@@ -164,7 +174,10 @@ export function emptyDraft(): BindingDraft {
|
||||
};
|
||||
}
|
||||
|
||||
export function draftFromBinding(binding: Binding, mappings: MappingOption[]): BindingDraft {
|
||||
export function draftFromBinding(
|
||||
binding: Binding,
|
||||
mappings: MappingOption[],
|
||||
): BindingDraft {
|
||||
const mapping = mappings.find((m) => m.id === binding.mapping_id);
|
||||
return {
|
||||
id: binding.id,
|
||||
@@ -179,7 +192,14 @@ export function draftFromBinding(binding: Binding, mappings: MappingOption[]): B
|
||||
inputs: Object.fromEntries(
|
||||
Object.entries(binding.inputs ?? {}).map(([name, src]) => [
|
||||
name,
|
||||
{ param: src.param ?? "", value: src.param ? "" : typeof src.value === "string" ? src.value : JSON.stringify(src.value) },
|
||||
{
|
||||
param: src.param ?? "",
|
||||
value: src.param
|
||||
? ""
|
||||
: typeof src.value === "string"
|
||||
? src.value
|
||||
: JSON.stringify(src.value),
|
||||
},
|
||||
]),
|
||||
),
|
||||
};
|
||||
@@ -197,7 +217,8 @@ export function bindingPayload(
|
||||
for (const [name, spec] of Object.entries(declared)) {
|
||||
const src = draft.inputs[name];
|
||||
if (src?.param) inputs[name] = { param: src.param };
|
||||
else if (src && src.value !== "") inputs[name] = { value: constantValue(src.value, spec.type) };
|
||||
else if (src && src.value !== "")
|
||||
inputs[name] = { value: constantValue(src.value, spec.type) };
|
||||
}
|
||||
const repository = takesRepository(workflow);
|
||||
return {
|
||||
@@ -217,10 +238,15 @@ export function bindingPayload(
|
||||
* single-configured-repo default. */
|
||||
export function repoPin(binding: Binding): string {
|
||||
if (binding.repo_param) return `from ${binding.repo_param}`;
|
||||
return binding.owner && binding.repo ? `${binding.owner}/${binding.repo}` : "—";
|
||||
return binding.owner && binding.repo
|
||||
? `${binding.owner}/${binding.repo}`
|
||||
: "—";
|
||||
}
|
||||
|
||||
/** The event type a row shows: its mapping's. */
|
||||
export function bindingEventType(binding: Binding, mappings: MappingOption[]): string | undefined {
|
||||
export function bindingEventType(
|
||||
binding: Binding,
|
||||
mappings: MappingOption[],
|
||||
): string | undefined {
|
||||
return mappings.find((m) => m.id === binding.mapping_id)?.event_type_id;
|
||||
}
|
||||
@@ -23,9 +23,13 @@ export interface LoadFailure {
|
||||
}
|
||||
|
||||
function failureFor(err: unknown): LoadFailure {
|
||||
const message = err instanceof Error && err.message ? err.message : String(err);
|
||||
const message =
|
||||
err instanceof Error && err.message ? err.message : String(err);
|
||||
const status = err instanceof ApiError ? err.status : undefined;
|
||||
return { kind: status === 501 || status === 503 ? "unconfigured" : "failed", message };
|
||||
return {
|
||||
kind: status === 501 || status === 503 ? "unconfigured" : "failed",
|
||||
message,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +91,8 @@ export function useBindings() {
|
||||
await load();
|
||||
return true;
|
||||
} catch (err) {
|
||||
saveFailure.value = err instanceof Error && err.message ? err.message : String(err);
|
||||
saveFailure.value =
|
||||
err instanceof Error && err.message ? err.message : String(err);
|
||||
return false;
|
||||
} finally {
|
||||
saving.value = false;
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
import { useMediaQuery } from "@vueuse/core";
|
||||
import { computed, ref, watch } from "vue";
|
||||
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ago } from "@/lib/format";
|
||||
import { captureSignature } from "./capture-signature";
|
||||
@@ -36,14 +42,22 @@ const pane = ref<HTMLElement | null>(null);
|
||||
// as CapturesPage, matched there in CSS and here in script.
|
||||
const stacked = useMediaQuery("(max-width: 1099px)");
|
||||
|
||||
const cap = computed(() => (stacked.value || !props.maxHeight ? undefined : `${props.maxHeight}px`));
|
||||
const cap = computed(() =>
|
||||
stacked.value || !props.maxHeight ? undefined : `${props.maxHeight}px`,
|
||||
);
|
||||
|
||||
const signature = computed(() => (selected.value ? captureSignature(selected.value) : null));
|
||||
const signature = computed(() =>
|
||||
selected.value ? captureSignature(selected.value) : null,
|
||||
);
|
||||
|
||||
const meta = computed(() => {
|
||||
const capture = selected.value;
|
||||
if (!capture) return "";
|
||||
return [ago(capture.received_at), capture.content_type || "no content type", capture.remote_addr]
|
||||
return [
|
||||
ago(capture.received_at),
|
||||
capture.content_type || "no content type",
|
||||
capture.remote_addr,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
});
|
||||
@@ -60,7 +74,9 @@ watch(selected, () => {
|
||||
<CardHeader>
|
||||
<CardTitle class="flex items-center gap-2 font-mono">
|
||||
{{ selected.source || "Unknown source" }}
|
||||
<Badge v-if="signature" :variant="signature.kind">{{ signature.label }}</Badge>
|
||||
<Badge v-if="signature" :variant="signature.kind">{{
|
||||
signature.label
|
||||
}}</Badge>
|
||||
</CardTitle>
|
||||
<CardDescription>{{ meta }}</CardDescription>
|
||||
</CardHeader>
|
||||
@@ -68,7 +84,9 @@ watch(selected, () => {
|
||||
the way the task log does rather than letting one large payload
|
||||
become a ten-thousand-pixel page. Split, the page's cap is the bound
|
||||
and this one is lifted. -->
|
||||
<CardContent class="min-h-0 max-h-[62vh] overflow-y-auto min-[1100px]:max-h-none">
|
||||
<CardContent
|
||||
class="min-h-0 max-h-[62vh] overflow-y-auto min-[1100px]:max-h-none"
|
||||
>
|
||||
<div class="flex flex-col gap-5">
|
||||
<CapturePayload label="Payload" :raw="selected.body" />
|
||||
<CapturePayload label="Headers" :raw="selected.headers" />
|
||||
|
||||
@@ -15,7 +15,11 @@ const text = computed(() => prettyPrint(props.raw));
|
||||
|
||||
<template>
|
||||
<section class="min-w-0">
|
||||
<h3 class="mb-2 text-xs font-semibold tracking-[0.05em] text-fg-subtle uppercase">{{ label }}</h3>
|
||||
<h3
|
||||
class="mb-2 text-xs font-semibold tracking-[0.05em] text-fg-subtle uppercase"
|
||||
>
|
||||
{{ label }}
|
||||
</h3>
|
||||
<!--
|
||||
Wrap rather than scroll sideways: a captured payload is mostly long
|
||||
unbroken tokens (URLs, hashes, base64), and one of those on a single line
|
||||
@@ -25,7 +29,6 @@ const text = computed(() => prettyPrint(props.raw));
|
||||
<pre
|
||||
v-else
|
||||
class="rounded-sm border border-border-strong bg-muted p-3 font-mono text-xs whitespace-pre-wrap wrap-break-word"
|
||||
><HighlightedJson :text="text" /></pre
|
||||
>
|
||||
><HighlightedJson :text="text" /></pre>
|
||||
</section>
|
||||
</template>
|
||||
@@ -18,14 +18,19 @@ import { selected, type Capture } from "./state";
|
||||
*/
|
||||
const props = defineProps<{ capture: Capture }>();
|
||||
|
||||
const identity = computed(() => captureIdentity(props.capture, eventTypes.value));
|
||||
const identity = computed(() =>
|
||||
captureIdentity(props.capture, eventTypes.value),
|
||||
);
|
||||
|
||||
const signature = computed(() => captureSignature(props.capture));
|
||||
const isSelected = computed(() => selected.value?.id === props.capture.id);
|
||||
|
||||
// The name is set here because role="button" makes the cells presentational:
|
||||
// what a screen reader reads is this, not five unrelated columns.
|
||||
const label = computed(() => `Show the payload received from ${props.capture.source || "an unknown source"}`);
|
||||
const label = computed(
|
||||
() =>
|
||||
`Show the payload received from ${props.capture.source || "an unknown source"}`,
|
||||
);
|
||||
|
||||
function open(): void {
|
||||
selected.value = props.capture;
|
||||
@@ -44,8 +49,12 @@ function open(): void {
|
||||
@keydown.enter.prevent="open"
|
||||
@keydown.space.prevent="open"
|
||||
>
|
||||
<TableCell class="font-mono">{{ props.capture.source || "(unknown)" }}</TableCell>
|
||||
<TableCell :title="props.capture.received_at || ''">{{ ago(props.capture.received_at) }}</TableCell>
|
||||
<TableCell class="font-mono">{{
|
||||
props.capture.source || "(unknown)"
|
||||
}}</TableCell>
|
||||
<TableCell :title="props.capture.received_at || ''">{{
|
||||
ago(props.capture.received_at)
|
||||
}}</TableCell>
|
||||
<!-- An unidentified capture is never dispatched. -->
|
||||
<TableCell>
|
||||
<div class="flex items-center gap-1">
|
||||
@@ -55,7 +64,9 @@ function open(): void {
|
||||
<Badge :variant="signature.kind">{{ signature.label }}</Badge>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell class="font-mono">{{ props.capture.content_type || "—" }}</TableCell>
|
||||
<TableCell class="font-mono">{{
|
||||
props.capture.content_type || "—"
|
||||
}}</TableCell>
|
||||
<TableCell class="text-right">
|
||||
<ChevronRight class="size-4 text-fg-subtle" />
|
||||
</TableCell>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
|
||||
import CapturesList from "./CapturesList.vue";
|
||||
|
||||
@@ -15,7 +21,10 @@ import CapturesList from "./CapturesList.vue";
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Recent captures</CardTitle>
|
||||
<CardDescription>Headers and payloads are redacted before they are stored.</CardDescription>
|
||||
<CardDescription
|
||||
>Headers and payloads are redacted before they are
|
||||
stored.</CardDescription
|
||||
>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<CapturesList />
|
||||
|
||||
@@ -2,9 +2,21 @@
|
||||
import { Inbox, TriangleAlert } from "@lucide/vue";
|
||||
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyMedia,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Table, TableBody, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import CaptureRow from "./CaptureRow.vue";
|
||||
import { captures, enabled, error, loading } from "./state";
|
||||
|
||||
@@ -17,7 +29,8 @@ import { captures, enabled, error, loading } from "./state";
|
||||
// The receiver's path, held as a string rather than typed into the template:
|
||||
// its source segment is angle-bracketed, which a template parser reads as a
|
||||
// tag.
|
||||
const webhookHint = "Point a webhook at /webhooks/capture/<source> and it will show up here.";
|
||||
const webhookHint =
|
||||
"Point a webhook at /webhooks/capture/<source> and it will show up here.";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -59,7 +72,11 @@ const webhookHint = "Point a webhook at /webhooks/capture/<source> and it will s
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<CaptureRow v-for="capture in captures" :key="capture.id" :capture="capture" />
|
||||
<CaptureRow
|
||||
v-for="capture in captures"
|
||||
:key="capture.id"
|
||||
:capture="capture"
|
||||
/>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</template>
|
||||
@@ -96,7 +96,9 @@ watch(selected, (capture) => {
|
||||
<div class="mb-4 flex flex-wrap items-center justify-end gap-2">
|
||||
<CaptureStatus />
|
||||
</div>
|
||||
<div class="grid min-w-0 items-start gap-4 min-[1100px]:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
|
||||
<div
|
||||
class="grid min-w-0 items-start gap-4 min-[1100px]:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]"
|
||||
>
|
||||
<div ref="listColumn" class="min-w-0">
|
||||
<CapturesCard />
|
||||
</div>
|
||||
|
||||
@@ -3,13 +3,26 @@ import { computed } from "vue";
|
||||
|
||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import RuleEditor from "./RuleEditor.vue";
|
||||
import { closeDraft, draft, saveDraft, saveError, saving } from "./event-type-state";
|
||||
import {
|
||||
closeDraft,
|
||||
draft,
|
||||
saveDraft,
|
||||
saveError,
|
||||
saving,
|
||||
} from "./event-type-state";
|
||||
|
||||
/**
|
||||
* One event-type editing session: naming a proposed group, creating a type
|
||||
@@ -34,30 +47,55 @@ function onOpenChange(open: boolean) {
|
||||
|
||||
<template>
|
||||
<Dialog :open="draft !== null" @update:open="onOpenChange">
|
||||
<DialogContent v-if="draft" class="max-h-[85vh] overflow-y-auto sm:max-w-2xl">
|
||||
<DialogContent
|
||||
v-if="draft"
|
||||
class="max-h-[85vh] overflow-y-auto sm:max-w-2xl"
|
||||
>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{{ title }}</DialogTitle>
|
||||
<DialogDescription>Events on {{ draft.source || "the source" }} that match no type are never dispatched.</DialogDescription>
|
||||
<DialogDescription
|
||||
>Events on {{ draft.source || "the source" }} that match no type are
|
||||
never dispatched.</DialogDescription
|
||||
>
|
||||
</DialogHeader>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label for="event-type-source">Source</Label>
|
||||
<Input id="event-type-source" v-model="draft.source" class="font-mono" :disabled="draft.mode !== 'paste'" />
|
||||
<Input
|
||||
id="event-type-source"
|
||||
v-model="draft.source"
|
||||
class="font-mono"
|
||||
:disabled="draft.mode !== 'paste'"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label for="event-type-name">Name</Label>
|
||||
<Input id="event-type-name" v-model="draft.name" placeholder="pull_request.opened" />
|
||||
<Input
|
||||
id="event-type-name"
|
||||
v-model="draft.name"
|
||||
placeholder="pull_request.opened"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<template v-if="draft.mode === 'paste'">
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label for="event-type-headers">Headers</Label>
|
||||
<Textarea id="event-type-headers" v-model="draft.headersText" class="min-h-20 font-mono text-xs" placeholder="X-GitHub-Event: pull_request" />
|
||||
<Textarea
|
||||
id="event-type-headers"
|
||||
v-model="draft.headersText"
|
||||
class="min-h-20 font-mono text-xs"
|
||||
placeholder="X-GitHub-Event: pull_request"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label for="event-type-body">Payload</Label>
|
||||
<Textarea id="event-type-body" v-model="draft.body" class="min-h-40 font-mono text-xs" placeholder="{ }" />
|
||||
<Textarea
|
||||
id="event-type-body"
|
||||
v-model="draft.body"
|
||||
class="min-h-40 font-mono text-xs"
|
||||
placeholder="{ }"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<RuleEditor v-else v-model="draft.rule" />
|
||||
@@ -69,7 +107,10 @@ function onOpenChange(open: boolean) {
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="outline" @click="closeDraft">Cancel</Button>
|
||||
<Button :disabled="saving || !draft.name.trim() || !draft.source.trim()" @click="saveDraft">
|
||||
<Button
|
||||
:disabled="saving || !draft.name.trim() || !draft.source.trim()"
|
||||
@click="saveDraft"
|
||||
>
|
||||
<Spinner v-if="saving" />
|
||||
Save
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ClipboardPaste, Pencil, Tag, Trash2, TriangleAlert } from "@lucide/vue";
|
||||
import {
|
||||
ClipboardPaste,
|
||||
Pencil,
|
||||
Tag,
|
||||
Trash2,
|
||||
TriangleAlert,
|
||||
} from "@lucide/vue";
|
||||
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import {
|
||||
@@ -13,8 +19,21 @@ import {
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardAction, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import {
|
||||
Card,
|
||||
CardAction,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import EventTypeDialog from "./EventTypeDialog.vue";
|
||||
import {
|
||||
confirmDelete,
|
||||
@@ -44,7 +63,9 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
||||
<CardHeader>
|
||||
<CardTitle>Event types</CardTitle>
|
||||
<CardAction>
|
||||
<Button variant="outline" size="sm" @click="pasteExample()"><ClipboardPaste /> From payload</Button>
|
||||
<Button variant="outline" size="sm" @click="pasteExample()"
|
||||
><ClipboardPaste /> From payload</Button
|
||||
>
|
||||
</CardAction>
|
||||
</CardHeader>
|
||||
<CardContent class="flex flex-col gap-6">
|
||||
@@ -61,17 +82,31 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
||||
<TableHead class="w-20 text-right">Events</TableHead>
|
||||
<TableHead class="w-20 text-right">Fields</TableHead>
|
||||
<TableHead>Rule</TableHead>
|
||||
<TableHead class="w-24"><span class="sr-only">Name</span></TableHead>
|
||||
<TableHead class="w-24"
|
||||
><span class="sr-only">Name</span></TableHead
|
||||
>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="p in proposals" :key="p.source + p.key">
|
||||
<TableCell class="font-mono">{{ p.source || "(unknown)" }}</TableCell>
|
||||
<TableCell class="font-mono">{{
|
||||
p.source || "(unknown)"
|
||||
}}</TableCell>
|
||||
<TableCell class="text-right tabular-nums">{{ p.count }}</TableCell>
|
||||
<TableCell class="text-right tabular-nums">{{ fieldCount(p.schema) }}</TableCell>
|
||||
<TableCell class="font-mono text-xs"><span class="block max-w-96 truncate" :title="ruleSummary(p.rule)">{{ ruleSummary(p.rule) }}</span></TableCell>
|
||||
<TableCell class="text-right tabular-nums">{{
|
||||
fieldCount(p.schema)
|
||||
}}</TableCell>
|
||||
<TableCell class="font-mono text-xs"
|
||||
><span
|
||||
class="block max-w-96 truncate"
|
||||
:title="ruleSummary(p.rule)"
|
||||
>{{ ruleSummary(p.rule) }}</span
|
||||
></TableCell
|
||||
>
|
||||
<TableCell class="text-right">
|
||||
<Button variant="outline" size="sm" @click="nameProposal(p)"><Tag /> Name</Button>
|
||||
<Button variant="outline" size="sm" @click="nameProposal(p)"
|
||||
><Tag /> Name</Button
|
||||
>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
@@ -83,37 +118,72 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
||||
<TableHead>Source</TableHead>
|
||||
<TableHead>Name</TableHead>
|
||||
<TableHead>Rule</TableHead>
|
||||
<TableHead class="w-20"><span class="sr-only">Actions</span></TableHead>
|
||||
<TableHead class="w-20"
|
||||
><span class="sr-only">Actions</span></TableHead
|
||||
>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="t in eventTypes" :key="t.id">
|
||||
<TableCell class="font-mono">{{ t.source }}</TableCell>
|
||||
<TableCell>{{ t.name }}</TableCell>
|
||||
<TableCell class="font-mono text-xs"><span class="block max-w-96 truncate" :title="ruleSummary(t.rule)">{{ ruleSummary(t.rule) }}</span></TableCell>
|
||||
<TableCell class="font-mono text-xs"
|
||||
><span
|
||||
class="block max-w-96 truncate"
|
||||
:title="ruleSummary(t.rule)"
|
||||
>{{ ruleSummary(t.rule) }}</span
|
||||
></TableCell
|
||||
>
|
||||
<TableCell class="text-right whitespace-nowrap">
|
||||
<Button variant="ghost" size="icon-sm" :aria-label="`Edit ${t.name}`" @click="editEventType(t)"><Pencil /></Button>
|
||||
<Button variant="ghost" size="icon-sm" :aria-label="`Delete ${t.name}`" @click="pendingDelete = t"><Trash2 /></Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
:aria-label="`Edit ${t.name}`"
|
||||
@click="editEventType(t)"
|
||||
><Pencil
|
||||
/></Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
:aria-label="`Delete ${t.name}`"
|
||||
@click="pendingDelete = t"
|
||||
><Trash2
|
||||
/></Button>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
<p v-if="!proposals.length && !eventTypes.length" class="text-sm text-fg-muted">No event types or proposals.</p>
|
||||
<p
|
||||
v-if="!proposals.length && !eventTypes.length"
|
||||
class="text-sm text-fg-muted"
|
||||
>
|
||||
No event types or proposals.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<EventTypeDialog />
|
||||
<AlertDialog :open="pendingDelete !== null" @update:open="(open) => { if (!open) pendingDelete = null; }">
|
||||
<AlertDialog
|
||||
:open="pendingDelete !== null"
|
||||
@update:open="
|
||||
(open) => {
|
||||
if (!open) pendingDelete = null;
|
||||
}
|
||||
"
|
||||
>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Delete this event type?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
Events matching "{{ pendingDelete?.name }}" will arrive unidentified and will not dispatch.
|
||||
Events matching "{{ pendingDelete?.name }}" will arrive unidentified
|
||||
and will not dispatch.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction variant="destructive" @click="confirmDelete">Delete</AlertDialogAction>
|
||||
<AlertDialogAction variant="destructive" @click="confirmDelete"
|
||||
>Delete</AlertDialogAction
|
||||
>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
@@ -4,7 +4,14 @@ import { Plus, X } from "@lucide/vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import type { PayloadCondition, Rule } from "./event-types";
|
||||
|
||||
/**
|
||||
@@ -30,24 +37,55 @@ function asOp(value: unknown): PayloadCondition["op"] {
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label>Headers</Label>
|
||||
<div v-for="(h, i) in rule.headers || []" :key="`h${i}`" class="flex items-center gap-2">
|
||||
<Input v-model="h.name" class="font-mono" aria-label="Header name" placeholder="X-GitHub-Event" />
|
||||
<div
|
||||
v-for="(h, i) in rule.headers || []"
|
||||
:key="`h${i}`"
|
||||
class="flex items-center gap-2"
|
||||
>
|
||||
<Input
|
||||
v-model="h.name"
|
||||
class="font-mono"
|
||||
aria-label="Header name"
|
||||
placeholder="X-GitHub-Event"
|
||||
/>
|
||||
<span class="text-fg-subtle">=</span>
|
||||
<Input v-model="h.value" class="font-mono" aria-label="Header value" />
|
||||
<Button variant="ghost" size="icon-sm" aria-label="Remove header condition" @click="headers().splice(i, 1)">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
aria-label="Remove header condition"
|
||||
@click="headers().splice(i, 1)"
|
||||
>
|
||||
<X />
|
||||
</Button>
|
||||
</div>
|
||||
<Button variant="outline" size="sm" class="w-fit" @click="headers().push({ name: '', value: '' })">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
class="w-fit"
|
||||
@click="headers().push({ name: '', value: '' })"
|
||||
>
|
||||
<Plus /> Header
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label>Payload</Label>
|
||||
<div v-for="(p, i) in rule.payload || []" :key="`p${i}`" class="flex items-center gap-2">
|
||||
<Input v-model="p.path" class="font-mono" aria-label="Payload path" placeholder="action" />
|
||||
<Select :model-value="p.op" @update:model-value="(value) => (p.op = asOp(value))">
|
||||
<div
|
||||
v-for="(p, i) in rule.payload || []"
|
||||
:key="`p${i}`"
|
||||
class="flex items-center gap-2"
|
||||
>
|
||||
<Input
|
||||
v-model="p.path"
|
||||
class="font-mono"
|
||||
aria-label="Payload path"
|
||||
placeholder="action"
|
||||
/>
|
||||
<Select
|
||||
:model-value="p.op"
|
||||
@update:model-value="(value) => (p.op = asOp(value))"
|
||||
>
|
||||
<SelectTrigger size="sm" class="w-28 shrink-0" aria-label="Condition">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
@@ -58,13 +96,28 @@ function asOp(value: unknown): PayloadCondition["op"] {
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Input v-if="p.op === 'equals'" v-model="p.value" class="font-mono" aria-label="Payload value" />
|
||||
<Input
|
||||
v-if="p.op === 'equals'"
|
||||
v-model="p.value"
|
||||
class="font-mono"
|
||||
aria-label="Payload value"
|
||||
/>
|
||||
<span v-else class="w-full" />
|
||||
<Button variant="ghost" size="icon-sm" aria-label="Remove payload condition" @click="payload().splice(i, 1)">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
aria-label="Remove payload condition"
|
||||
@click="payload().splice(i, 1)"
|
||||
>
|
||||
<X />
|
||||
</Button>
|
||||
</div>
|
||||
<Button variant="outline" size="sm" class="w-fit" @click="payload().push({ path: '', op: 'equals', value: '' })">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
class="w-fit"
|
||||
@click="payload().push({ path: '', op: 'equals', value: '' })"
|
||||
>
|
||||
<Plus /> Payload condition
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,10 @@ export interface CaptureSignature {
|
||||
kind: "ok" | "warn" | "idle";
|
||||
}
|
||||
|
||||
export function captureSignature(capture: { authenticated?: boolean; unsigned?: boolean }): CaptureSignature {
|
||||
export function captureSignature(capture: {
|
||||
authenticated?: boolean;
|
||||
unsigned?: boolean;
|
||||
}): CaptureSignature {
|
||||
if (capture.unsigned) return { label: "Unsigned", kind: "warn" };
|
||||
if (capture.authenticated) return { label: "Signed", kind: "ok" };
|
||||
return { label: "Unverified", kind: "idle" };
|
||||
|
||||
@@ -2,7 +2,13 @@ import { ref } from "vue";
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
import { captures } from "./state";
|
||||
import { cleanRule, parseHeaderLines, type EventType, type Proposal, type Rule } from "./event-types";
|
||||
import {
|
||||
cleanRule,
|
||||
parseHeaderLines,
|
||||
type EventType,
|
||||
type Proposal,
|
||||
type Rule,
|
||||
} from "./event-types";
|
||||
|
||||
/**
|
||||
* The inspector's event types: the named ones, and the groups of unidentified
|
||||
@@ -78,11 +84,29 @@ export function nameProposal(p: Proposal): void {
|
||||
}
|
||||
|
||||
export function pasteExample(source = ""): void {
|
||||
open({ mode: "paste", id: null, source, name: "", rule: { headers: [], payload: [] }, headersText: "", body: "", exampleHeaders: {} });
|
||||
open({
|
||||
mode: "paste",
|
||||
id: null,
|
||||
source,
|
||||
name: "",
|
||||
rule: { headers: [], payload: [] },
|
||||
headersText: "",
|
||||
body: "",
|
||||
exampleHeaders: {},
|
||||
});
|
||||
}
|
||||
|
||||
export function editEventType(t: EventType): void {
|
||||
open({ mode: "edit", id: t.id, source: t.source, name: t.name, rule: copyRule(t.rule), headersText: "", body: "", exampleHeaders: {} });
|
||||
open({
|
||||
mode: "edit",
|
||||
id: t.id,
|
||||
source: t.source,
|
||||
name: t.name,
|
||||
rule: copyRule(t.rule),
|
||||
headersText: "",
|
||||
body: "",
|
||||
exampleHeaders: {},
|
||||
});
|
||||
}
|
||||
|
||||
export function closeDraft(): void {
|
||||
@@ -95,9 +119,13 @@ export async function saveDraft(): Promise<void> {
|
||||
saving.value = true;
|
||||
try {
|
||||
if (d.mode === "edit" && d.id) {
|
||||
await api.eventTypeUpdate(d.id, { name: d.name, rule: cleanRule(d.rule) });
|
||||
await api.eventTypeUpdate(d.id, {
|
||||
name: d.name,
|
||||
rule: cleanRule(d.rule),
|
||||
});
|
||||
} else {
|
||||
const headers = d.mode === "paste" ? parseHeaderLines(d.headersText) : d.exampleHeaders;
|
||||
const headers =
|
||||
d.mode === "paste" ? parseHeaderLines(d.headersText) : d.exampleHeaders;
|
||||
await api.eventTypeCreate({
|
||||
source: d.source,
|
||||
name: d.name,
|
||||
|
||||
@@ -60,7 +60,10 @@ export function captureIdentity(
|
||||
}
|
||||
|
||||
/** eventTypeLabel names an event type by id as "source / name". */
|
||||
export function eventTypeLabel(id: string | undefined, types: EventType[]): string {
|
||||
export function eventTypeLabel(
|
||||
id: string | undefined,
|
||||
types: EventType[],
|
||||
): string {
|
||||
if (!id) return "No event type";
|
||||
const found = types.find((t) => t.id === id);
|
||||
return found ? `${found.source} / ${found.name}` : "Deleted type";
|
||||
@@ -70,7 +73,9 @@ export function eventTypeLabel(id: string | undefined, types: EventType[]): stri
|
||||
export function ruleSummary(rule: Rule): string {
|
||||
const parts = [
|
||||
...(rule.headers || []).map((h) => `${h.name} = ${h.value}`),
|
||||
...(rule.payload || []).map((p) => (p.op === "present" ? `${p.path} present` : `${p.path} = ${p.value ?? ""}`)),
|
||||
...(rule.payload || []).map((p) =>
|
||||
p.op === "present" ? `${p.path} present` : `${p.path} = ${p.value ?? ""}`,
|
||||
),
|
||||
];
|
||||
return parts.length ? parts.join(" · ") : "any event";
|
||||
}
|
||||
@@ -78,9 +83,15 @@ export function ruleSummary(rule: Rule): string {
|
||||
/** cleanRule drops the editor's blank rows, and a present condition's value. */
|
||||
export function cleanRule(rule: Rule): Rule {
|
||||
return {
|
||||
headers: (rule.headers || []).filter((h) => h.name.trim() !== "").map((h) => ({ name: h.name.trim(), value: h.value })),
|
||||
headers: (rule.headers || [])
|
||||
.filter((h) => h.name.trim() !== "")
|
||||
.map((h) => ({ name: h.name.trim(), value: h.value })),
|
||||
payload: (rule.payload || [])
|
||||
.filter((p) => p.path.trim() !== "")
|
||||
.map((p) => (p.op === "present" ? { path: p.path.trim(), op: p.op } : { path: p.path.trim(), op: p.op, value: p.value ?? "" })),
|
||||
.map((p) =>
|
||||
p.op === "present"
|
||||
? { path: p.path.trim(), op: p.op }
|
||||
: { path: p.path.trim(), op: p.op, value: p.value ?? "" },
|
||||
),
|
||||
};
|
||||
}
|
||||
@@ -15,29 +15,48 @@ export interface Channel {
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import type { StatusKind } from "@/lib/status";
|
||||
|
||||
const props = defineProps<{ channel: Channel }>();
|
||||
|
||||
function tone(state: string | undefined, configured: boolean | undefined): StatusKind {
|
||||
function tone(
|
||||
state: string | undefined,
|
||||
configured: boolean | undefined,
|
||||
): StatusKind {
|
||||
if (state === "running") return "ok";
|
||||
if (state === "failed" || state === "degraded") return "warn";
|
||||
return configured ? "idle" : "idle";
|
||||
}
|
||||
|
||||
const label = computed(() => props.channel.state || (props.channel.configured ? "configured" : "stopped"));
|
||||
const label = computed(
|
||||
() =>
|
||||
props.channel.state ||
|
||||
(props.channel.configured ? "configured" : "stopped"),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{{ props.channel.name }}</CardTitle>
|
||||
<CardDescription v-if="props.channel.description">{{ props.channel.description }}</CardDescription>
|
||||
<Badge :variant="tone(props.channel.state, props.channel.configured)">{{ label }}</Badge>
|
||||
<CardDescription v-if="props.channel.description">{{
|
||||
props.channel.description
|
||||
}}</CardDescription>
|
||||
<Badge :variant="tone(props.channel.state, props.channel.configured)">{{
|
||||
label
|
||||
}}</Badge>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p v-if="props.channel.detail" class="text-sm text-fg-muted">{{ props.channel.detail }}</p>
|
||||
<p v-if="props.channel.detail" class="text-sm text-fg-muted">
|
||||
{{ props.channel.detail }}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -3,7 +3,12 @@ import { computed, onMounted, ref } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { api } from "@/lib/api";
|
||||
import StructuredResourceCard from "@/settings/StructuredResourceCard.vue";
|
||||
import { resourcesForPage, useControlPlaneStore } from "@/stores/control-plane";
|
||||
@@ -36,7 +41,9 @@ onMounted(() => Promise.all([load(), controlPlane.load()]));
|
||||
<div>
|
||||
<PageHeader title="Channels" />
|
||||
|
||||
<div class="grid grid-cols-1 gap-4 min-[1080px]:grid-cols-[repeat(auto-fit,minmax(340px,1fr))]">
|
||||
<div
|
||||
class="grid grid-cols-1 gap-4 min-[1080px]:grid-cols-[repeat(auto-fit,minmax(340px,1fr))]"
|
||||
>
|
||||
<Empty v-if="error">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>Cannot reach archied</EmptyTitle>
|
||||
@@ -49,8 +56,17 @@ onMounted(() => Promise.all([load(), controlPlane.load()]));
|
||||
<EmptyDescription>Add one below.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<ChannelCard v-for="channel in channels" v-else :key="channel.id || channel.name" :channel="channel" />
|
||||
<ChannelCard
|
||||
v-for="channel in channels"
|
||||
v-else
|
||||
:key="channel.id || channel.name"
|
||||
:channel="channel"
|
||||
/>
|
||||
</div>
|
||||
<StructuredResourceCard v-for="descriptor in settings" :key="descriptor.kind" :descriptor="descriptor" />
|
||||
<StructuredResourceCard
|
||||
v-for="descriptor in settings"
|
||||
:key="descriptor.kind"
|
||||
:descriptor="descriptor"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -33,7 +33,12 @@ withDefaults(
|
||||
"
|
||||
>
|
||||
<div v-if="assistant && tools.length" class="mb-2 grid gap-0.5 text-xs">
|
||||
<ChatToolCall v-for="(tool, i) in tools" :key="i" :tool="tool" :streaming="streaming" />
|
||||
<ChatToolCall
|
||||
v-for="(tool, i) in tools"
|
||||
:key="i"
|
||||
:tool="tool"
|
||||
:streaming="streaming"
|
||||
/>
|
||||
</div>
|
||||
<ChatMarkdown v-if="assistant" :text="text" />
|
||||
<div v-else class="whitespace-pre-wrap">{{ text }}</div>
|
||||
|
||||
@@ -69,7 +69,11 @@ function choose(index: number): void {
|
||||
if (!spec || !input) return;
|
||||
// Completing the command replaces the token the caret sits in, which is
|
||||
// decided by the same rule that found the matches.
|
||||
const { text, cursor } = applyCommand(input.value, input.selectionStart ?? input.value.length, spec.command);
|
||||
const { text, cursor } = applyCommand(
|
||||
input.value,
|
||||
input.selectionStart ?? input.value.length,
|
||||
spec.command,
|
||||
);
|
||||
composerText.value = text;
|
||||
closeCommandMenu();
|
||||
void nextTick(() => {
|
||||
@@ -83,7 +87,11 @@ function onKeydown(event: KeyboardEvent): void {
|
||||
if (isCommandMenuOpen.value && commandMatches.value.length) {
|
||||
// A command typed in full is sent rather than completed, so Enter never
|
||||
// re-enters the command the palette was offering.
|
||||
if (event.key === "Enter" && plain && isExactCommand(commandSpecs.value, composerText.value)) {
|
||||
if (
|
||||
event.key === "Enter" &&
|
||||
plain &&
|
||||
isExactCommand(commandSpecs.value, composerText.value)
|
||||
) {
|
||||
event.preventDefault();
|
||||
closeCommandMenu();
|
||||
void sendMessage();
|
||||
@@ -120,7 +128,9 @@ function onKeydown(event: KeyboardEvent): void {
|
||||
|
||||
<template>
|
||||
<div class="border-t p-3">
|
||||
<div class="relative flex items-end gap-2 rounded-xl border border-border-strong bg-muted px-3 py-2.5">
|
||||
<div
|
||||
class="relative flex items-end gap-2 rounded-xl border border-border-strong bg-muted px-3 py-2.5"
|
||||
>
|
||||
<Textarea
|
||||
ref="field"
|
||||
:model-value="composerText"
|
||||
@@ -142,8 +152,15 @@ function onKeydown(event: KeyboardEvent): void {
|
||||
<div class="flex flex-none items-center gap-2">
|
||||
<!-- Only while a turn is arriving: a Stop with nothing to stop is a
|
||||
button that lies about what the panel is doing. -->
|
||||
<Button v-if="isSending" variant="outline" size="sm" @click="stopTurn">Stop</Button>
|
||||
<Button size="sm" :disabled="isSending || !composerText.trim()" @click="sendMessage()">Send</Button>
|
||||
<Button v-if="isSending" variant="outline" size="sm" @click="stopTurn"
|
||||
>Stop</Button
|
||||
>
|
||||
<Button
|
||||
size="sm"
|
||||
:disabled="isSending || !composerText.trim()"
|
||||
@click="sendMessage()"
|
||||
>Send</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,11 @@ const emit = defineEmits<{ prompt: [text: string] }>();
|
||||
|
||||
// Prompts an operator might actually ask, rather than demonstrations of the
|
||||
// feature.
|
||||
const PROMPTS = ["Summarise active tasks", "Show running agents", "Check system status"];
|
||||
const PROMPTS = [
|
||||
"Summarise active tasks",
|
||||
"Show running agents",
|
||||
"Check system status",
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -18,8 +22,12 @@ const PROMPTS = ["Summarise active tasks", "Show running agents", "Check system
|
||||
class="mx-auto mb-3 grid size-9 place-items-center rounded-xl border border-border-strong font-bold text-link"
|
||||
>A</span
|
||||
>
|
||||
<h2 class="text-lg font-semibold tracking-[-0.02em]">What are we working on?</h2>
|
||||
<p class="mt-2 mb-4 text-sm text-fg-muted">Ask Archie anything, or start with one of these prompts.</p>
|
||||
<h2 class="text-lg font-semibold tracking-[-0.02em]">
|
||||
What are we working on?
|
||||
</h2>
|
||||
<p class="mt-2 mb-4 text-sm text-fg-muted">
|
||||
Ask Archie anything, or start with one of these prompts.
|
||||
</p>
|
||||
<div class="grid gap-2">
|
||||
<button
|
||||
v-for="prompt in PROMPTS"
|
||||
|
||||
@@ -17,8 +17,17 @@ import { currentSession, newChat, sessions } from "./state";
|
||||
|
||||
<template>
|
||||
<div class="flex items-center justify-between gap-2 border-b px-4 py-3">
|
||||
<strong class="truncate text-sm font-semibold">{{ panelTitle(sessions, currentSession) }}</strong>
|
||||
<Button variant="ghost" size="icon-sm" class="flex-none" title="New chat" aria-label="New chat" @click="newChat">
|
||||
<strong class="truncate text-sm font-semibold">{{
|
||||
panelTitle(sessions, currentSession)
|
||||
}}</strong>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
class="flex-none"
|
||||
title="New chat"
|
||||
aria-label="New chat"
|
||||
@click="newChat"
|
||||
>
|
||||
<MessageCirclePlus />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,10 @@ const blocks = computed(() => parseMarkdown(props.text));
|
||||
class="my-2 overflow-auto rounded-md border border-border bg-background/60 p-3"
|
||||
><code class="font-mono text-[0.85em]">{{ block.code }}</code></pre>
|
||||
|
||||
<table v-else-if="block.kind === 'table'" class="my-3 w-full border-collapse text-[0.92em]">
|
||||
<table
|
||||
v-else-if="block.kind === 'table'"
|
||||
class="my-3 w-full border-collapse text-[0.92em]"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th
|
||||
@@ -37,7 +40,11 @@ const blocks = computed(() => parseMarkdown(props.text));
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(row, r) in block.rows" :key="r">
|
||||
<td v-for="(cell, c) in row" :key="c" class="border border-border px-2 py-1.5 text-left">
|
||||
<td
|
||||
v-for="(cell, c) in row"
|
||||
:key="c"
|
||||
class="border border-border px-2 py-1.5 text-left"
|
||||
>
|
||||
<ChatInline :inline="cell" />
|
||||
</td>
|
||||
</tr>
|
||||
@@ -51,24 +58,45 @@ const blocks = computed(() => parseMarkdown(props.text));
|
||||
<ChatInline :inline="block.inline" />
|
||||
</blockquote>
|
||||
|
||||
<h1 v-else-if="block.kind === 'h1'" class="mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]">
|
||||
<h1
|
||||
v-else-if="block.kind === 'h1'"
|
||||
class="mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]"
|
||||
>
|
||||
<ChatInline :inline="block.inline" />
|
||||
</h1>
|
||||
<h2 v-else-if="block.kind === 'h2'" class="mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]">
|
||||
<h2
|
||||
v-else-if="block.kind === 'h2'"
|
||||
class="mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]"
|
||||
>
|
||||
<ChatInline :inline="block.inline" />
|
||||
</h2>
|
||||
<h3 v-else-if="block.kind === 'h3'" class="mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]">
|
||||
<h3
|
||||
v-else-if="block.kind === 'h3'"
|
||||
class="mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]"
|
||||
>
|
||||
<ChatInline :inline="block.inline" />
|
||||
</h3>
|
||||
|
||||
<ul v-else-if="block.kind === 'ul'" class="my-2.5 flex list-disc flex-col gap-1 pl-5">
|
||||
<li v-for="(item, n) in block.items" :key="n"><ChatInline :inline="item" /></li>
|
||||
<ul
|
||||
v-else-if="block.kind === 'ul'"
|
||||
class="my-2.5 flex list-disc flex-col gap-1 pl-5"
|
||||
>
|
||||
<li v-for="(item, n) in block.items" :key="n">
|
||||
<ChatInline :inline="item" />
|
||||
</li>
|
||||
</ul>
|
||||
<ol v-else-if="block.kind === 'ol'" class="my-2.5 flex list-decimal flex-col gap-1 pl-5">
|
||||
<li v-for="(item, n) in block.items" :key="n"><ChatInline :inline="item" /></li>
|
||||
<ol
|
||||
v-else-if="block.kind === 'ol'"
|
||||
class="my-2.5 flex list-decimal flex-col gap-1 pl-5"
|
||||
>
|
||||
<li v-for="(item, n) in block.items" :key="n">
|
||||
<ChatInline :inline="item" />
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p v-else-if="block.kind === 'p'" class="mb-2.5 last:mb-0"><ChatInline :inline="block.inline" /></p>
|
||||
<p v-else-if="block.kind === 'p'" class="mb-2.5 last:mb-0">
|
||||
<ChatInline :inline="block.inline" />
|
||||
</p>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -76,7 +76,9 @@ function usePrompt(text: string): void {
|
||||
<!-- The conversation takes the rest of the column: without `min-h-0` on
|
||||
the transcript it sizes to its content instead, and the composer
|
||||
floats above dead space. -->
|
||||
<div :class="contentFade + ' flex h-full min-h-0 flex-col overflow-hidden'">
|
||||
<div
|
||||
:class="contentFade + ' flex h-full min-h-0 flex-col overflow-hidden'"
|
||||
>
|
||||
<ChatHeader />
|
||||
<ChatBar />
|
||||
<ChatSessionActions v-if="currentSession" />
|
||||
|
||||
@@ -2,8 +2,16 @@
|
||||
import { ref } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { promptSessionCommand, runSessionCommand, useEscapeLayer } from "./state";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import {
|
||||
promptSessionCommand,
|
||||
runSessionCommand,
|
||||
useEscapeLayer,
|
||||
} from "./state";
|
||||
|
||||
/**
|
||||
* The commands that act on the conversation itself rather than on what is being
|
||||
@@ -33,14 +41,33 @@ function prompt(command: string, message: string): void {
|
||||
<div class="flex items-center border-b px-3 py-1.5 text-xs">
|
||||
<Popover v-model:open="open">
|
||||
<PopoverTrigger as-child>
|
||||
<Button variant="ghost" size="xs" class="text-fg-muted">Session actions</Button>
|
||||
<Button variant="ghost" size="xs" class="text-fg-muted"
|
||||
>Session actions</Button
|
||||
>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="start" class="flex w-[min(22rem,72vw)] flex-wrap gap-1.5">
|
||||
<Button variant="outline" size="sm" @click="run('/retry')">Retry</Button>
|
||||
<PopoverContent
|
||||
align="start"
|
||||
class="flex w-[min(22rem,72vw)] flex-wrap gap-1.5"
|
||||
>
|
||||
<Button variant="outline" size="sm" @click="run('/retry')"
|
||||
>Retry</Button
|
||||
>
|
||||
<Button variant="outline" size="sm" @click="run('/undo')">Undo</Button>
|
||||
<Button variant="outline" size="sm" @click="prompt('/title', 'Session title')">Rename</Button>
|
||||
<Button variant="outline" size="sm" @click="prompt('/branch', 'Branch name (optional)')">Branch</Button>
|
||||
<Button variant="outline" size="sm" @click="run('/compress --preview')">Preview compression</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@click="prompt('/title', 'Session title')"
|
||||
>Rename</Button
|
||||
>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@click="prompt('/branch', 'Branch name (optional)')"
|
||||
>Branch</Button
|
||||
>
|
||||
<Button variant="outline" size="sm" @click="run('/compress --preview')"
|
||||
>Preview compression</Button
|
||||
>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { sessionTitle } from "./session";
|
||||
import { currentSession, selectSession, sessions } from "./state";
|
||||
|
||||
@@ -26,7 +33,11 @@ import { currentSession, selectSession, sessions } from "./state";
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem v-for="session in sessions" :key="session.session_id" :value="session.session_id">
|
||||
<SelectItem
|
||||
v-for="session in sessions"
|
||||
:key="session.session_id"
|
||||
:value="session.session_id"
|
||||
>
|
||||
{{ sessionTitle(session) }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
|
||||
@@ -4,8 +4,19 @@ import { computed, ref } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Field, FieldLabel } from "@/components/ui/field";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import {
|
||||
currentModels,
|
||||
selectedModel,
|
||||
@@ -50,7 +61,12 @@ function clear(value: unknown): string {
|
||||
<template>
|
||||
<Popover v-model:open="open">
|
||||
<PopoverTrigger as-child>
|
||||
<Button variant="ghost" size="icon-sm" aria-label="Chat settings" title="Chat settings">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
aria-label="Chat settings"
|
||||
title="Chat settings"
|
||||
>
|
||||
<Settings />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
@@ -59,14 +75,22 @@ function clear(value: unknown): string {
|
||||
|
||||
<Field class="gap-1">
|
||||
<FieldLabel class="text-xs text-fg-muted">Personality</FieldLabel>
|
||||
<Select :model-value="personaValue" @update:model-value="setPersona(clear($event))">
|
||||
<Select
|
||||
:model-value="personaValue"
|
||||
@update:model-value="setPersona(clear($event))"
|
||||
>
|
||||
<SelectTrigger size="sm" class="w-full" aria-label="Personality">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem :value="DEFAULT">Default</SelectItem>
|
||||
<SelectItem v-for="name in selectorData.personas || []" :key="name" :value="name">{{ name }}</SelectItem>
|
||||
<SelectItem
|
||||
v-for="name in selectorData.personas || []"
|
||||
:key="name"
|
||||
:value="name"
|
||||
>{{ name }}</SelectItem
|
||||
>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
@@ -74,14 +98,21 @@ function clear(value: unknown): string {
|
||||
|
||||
<Field v-if="(selectorData.providers || []).length" class="gap-1">
|
||||
<FieldLabel class="text-xs text-fg-muted">Provider</FieldLabel>
|
||||
<Select :model-value="providerValue" @update:model-value="setProvider(clear($event))">
|
||||
<Select
|
||||
:model-value="providerValue"
|
||||
@update:model-value="setProvider(clear($event))"
|
||||
>
|
||||
<SelectTrigger size="sm" class="w-full" aria-label="Provider">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem :value="DEFAULT">Default</SelectItem>
|
||||
<SelectItem v-for="provider in selectorData.providers || []" :key="provider" :value="provider">
|
||||
<SelectItem
|
||||
v-for="provider in selectorData.providers || []"
|
||||
:key="provider"
|
||||
:value="provider"
|
||||
>
|
||||
{{ provider }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
@@ -91,14 +122,22 @@ function clear(value: unknown): string {
|
||||
|
||||
<Field class="gap-1">
|
||||
<FieldLabel class="text-xs text-fg-muted">Model</FieldLabel>
|
||||
<Select :model-value="modelValue" @update:model-value="setModel(clear($event))">
|
||||
<Select
|
||||
:model-value="modelValue"
|
||||
@update:model-value="setModel(clear($event))"
|
||||
>
|
||||
<SelectTrigger size="sm" class="w-full" aria-label="Model">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem :value="DEFAULT">Default</SelectItem>
|
||||
<SelectItem v-for="model in currentModels" :key="model" :value="model">{{ model }}</SelectItem>
|
||||
<SelectItem
|
||||
v-for="model in currentModels"
|
||||
:key="model"
|
||||
:value="model"
|
||||
>{{ model }}</SelectItem
|
||||
>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
@@ -20,15 +20,26 @@ const props = defineProps<{
|
||||
streaming?: boolean;
|
||||
}>();
|
||||
|
||||
const name = computed(() => props.tool.name || props.tool.Name || props.tool.tool || "tool");
|
||||
const parameters = computed(() => props.tool.parameters || props.tool.Parameters || "");
|
||||
const failed = computed(() => Boolean(props.tool.err || props.tool.Err || props.tool.failed));
|
||||
const name = computed(
|
||||
() => props.tool.name || props.tool.Name || props.tool.tool || "tool",
|
||||
);
|
||||
const parameters = computed(
|
||||
() => props.tool.parameters || props.tool.Parameters || "",
|
||||
);
|
||||
const failed = computed(() =>
|
||||
Boolean(props.tool.err || props.tool.Err || props.tool.failed),
|
||||
);
|
||||
|
||||
// A recorded turn reports its outcome in summary, a live frame in text, and a
|
||||
// failure may only carry the error. Which words stand in for silence depends on
|
||||
// whether the turn is still going: "running…" is true mid-turn and a lie after.
|
||||
const summary = computed(() => {
|
||||
const reported = props.tool.summary || props.tool.Summary || props.tool.text || props.tool.err || props.tool.Err;
|
||||
const reported =
|
||||
props.tool.summary ||
|
||||
props.tool.Summary ||
|
||||
props.tool.text ||
|
||||
props.tool.err ||
|
||||
props.tool.Err;
|
||||
if (reported) return reported;
|
||||
if (!props.streaming) return "done";
|
||||
return failed.value ? "failed" : "running…";
|
||||
@@ -38,9 +49,16 @@ const summary = computed(() => {
|
||||
<template>
|
||||
<ChatNavChip v-if="tool.path" :path="tool.path" :label="tool.label" />
|
||||
<div v-else class="flex items-baseline gap-1.5 [overflow-wrap:anywhere]">
|
||||
<Wrench aria-hidden="true" class="size-3.5 shrink-0 self-center text-fg-subtle" />
|
||||
<Wrench
|
||||
aria-hidden="true"
|
||||
class="size-3.5 shrink-0 self-center text-fg-subtle"
|
||||
/>
|
||||
<span class="font-semibold text-foreground">{{ name }}</span>
|
||||
<code v-if="parameters" class="font-mono text-[0.95em] text-fg-subtle">{{ parameters }}</code>
|
||||
<span :class="cn('text-fg-muted', failed && 'text-danger')">{{ summary }}</span>
|
||||
<code v-if="parameters" class="font-mono text-[0.95em] text-fg-subtle">{{
|
||||
parameters
|
||||
}}</code>
|
||||
<span :class="cn('text-fg-muted', failed && 'text-danger')">{{
|
||||
summary
|
||||
}}</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -12,7 +12,12 @@ import {
|
||||
} from "@/components/ui/message-scroller";
|
||||
import ChatBubble from "./ChatBubble.vue";
|
||||
import ChatEmptyState from "./ChatEmptyState.vue";
|
||||
import { messages, sendMessage, streamingTurn, type ChatMessage } from "./state";
|
||||
import {
|
||||
messages,
|
||||
sendMessage,
|
||||
streamingTurn,
|
||||
type ChatMessage,
|
||||
} from "./state";
|
||||
|
||||
/**
|
||||
* The conversation: the messages so far, the turn still arriving, and what the
|
||||
@@ -44,17 +49,32 @@ const bubbles = computed(() => messages.value.map(parts));
|
||||
<MessageScroller class="min-h-0 flex-1">
|
||||
<MessageScrollerViewport>
|
||||
<MessageScrollerContent class="gap-4 p-4">
|
||||
<ChatEmptyState v-if="!bubbles.length && !streamingTurn" @prompt="emit('prompt', $event)" />
|
||||
<ChatEmptyState
|
||||
v-if="!bubbles.length && !streamingTurn"
|
||||
@prompt="emit('prompt', $event)"
|
||||
/>
|
||||
|
||||
<template v-else>
|
||||
<MessageScrollerItem v-for="(bubble, i) in bubbles" :key="i" :message-id="`m${i}`">
|
||||
<ChatBubble :text="bubble.text" :tools="bubble.tools" :assistant="bubble.assistant" />
|
||||
<MessageScrollerItem
|
||||
v-for="(bubble, i) in bubbles"
|
||||
:key="i"
|
||||
:message-id="`m${i}`"
|
||||
>
|
||||
<ChatBubble
|
||||
:text="bubble.text"
|
||||
:tools="bubble.tools"
|
||||
:assistant="bubble.assistant"
|
||||
/>
|
||||
</MessageScrollerItem>
|
||||
|
||||
<!-- The live turn is a bubble like any other, so what arrives is
|
||||
rendered by the same rules as what was already there. It is the
|
||||
scroll anchor while it streams. -->
|
||||
<MessageScrollerItem v-if="streamingTurn" message-id="streaming" scroll-anchor>
|
||||
<MessageScrollerItem
|
||||
v-if="streamingTurn"
|
||||
message-id="streaming"
|
||||
scroll-anchor
|
||||
>
|
||||
<ChatBubble
|
||||
:text="streamingTurn.text || '…'"
|
||||
:tools="streamingTurn.tools"
|
||||
|
||||
+19
-5
@@ -17,12 +17,18 @@ const MAX_MATCHES = 8;
|
||||
* caret, matched on the command and its description together so a word from
|
||||
* either finds it.
|
||||
*/
|
||||
export function matchesFor(specs: ChatCommandSpec[], value: string, caret: number): ChatCommandSpec[] {
|
||||
export function matchesFor(
|
||||
specs: ChatCommandSpec[],
|
||||
value: string,
|
||||
caret: number,
|
||||
): ChatCommandSpec[] {
|
||||
const match = value.slice(0, caret).match(OPEN_TOKEN);
|
||||
if (!match) return [];
|
||||
const query = match[1].toLowerCase();
|
||||
return specs
|
||||
.filter((spec) => `${spec.command} ${spec.description ?? ""}`.toLowerCase().includes(query))
|
||||
.filter((spec) =>
|
||||
`${spec.command} ${spec.description ?? ""}`.toLowerCase().includes(query),
|
||||
)
|
||||
.slice(0, MAX_MATCHES);
|
||||
}
|
||||
|
||||
@@ -30,11 +36,16 @@ export function matchesFor(specs: ChatCommandSpec[], value: string, caret: numbe
|
||||
* applyCommand replaces the token being completed with the chosen command and
|
||||
* returns the cursor position just after it, ready for the next word.
|
||||
*/
|
||||
export function applyCommand(value: string, caret: number, command: string): { text: string; cursor: number } {
|
||||
export function applyCommand(
|
||||
value: string,
|
||||
caret: number,
|
||||
command: string,
|
||||
): { text: string; cursor: number } {
|
||||
const before = value.slice(0, caret);
|
||||
const after = value.slice(caret);
|
||||
const start = before.search(ANY_TOKEN);
|
||||
const tokenStart = start < 0 ? before.length : start + (before[start] === " " ? 1 : 0);
|
||||
const tokenStart =
|
||||
start < 0 ? before.length : start + (before[start] === " " ? 1 : 0);
|
||||
return {
|
||||
text: `${before.slice(0, tokenStart)}${command} ${after}`,
|
||||
cursor: tokenStart + command.length + 1,
|
||||
@@ -46,7 +57,10 @@ export function applyCommand(value: string, caret: number, command: string): { t
|
||||
* nothing else. Enter then sends it rather than completing it, so a command
|
||||
* typed in full is never re-entered by the palette that was offering it.
|
||||
*/
|
||||
export function isExactCommand(specs: ChatCommandSpec[], value: string): boolean {
|
||||
export function isExactCommand(
|
||||
specs: ChatCommandSpec[],
|
||||
value: string,
|
||||
): boolean {
|
||||
const trimmed = value.trim();
|
||||
return specs.some((spec) => spec.command === trimmed);
|
||||
}
|
||||
+23
-8
@@ -33,11 +33,13 @@ function inlineMarkdown(text: string): ChatInline[] {
|
||||
const children: ChatInline[] = [];
|
||||
let cursor = 0;
|
||||
for (const match of String(text).matchAll(INLINE)) {
|
||||
if (match.index > cursor) children.push({ kind: "text", text: text.slice(cursor, match.index) });
|
||||
if (match.index > cursor)
|
||||
children.push({ kind: "text", text: text.slice(cursor, match.index) });
|
||||
const value = match[0];
|
||||
if (value.startsWith("![")) {
|
||||
const img = value.match(/^!\[([^\]]*)\]\((.+)\)$/);
|
||||
if (img) children.push({ kind: "image", alt: img[1] || "Image", src: img[2] });
|
||||
if (img)
|
||||
children.push({ kind: "image", alt: img[1] || "Image", src: img[2] });
|
||||
} else if (value.startsWith("~~")) {
|
||||
children.push({ kind: "del", text: value.slice(2, -2) });
|
||||
} else if (value.startsWith("**") || value.startsWith("__")) {
|
||||
@@ -45,14 +47,17 @@ function inlineMarkdown(text: string): ChatInline[] {
|
||||
} else if (value.startsWith("`")) {
|
||||
children.push({ kind: "code", text: value.slice(1, -1) });
|
||||
} else if (value.startsWith("[")) {
|
||||
const link = value.match(/^\[([^\]]+)\]\((https?:\/\/[^\s)]+|\/[^\s)]+)\)$/);
|
||||
const link = value.match(
|
||||
/^\[([^\]]+)\]\((https?:\/\/[^\s)]+|\/[^\s)]+)\)$/,
|
||||
);
|
||||
if (link) children.push({ kind: "link", text: link[1], href: link[2] });
|
||||
} else {
|
||||
children.push({ kind: "em", text: value.slice(1, -1) });
|
||||
}
|
||||
cursor = match.index + value.length;
|
||||
}
|
||||
if (cursor < text.length) children.push({ kind: "text", text: text.slice(cursor) });
|
||||
if (cursor < text.length)
|
||||
children.push({ kind: "text", text: text.slice(cursor) });
|
||||
return children;
|
||||
}
|
||||
|
||||
@@ -71,7 +76,10 @@ export function parseMarkdown(text: string | null | undefined): ChatBlock[] {
|
||||
};
|
||||
const flushList = () => {
|
||||
if (!list) return;
|
||||
blocks.push({ kind: list.tag, items: list.items.map((item) => inlineMarkdown(item)) });
|
||||
blocks.push({
|
||||
kind: list.tag,
|
||||
items: list.items.map((item) => inlineMarkdown(item)),
|
||||
});
|
||||
list = null;
|
||||
};
|
||||
|
||||
@@ -93,7 +101,8 @@ export function parseMarkdown(text: string | null | undefined): ChatBlock[] {
|
||||
continue;
|
||||
}
|
||||
const headerCells = tableCells(line);
|
||||
const separatorCells = index + 1 < lines.length ? tableCells(lines[index + 1]) : null;
|
||||
const separatorCells =
|
||||
index + 1 < lines.length ? tableCells(lines[index + 1]) : null;
|
||||
if (
|
||||
headerCells &&
|
||||
separatorCells &&
|
||||
@@ -127,7 +136,10 @@ export function parseMarkdown(text: string | null | undefined): ChatBlock[] {
|
||||
if (heading) {
|
||||
flushParagraph();
|
||||
flushList();
|
||||
blocks.push({ kind: `h${heading[1].length}` as "h1" | "h2" | "h3", inline: inlineMarkdown(heading[2]) });
|
||||
blocks.push({
|
||||
kind: `h${heading[1].length}` as "h1" | "h2" | "h3",
|
||||
inline: inlineMarkdown(heading[2]),
|
||||
});
|
||||
continue;
|
||||
}
|
||||
const bullet = line.match(/^\s*[-*]\s+(.+)$/);
|
||||
@@ -145,7 +157,10 @@ export function parseMarkdown(text: string | null | undefined): ChatBlock[] {
|
||||
if (line.startsWith(">")) {
|
||||
flushParagraph();
|
||||
flushList();
|
||||
blocks.push({ kind: "blockquote", inline: inlineMarkdown(line.replace(/^>\s?/, "")) });
|
||||
blocks.push({
|
||||
kind: "blockquote",
|
||||
inline: inlineMarkdown(line.replace(/^>\s?/, "")),
|
||||
});
|
||||
continue;
|
||||
}
|
||||
paragraph.push(line);
|
||||
|
||||
+12
-3
@@ -1,7 +1,11 @@
|
||||
import type { ChatSession } from "./state";
|
||||
|
||||
export function sessionTitle(session: ChatSession): string {
|
||||
return session.title || session.branch_name || `Conversation ${session.session_id.slice(0, 8)}`;
|
||||
return (
|
||||
session.title ||
|
||||
session.branch_name ||
|
||||
`Conversation ${session.session_id.slice(0, 8)}`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -9,8 +13,13 @@ export function sessionTitle(session: ChatSession): string {
|
||||
* session switcher sits below it, so the header says which conversation is
|
||||
* open rather than repeating the product name.
|
||||
*/
|
||||
export function panelTitle(sessions: ChatSession[], currentSession: string): string {
|
||||
export function panelTitle(
|
||||
sessions: ChatSession[],
|
||||
currentSession: string,
|
||||
): string {
|
||||
if (!currentSession) return "Archie";
|
||||
const session = (sessions || []).find((item) => item.session_id === currentSession);
|
||||
const session = (sessions || []).find(
|
||||
(item) => item.session_id === currentSession,
|
||||
);
|
||||
return session ? sessionTitle(session) : "Archie";
|
||||
}
|
||||
+60
-17
@@ -3,7 +3,12 @@ import { computed, onMounted, onUnmounted, ref, watch, type Ref } from "vue";
|
||||
import { api } from "@/lib/api";
|
||||
import { channelID } from "./channel";
|
||||
import { matchesFor } from "./commands";
|
||||
import { resolveTurn, retryChatTurn, type ChatTurn, type RetryOptions } from "./turn";
|
||||
import {
|
||||
resolveTurn,
|
||||
retryChatTurn,
|
||||
type ChatTurn,
|
||||
type RetryOptions,
|
||||
} from "./turn";
|
||||
|
||||
/**
|
||||
* The chat panel's shared state.
|
||||
@@ -130,7 +135,9 @@ export const isCommandMenuOpen = ref(false);
|
||||
export const currentModels = computed(() => {
|
||||
const grouped = selectorData.value.models_by_provider || {};
|
||||
const provider = selectedProvider.value;
|
||||
return provider && grouped[provider] ? grouped[provider] : selectorData.value.models || [];
|
||||
return provider && grouped[provider]
|
||||
? grouped[provider]
|
||||
: selectorData.value.models || [];
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -166,7 +173,9 @@ function abortActiveTurn(): void {
|
||||
}
|
||||
|
||||
export async function refreshSessions(): Promise<void> {
|
||||
const data = await api.chatSessions<ChatSelectorData & { sessions?: ChatSession[] }>();
|
||||
const data = await api.chatSessions<
|
||||
ChatSelectorData & { sessions?: ChatSession[] }
|
||||
>();
|
||||
const sessionList = data.sessions || [];
|
||||
sessions.value = sessionList;
|
||||
selectorData.value = data;
|
||||
@@ -177,7 +186,9 @@ export async function refreshSessions(): Promise<void> {
|
||||
selectedModel.value = data.active_model || "";
|
||||
|
||||
commandSpecs.value = (data.commands || []).map((item) =>
|
||||
typeof item === "string" ? { command: item, usage: item, description: "" } : item,
|
||||
typeof item === "string"
|
||||
? { command: item, usage: item, description: "" }
|
||||
: item,
|
||||
);
|
||||
|
||||
if (!currentSession.value && sessionList[0]) {
|
||||
@@ -195,13 +206,17 @@ export async function selectSession(id: string): Promise<void> {
|
||||
messages.value = [];
|
||||
streamingTurn.value = null;
|
||||
|
||||
selectedPersona.value = data.active_personas?.[id] || data.active_persona || "";
|
||||
selectedPersona.value =
|
||||
data.active_personas?.[id] || data.active_persona || "";
|
||||
|
||||
try {
|
||||
// Resuming is the server's own command, so the transcript read below is of
|
||||
// a conversation the server considers current rather than a stale one.
|
||||
await api.chatMessage(channelID(), `/resume ${id}`);
|
||||
const [msgs, turns] = await Promise.all([api.chatMessages<ChatMessage[]>(id), api.chatTurns<ChatTurnView[]>(id)]);
|
||||
const [msgs, turns] = await Promise.all([
|
||||
api.chatMessages<ChatMessage[]>(id),
|
||||
api.chatTurns<ChatTurnView[]>(id),
|
||||
]);
|
||||
const byAssistantMessage = new Map<string, ChatTurnView>();
|
||||
for (const turn of turns || []) {
|
||||
const assistantID = turn.assistant_message_id || turn.AssistantMessageID;
|
||||
@@ -212,10 +227,13 @@ export async function selectSession(id: string): Promise<void> {
|
||||
messages.value = (msgs || []).map((message) => {
|
||||
const messageID = message.message_id || message.MessageID;
|
||||
const turn = messageID ? byAssistantMessage.get(messageID) : undefined;
|
||||
return turn ? { ...message, tool_calls: turn.tool_calls || turn.ToolCalls || [] } : message;
|
||||
return turn
|
||||
? { ...message, tool_calls: turn.tool_calls || turn.ToolCalls || [] }
|
||||
: message;
|
||||
});
|
||||
} catch (err) {
|
||||
statusText.value = (err as Error).message || "Could not load session messages";
|
||||
statusText.value =
|
||||
(err as Error).message || "Could not load session messages";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +249,10 @@ export async function runSessionCommand(command: string): Promise<void> {
|
||||
if (!currentSession.value) return;
|
||||
try {
|
||||
statusText.value = "Working…";
|
||||
const result = await api.chatMessage<{ session_id?: string; reply?: string }>(channelID(), command);
|
||||
const result = await api.chatMessage<{
|
||||
session_id?: string;
|
||||
reply?: string;
|
||||
}>(channelID(), command);
|
||||
if (result.session_id) currentSession.value = result.session_id;
|
||||
statusText.value = result.reply || "Session updated";
|
||||
await refreshSessions();
|
||||
@@ -274,7 +295,10 @@ export async function setProvider(provider: string): Promise<void> {
|
||||
selectedProvider.value = provider;
|
||||
if (!provider) return;
|
||||
try {
|
||||
const result = await api.chatMessage<{ reply?: string }>(channelID(), `/model --provider ${provider}`);
|
||||
const result = await api.chatMessage<{ reply?: string }>(
|
||||
channelID(),
|
||||
`/model --provider ${provider}`,
|
||||
);
|
||||
statusText.value = result.reply || "Provider updated";
|
||||
await refreshSessions();
|
||||
} catch (err) {
|
||||
@@ -286,7 +310,10 @@ export async function setModel(model: string): Promise<void> {
|
||||
selectedModel.value = model;
|
||||
if (!model) return;
|
||||
try {
|
||||
const result = await api.chatMessage<{ reply?: string }>(channelID(), `/model ${model}`);
|
||||
const result = await api.chatMessage<{ reply?: string }>(
|
||||
channelID(),
|
||||
`/model ${model}`,
|
||||
);
|
||||
statusText.value = result.reply || "Model updated";
|
||||
await refreshSessions();
|
||||
} catch (err) {
|
||||
@@ -329,7 +356,8 @@ function currentPage(): string {
|
||||
|
||||
export async function sendMessage(retryOpts?: RetryOptions): Promise<void> {
|
||||
const explicitText = retryOpts?.textOverride;
|
||||
const rawValue = explicitText !== undefined ? explicitText : composerText.value;
|
||||
const rawValue =
|
||||
explicitText !== undefined ? explicitText : composerText.value;
|
||||
const { text, turn, isRetry } = resolveTurn(retryOpts, rawValue);
|
||||
if (!text || isSending.value) return;
|
||||
|
||||
@@ -384,20 +412,26 @@ export async function sendMessage(retryOpts?: RetryOptions): Promise<void> {
|
||||
const frames = buffer.split("\n\n");
|
||||
buffer = frames.pop() || "";
|
||||
for (const frame of frames) {
|
||||
const line = frame.split("\n").find((part) => part.startsWith("data: "));
|
||||
const line = frame
|
||||
.split("\n")
|
||||
.find((part) => part.startsWith("data: "));
|
||||
if (!line) continue;
|
||||
const event = JSON.parse(line.slice(6)) as ChatStreamFrame;
|
||||
if (event.session_id) currentSession.value = event.session_id;
|
||||
if (event.type === "delta") {
|
||||
streamedText += event.text;
|
||||
streamingTurn.value = streamingTurn.value ? { ...streamingTurn.value, text: streamedText } : null;
|
||||
streamingTurn.value = streamingTurn.value
|
||||
? { ...streamingTurn.value, text: streamedText }
|
||||
: null;
|
||||
}
|
||||
// A navigate result is appended to the same list as the tool calls: it
|
||||
// is one more thing the turn did, and it renders as a chip rather than
|
||||
// a tool line.
|
||||
if (event.type === "tool" || event.type === "navigate") {
|
||||
activeTools = [...activeTools, event];
|
||||
streamingTurn.value = streamingTurn.value ? { ...streamingTurn.value, tools: activeTools } : null;
|
||||
streamingTurn.value = streamingTurn.value
|
||||
? { ...streamingTurn.value, tools: activeTools }
|
||||
: null;
|
||||
}
|
||||
if (event.type === "done") {
|
||||
finished = true;
|
||||
@@ -410,14 +444,23 @@ export async function sendMessage(retryOpts?: RetryOptions): Promise<void> {
|
||||
|
||||
if (!finished) throw new Error("chat stream ended before completion");
|
||||
|
||||
messages.value = [...messages.value, { from: "assistant", text: streamedText, tool_calls: activeTools }];
|
||||
messages.value = [
|
||||
...messages.value,
|
||||
{ from: "assistant", text: streamedText, tool_calls: activeTools },
|
||||
];
|
||||
streamingTurn.value = null;
|
||||
statusText.value = "Ready";
|
||||
await refreshSessions();
|
||||
} catch (err) {
|
||||
const failed = err as Error;
|
||||
if (failed.name === "AbortError" && !timedOut) {
|
||||
streamingTurn.value = { text: "Turn stopped.", tools: activeTools, isError: false, turn, isRetry };
|
||||
streamingTurn.value = {
|
||||
text: "Turn stopped.",
|
||||
tools: activeTools,
|
||||
isError: false,
|
||||
turn,
|
||||
isRetry,
|
||||
};
|
||||
statusText.value = "Stopped";
|
||||
} else {
|
||||
streamingTurn.value = {
|
||||
|
||||
+6
-1
@@ -35,7 +35,12 @@ export function resolveTurn(
|
||||
retry: RetryOptions | null | undefined,
|
||||
composerValue: string,
|
||||
): { text: string; turn: ChatTurn; isRetry: boolean } {
|
||||
const isRetry = !!(retry && typeof retry === "object" && retry.turn && typeof retry.turn.text === "string");
|
||||
const isRetry = !!(
|
||||
retry &&
|
||||
typeof retry === "object" &&
|
||||
retry.turn &&
|
||||
typeof retry.turn.text === "string"
|
||||
);
|
||||
const text = isRetry ? retry.turn!.text : composerValue.trim();
|
||||
const turn = isRetry ? retryChatTurn(retry.turn!) : newChatTurn(text);
|
||||
return { text, turn, isRetry };
|
||||
|
||||
@@ -30,7 +30,9 @@ const list = ref<HTMLElement | null>(null);
|
||||
// The same list the topbar's SearchBar and Nav read: navEntries flattens the
|
||||
// nav tree and drops what this composition cannot back, so the palette can
|
||||
// never offer a destination the server cannot serve.
|
||||
const allEntries = computed(() => navEntries(props.hidden).filter((entry) => !entry.soon));
|
||||
const allEntries = computed(() =>
|
||||
navEntries(props.hidden).filter((entry) => !entry.soon),
|
||||
);
|
||||
|
||||
// Substring, not prefix: an operator who remembers "where do channels live"
|
||||
// types a word from the description, not the start of the label.
|
||||
@@ -38,7 +40,9 @@ const matches = computed(() => {
|
||||
const needle = query.value.trim().toLowerCase();
|
||||
if (!needle) return allEntries.value;
|
||||
return allEntries.value.filter((entry) =>
|
||||
`${entry.label} ${entry.description} ${entry.path}`.toLowerCase().includes(needle),
|
||||
`${entry.label} ${entry.description} ${entry.path}`
|
||||
.toLowerCase()
|
||||
.includes(needle),
|
||||
);
|
||||
});
|
||||
watch(query, () => {
|
||||
@@ -78,7 +82,10 @@ function isEditableTarget(event: KeyboardEvent): boolean {
|
||||
const el = event.target;
|
||||
return (
|
||||
el instanceof HTMLElement &&
|
||||
(el.isContentEditable || el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT")
|
||||
(el.isContentEditable ||
|
||||
el.tagName === "INPUT" ||
|
||||
el.tagName === "TEXTAREA" ||
|
||||
el.tagName === "SELECT")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -110,7 +117,8 @@ function onKeydown(event: KeyboardEvent): void {
|
||||
}
|
||||
if (event.key === "ArrowDown") {
|
||||
event.preventDefault();
|
||||
if (matches.value.length) selection.value = Math.min(selection.value + 1, matches.value.length - 1);
|
||||
if (matches.value.length)
|
||||
selection.value = Math.min(selection.value + 1, matches.value.length - 1);
|
||||
return;
|
||||
}
|
||||
if (event.key === "ArrowUp") {
|
||||
@@ -137,13 +145,18 @@ function choose(entry: NavEntry): void {
|
||||
watch([selection, matches], async () => {
|
||||
if (!open.value) return;
|
||||
await nextTick();
|
||||
list.value?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({ block: "nearest" });
|
||||
list.value
|
||||
?.querySelector('[aria-selected="true"]')
|
||||
?.scrollIntoView?.({ block: "nearest" });
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="open" class="fixed inset-0 isolate z-50" @mousedown.self="close">
|
||||
<div class="bg-black/10 supports-backdrop-filter:backdrop-blur-xs absolute inset-0" aria-hidden="true" />
|
||||
<div
|
||||
class="bg-black/10 supports-backdrop-filter:backdrop-blur-xs absolute inset-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-label="Command palette"
|
||||
@@ -159,7 +172,9 @@ watch([selection, matches], async () => {
|
||||
aria-label="Filter sections"
|
||||
aria-expanded="true"
|
||||
aria-controls="command-palette-list"
|
||||
:aria-activedescendant="matches[selection] ? optionId(selection) : undefined"
|
||||
:aria-activedescendant="
|
||||
matches[selection] ? optionId(selection) : undefined
|
||||
"
|
||||
class="h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
||||
placeholder="Jump to a section…"
|
||||
@keydown="onKeydown"
|
||||
@@ -184,11 +199,19 @@ watch([selection, matches], async () => {
|
||||
@mousemove="selection = index"
|
||||
@click="choose(entry)"
|
||||
>
|
||||
<span class="truncate text-sm text-foreground">{{ entry.label }}</span>
|
||||
<span v-if="entry.description" class="text-fg-muted truncate text-xs">{{ entry.description }}</span>
|
||||
<span class="truncate text-sm text-foreground">{{
|
||||
entry.label
|
||||
}}</span>
|
||||
<span
|
||||
v-if="entry.description"
|
||||
class="text-fg-muted truncate text-xs"
|
||||
>{{ entry.description }}</span
|
||||
>
|
||||
</button>
|
||||
<p v-if="!matches.length" class="text-fg-muted px-2.5 py-3 text-sm">No matching section.</p>
|
||||
<p v-if="!matches.length" class="text-fg-muted px-2.5 py-3 text-sm">
|
||||
No matching section.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
@@ -4,7 +4,10 @@ import BrandName from "./BrandName.vue";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouterLink to="/" class="flex items-center gap-2 rounded-md px-1 py-1 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50">
|
||||
<RouterLink
|
||||
to="/"
|
||||
class="flex items-center gap-2 rounded-md px-1 py-1 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
||||
>
|
||||
<Logo />
|
||||
<BrandName class="hidden sm:inline" />
|
||||
</RouterLink>
|
||||
|
||||
@@ -12,6 +12,11 @@ withDefaults(defineProps<{ size?: number }>(), { size: 22 });
|
||||
class="text-link shrink-0"
|
||||
>
|
||||
<path d="M12 2.5 21 20h-4.1L12 10.6 7.1 20H3l9-17.5Z" fill="currentColor" />
|
||||
<path d="M8.6 16.2h6.8" stroke="var(--background)" stroke-width="1.6" stroke-linecap="round" />
|
||||
<path
|
||||
d="M8.6 16.2h6.8"
|
||||
stroke="var(--background)"
|
||||
stroke-width="1.6"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
||||
@@ -14,12 +14,27 @@ const activePath = computed(() => activeNavPath(route.path));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nav aria-label="Sections" class="flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto">
|
||||
<template v-for="node in tree" :key="node.kind === 'link' ? node.entry.path : node.label">
|
||||
<NavTrigger v-if="node.kind === 'link'" :to="node.entry.path" :current="activePath === node.entry.path">
|
||||
<nav
|
||||
aria-label="Sections"
|
||||
class="flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto"
|
||||
>
|
||||
<template
|
||||
v-for="node in tree"
|
||||
:key="node.kind === 'link' ? node.entry.path : node.label"
|
||||
>
|
||||
<NavTrigger
|
||||
v-if="node.kind === 'link'"
|
||||
:to="node.entry.path"
|
||||
:current="activePath === node.entry.path"
|
||||
>
|
||||
{{ node.entry.label }}
|
||||
</NavTrigger>
|
||||
<NavGroup v-else :label="node.label" :items="node.items" :active-path="activePath" />
|
||||
<NavGroup
|
||||
v-else
|
||||
:label="node.label"
|
||||
:items="node.items"
|
||||
:active-path="activePath"
|
||||
/>
|
||||
</template>
|
||||
</nav>
|
||||
</template>
|
||||
@@ -13,7 +13,11 @@ import type { NavEntry } from "@/lib/nav";
|
||||
import NavItem from "./NavItem.vue";
|
||||
import NavTrigger from "./NavTrigger.vue";
|
||||
|
||||
const props = defineProps<{ label: string; items: NavEntry[]; activePath: string }>();
|
||||
const props = defineProps<{
|
||||
label: string;
|
||||
items: NavEntry[];
|
||||
activePath: string;
|
||||
}>();
|
||||
|
||||
const holds = (path: string) => props.activePath === path;
|
||||
|
||||
@@ -61,9 +65,11 @@ function closeMenuSoon() {
|
||||
>
|
||||
<template v-for="item in items" :key="item.path">
|
||||
<DropdownMenuSeparator v-if="item.dividerBefore" />
|
||||
<DropdownMenuLabel v-if="item.dividerBefore">{{ item.dividerBefore }}</DropdownMenuLabel>
|
||||
<DropdownMenuLabel v-if="item.dividerBefore">{{
|
||||
item.dividerBefore
|
||||
}}</DropdownMenuLabel>
|
||||
<NavItem :entry="item" :current="holds(item.path)" />
|
||||
</template>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</template>
|
||||
</template>
|
||||
@@ -14,7 +14,11 @@ defineProps<{ entry: NavEntry; current: boolean }>();
|
||||
>
|
||||
<RouterLink :to="entry.path" class="w-full cursor-pointer">
|
||||
<span class="flex-1">{{ entry.label }}</span>
|
||||
<span v-if="entry.soon" class="text-muted-foreground text-[11px] tracking-wide uppercase">soon</span>
|
||||
<span
|
||||
v-if="entry.soon"
|
||||
class="text-muted-foreground text-[11px] tracking-wide uppercase"
|
||||
>soon</span
|
||||
>
|
||||
</RouterLink>
|
||||
</DropdownMenuItem>
|
||||
</template>
|
||||
@@ -26,10 +26,14 @@ import {
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem as-child>
|
||||
<RouterLink to="/system/appearance" class="w-full cursor-pointer">Appearance</RouterLink>
|
||||
<RouterLink to="/system/appearance" class="w-full cursor-pointer"
|
||||
>Appearance</RouterLink
|
||||
>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem as-child>
|
||||
<RouterLink to="/system/status" class="w-full cursor-pointer">Status</RouterLink>
|
||||
<RouterLink to="/system/status" class="w-full cursor-pointer"
|
||||
>Status</RouterLink
|
||||
>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
@@ -13,7 +13,9 @@ const field = ref<{ $el: HTMLInputElement } | null>(null);
|
||||
const query = ref("");
|
||||
const open = ref(false);
|
||||
|
||||
const entries = computed(() => navEntries(props.hidden).filter((entry) => !entry.soon));
|
||||
const entries = computed(() =>
|
||||
navEntries(props.hidden).filter((entry) => !entry.soon),
|
||||
);
|
||||
|
||||
// Jumping between sections, deliberately not a data search: each section owns
|
||||
// its own filtering, and one box that means something different on every page
|
||||
@@ -21,7 +23,9 @@ const entries = computed(() => navEntries(props.hidden).filter((entry) => !entry
|
||||
const hit = computed(() => {
|
||||
const wanted = query.value.trim().toLowerCase();
|
||||
if (!wanted) return undefined;
|
||||
return entries.value.find((entry) => entry.label.toLowerCase().startsWith(wanted));
|
||||
return entries.value.find((entry) =>
|
||||
entry.label.toLowerCase().startsWith(wanted),
|
||||
);
|
||||
});
|
||||
|
||||
async function toggle() {
|
||||
@@ -62,7 +66,10 @@ function onKeydown(event: KeyboardEvent) {
|
||||
<Search :size="16" />
|
||||
</button>
|
||||
<div class="relative" :class="open ? 'block' : 'hidden lg:block'">
|
||||
<Search :size="15" class="text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2" />
|
||||
<Search
|
||||
:size="15"
|
||||
class="text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2"
|
||||
/>
|
||||
<Input
|
||||
ref="field"
|
||||
v-model="query"
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { CircleQuestionMark } from "@lucide/vue";
|
||||
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -9,7 +9,9 @@ defineProps<{ hidden: string[] }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="bg-background/80 sticky top-0 z-40 flex h-14 items-center gap-3 border-b px-3 backdrop-blur-xl sm:px-4">
|
||||
<header
|
||||
class="bg-background/80 sticky top-0 z-40 flex h-14 items-center gap-3 border-b px-3 backdrop-blur-xl sm:px-4"
|
||||
>
|
||||
<Brand />
|
||||
<Nav :hidden="hidden" />
|
||||
<div class="flex shrink-0 items-center gap-1">
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import type { AlertDialogEmits, AlertDialogProps } from 'reka-ui'
|
||||
import { AlertDialogRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
import type { AlertDialogEmits, AlertDialogProps } from "reka-ui";
|
||||
import { AlertDialogRoot, useForwardPropsEmits } from "reka-ui";
|
||||
|
||||
const props = defineProps<AlertDialogProps>()
|
||||
const emits = defineEmits<AlertDialogEmits>()
|
||||
const props = defineProps<AlertDialogProps>();
|
||||
const emits = defineEmits<AlertDialogEmits>();
|
||||
|
||||
const forwarded = useForwardPropsEmits(props, emits)
|
||||
const forwarded = useForwardPropsEmits(props, emits);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogRoot v-slot="slotProps" data-slot="alert-dialog" v-bind="forwarded">
|
||||
<AlertDialogRoot
|
||||
v-slot="slotProps"
|
||||
data-slot="alert-dialog"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</AlertDialogRoot>
|
||||
</template>
|
||||
@@ -1,25 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import type { AlertDialogActionProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import type { ButtonVariants } from '@/components/ui/button'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { AlertDialogAction } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { buttonVariants } from '@/components/ui/button'
|
||||
import type { AlertDialogActionProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { ButtonVariants } from "@/components/ui/button";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { AlertDialogAction } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<AlertDialogActionProps & {
|
||||
class?: HTMLAttributes['class']
|
||||
variant?: ButtonVariants['variant']
|
||||
size?: ButtonVariants['size']
|
||||
}>(),
|
||||
defineProps<
|
||||
AlertDialogActionProps & {
|
||||
class?: HTMLAttributes["class"];
|
||||
variant?: ButtonVariants["variant"];
|
||||
size?: ButtonVariants["size"];
|
||||
}
|
||||
>(),
|
||||
{
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class', 'variant', 'size')
|
||||
const delegatedProps = reactiveOmit(props, "class", "variant", "size");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,36 +1,34 @@
|
||||
<script setup lang="ts">
|
||||
import type { AlertDialogCancelProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import type { ButtonVariants } from '@/components/ui/button'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { AlertDialogCancel } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { buttonVariants } from '@/components/ui/button'
|
||||
import type { AlertDialogCancelProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { ButtonVariants } from "@/components/ui/button";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { AlertDialogCancel } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<AlertDialogCancelProps & {
|
||||
class?: HTMLAttributes['class']
|
||||
variant?: ButtonVariants['variant']
|
||||
size?: ButtonVariants['size']
|
||||
}>(),
|
||||
defineProps<
|
||||
AlertDialogCancelProps & {
|
||||
class?: HTMLAttributes["class"];
|
||||
variant?: ButtonVariants["variant"];
|
||||
size?: ButtonVariants["size"];
|
||||
}
|
||||
>(),
|
||||
{
|
||||
variant: 'outline',
|
||||
size: 'default',
|
||||
variant: "outline",
|
||||
size: "default",
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class', 'variant', 'size')
|
||||
const delegatedProps = reactiveOmit(props, "class", "variant", "size");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogCancel
|
||||
data-slot="alert-dialog-cancel"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn(
|
||||
'',
|
||||
buttonVariants({ variant, size }),
|
||||
props.class,
|
||||
)"
|
||||
:class="cn('', buttonVariants({ variant, size }), props.class)"
|
||||
>
|
||||
<slot />
|
||||
</AlertDialogCancel>
|
||||
|
||||
@@ -1,33 +1,35 @@
|
||||
<script setup lang="ts">
|
||||
import type { AlertDialogContentEmits, AlertDialogContentProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import type { AlertDialogContentEmits, AlertDialogContentProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import {
|
||||
AlertDialogContent,
|
||||
AlertDialogOverlay,
|
||||
AlertDialogPortal,
|
||||
useForwardPropsEmits,
|
||||
} from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
} from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
defineOptions({
|
||||
inheritAttrs: false,
|
||||
})
|
||||
});
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<AlertDialogContentProps & {
|
||||
class?: HTMLAttributes['class']
|
||||
size?: 'default' | 'sm'
|
||||
}>(),
|
||||
defineProps<
|
||||
AlertDialogContentProps & {
|
||||
class?: HTMLAttributes["class"];
|
||||
size?: "default" | "sm";
|
||||
}
|
||||
>(),
|
||||
{
|
||||
size: 'default',
|
||||
size: "default",
|
||||
},
|
||||
)
|
||||
const emits = defineEmits<AlertDialogContentEmits>()
|
||||
);
|
||||
const emits = defineEmits<AlertDialogContentEmits>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class', 'size')
|
||||
const delegatedProps = reactiveOmit(props, "class", "size");
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import type { AlertDialogDescriptionProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import {
|
||||
AlertDialogDescription,
|
||||
} from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { AlertDialogDescriptionProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { AlertDialogDescription } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<AlertDialogDescriptionProps & { class?: HTMLAttributes['class'] }>()
|
||||
const props = defineProps<
|
||||
AlertDialogDescriptionProps & { class?: HTMLAttributes["class"] }
|
||||
>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogDescription
|
||||
data-slot="alert-dialog-description"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn('text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</AlertDialogDescription>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="alert-dialog-header"
|
||||
:class="cn('grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="alert-dialog-media"
|
||||
:class="cn('bg-muted mb-2 inline-flex size-10 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*=size-])]:size-6', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'bg-muted mb-2 inline-flex size-10 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*=size-])]:size-6',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import type { AlertDialogTitleProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { AlertDialogTitle } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { AlertDialogTitleProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { AlertDialogTitle } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<AlertDialogTitleProps & { class?: HTMLAttributes['class'] }>()
|
||||
const props = defineProps<
|
||||
AlertDialogTitleProps & { class?: HTMLAttributes["class"] }
|
||||
>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogTitle
|
||||
data-slot="alert-dialog-title"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn('text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2 cn-font-heading', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2 cn-font-heading',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</AlertDialogTitle>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { AlertDialogTriggerProps } from 'reka-ui'
|
||||
import { AlertDialogTrigger } from 'reka-ui'
|
||||
import type { AlertDialogTriggerProps } from "reka-ui";
|
||||
import { AlertDialogTrigger } from "reka-ui";
|
||||
|
||||
const props = defineProps<AlertDialogTriggerProps>()
|
||||
const props = defineProps<AlertDialogTriggerProps>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export { default as AlertDialog } from './AlertDialog.vue'
|
||||
export { default as AlertDialogAction } from './AlertDialogAction.vue'
|
||||
export { default as AlertDialogCancel } from './AlertDialogCancel.vue'
|
||||
export { default as AlertDialogContent } from './AlertDialogContent.vue'
|
||||
export { default as AlertDialogDescription } from './AlertDialogDescription.vue'
|
||||
export { default as AlertDialogFooter } from './AlertDialogFooter.vue'
|
||||
export { default as AlertDialogHeader } from './AlertDialogHeader.vue'
|
||||
export { default as AlertDialogMedia } from './AlertDialogMedia.vue'
|
||||
export { default as AlertDialogTitle } from './AlertDialogTitle.vue'
|
||||
export { default as AlertDialogTrigger } from './AlertDialogTrigger.vue'
|
||||
export { default as AlertDialog } from "./AlertDialog.vue";
|
||||
export { default as AlertDialogAction } from "./AlertDialogAction.vue";
|
||||
export { default as AlertDialogCancel } from "./AlertDialogCancel.vue";
|
||||
export { default as AlertDialogContent } from "./AlertDialogContent.vue";
|
||||
export { default as AlertDialogDescription } from "./AlertDialogDescription.vue";
|
||||
export { default as AlertDialogFooter } from "./AlertDialogFooter.vue";
|
||||
export { default as AlertDialogHeader } from "./AlertDialogHeader.vue";
|
||||
export { default as AlertDialogMedia } from "./AlertDialogMedia.vue";
|
||||
export { default as AlertDialogTitle } from "./AlertDialogTitle.vue";
|
||||
export { default as AlertDialogTrigger } from "./AlertDialogTrigger.vue";
|
||||
@@ -1,13 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import type { AlertVariants } from '.'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { alertVariants } from '.'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { AlertVariants } from ".";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { alertVariants } from ".";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
variant?: AlertVariants['variant']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
variant?: AlertVariants["variant"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="alert-description"
|
||||
:class="cn('text-muted-foreground text-sm text-balance md:text-pretty [&_p:not(:last-child)]:mb-4 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'text-muted-foreground text-sm text-balance md:text-pretty [&_p:not(:last-child)]:mb-4 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="alert-title"
|
||||
:class="cn('font-medium group-has-[>svg]/alert:col-start-2 cn-font-heading [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'font-medium group-has-[>svg]/alert:col-start-2 cn-font-heading [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import { cva } from 'class-variance-authority'
|
||||
import type { VariantProps } from "class-variance-authority";
|
||||
import { cva } from "class-variance-authority";
|
||||
|
||||
export { default as Alert } from './Alert.vue'
|
||||
export { default as AlertAction } from './AlertAction.vue'
|
||||
export { default as AlertDescription } from './AlertDescription.vue'
|
||||
export { default as AlertTitle } from './AlertTitle.vue'
|
||||
export { default as Alert } from "./Alert.vue";
|
||||
export { default as AlertAction } from "./AlertAction.vue";
|
||||
export { default as AlertDescription } from "./AlertDescription.vue";
|
||||
export { default as AlertTitle } from "./AlertTitle.vue";
|
||||
|
||||
export const alertVariants = cva('grid gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*=size-])]:size-4 group/alert relative w-full', {
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-card text-card-foreground',
|
||||
destructive: 'text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current',
|
||||
export const alertVariants = cva(
|
||||
"grid gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*=size-])]:size-4 group/alert relative w-full",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-card text-card-foreground",
|
||||
destructive:
|
||||
"text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
export type AlertVariants = VariantProps<typeof alertVariants>
|
||||
export type AlertVariants = VariantProps<typeof alertVariants>;
|
||||
@@ -1,14 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import type { AvatarVariants } from '.'
|
||||
import { AvatarRoot } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { avatarVariants } from '.'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { AvatarVariants } from ".";
|
||||
import { AvatarRoot } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { avatarVariants } from ".";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
size?: AvatarVariants['size']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
size?: AvatarVariants["size"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
data-slot="avatar-badge"
|
||||
:class="cn(
|
||||
'bg-primary text-primary-foreground ring-background absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-blend-color ring-2 select-none',
|
||||
'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden',
|
||||
'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2',
|
||||
'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2',
|
||||
props.class,
|
||||
)"
|
||||
:class="
|
||||
cn(
|
||||
'bg-primary text-primary-foreground ring-background absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-blend-color ring-2 select-none',
|
||||
'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden',
|
||||
'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2',
|
||||
'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</span>
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import type { AvatarFallbackProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { AvatarFallback } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { AvatarFallbackProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { AvatarFallback } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<AvatarFallbackProps & { class?: HTMLAttributes['class'] }>()
|
||||
const props = defineProps<
|
||||
AvatarFallbackProps & { class?: HTMLAttributes["class"] }
|
||||
>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AvatarFallback
|
||||
data-slot="avatar-fallback"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn('bg-muted text-muted-foreground rounded-full flex size-full items-center justify-center text-sm group-data-[size=sm]/avatar:text-xs', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'bg-muted text-muted-foreground rounded-full flex size-full items-center justify-center text-sm group-data-[size=sm]/avatar:text-xs',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</AvatarFallback>
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="avatar-group"
|
||||
:class="cn(
|
||||
'group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background',
|
||||
props.class,
|
||||
)"
|
||||
:class="
|
||||
cn(
|
||||
'group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="avatar-group-count"
|
||||
:class="cn(
|
||||
'bg-muted text-muted-foreground size-8 rounded-full text-sm group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3 relative flex shrink-0 items-center justify-center ring-2 ring-background',
|
||||
props.class,
|
||||
)"
|
||||
:class="
|
||||
cn(
|
||||
'bg-muted text-muted-foreground size-8 rounded-full text-sm group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3 relative flex shrink-0 items-center justify-center ring-2 ring-background',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { AvatarImageProps } from 'reka-ui'
|
||||
import { AvatarImage } from 'reka-ui'
|
||||
import type { AvatarImageProps } from "reka-ui";
|
||||
import { AvatarImage } from "reka-ui";
|
||||
|
||||
const props = defineProps<AvatarImageProps>()
|
||||
const props = defineProps<AvatarImageProps>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import { cva } from 'class-variance-authority'
|
||||
import type { VariantProps } from "class-variance-authority";
|
||||
import { cva } from "class-variance-authority";
|
||||
|
||||
export { default as Avatar } from './Avatar.vue'
|
||||
export { default as AvatarBadge } from './AvatarBadge.vue'
|
||||
export { default as AvatarFallback } from './AvatarFallback.vue'
|
||||
export { default as AvatarGroup } from './AvatarGroup.vue'
|
||||
export { default as AvatarGroupCount } from './AvatarGroupCount.vue'
|
||||
export { default as AvatarImage } from './AvatarImage.vue'
|
||||
export { default as Avatar } from "./Avatar.vue";
|
||||
export { default as AvatarBadge } from "./AvatarBadge.vue";
|
||||
export { default as AvatarFallback } from "./AvatarFallback.vue";
|
||||
export { default as AvatarGroup } from "./AvatarGroup.vue";
|
||||
export { default as AvatarGroupCount } from "./AvatarGroupCount.vue";
|
||||
export { default as AvatarImage } from "./AvatarImage.vue";
|
||||
|
||||
export const avatarVariants = cva(
|
||||
'size-8 rounded-full after:rounded-full data-[size=lg]:size-10 data-[size=sm]:size-6 group/avatar relative flex shrink-0 select-none after:absolute after:inset-0 after:border after:border-border after:mix-blend-darken dark:after:mix-blend-lighten',
|
||||
"size-8 rounded-full after:rounded-full data-[size=lg]:size-10 data-[size=sm]:size-6 group/avatar relative flex shrink-0 select-none after:absolute after:inset-0 after:border after:border-border after:mix-blend-darken dark:after:mix-blend-lighten",
|
||||
{
|
||||
variants: {
|
||||
size: {
|
||||
sm: '',
|
||||
default: '',
|
||||
lg: '',
|
||||
sm: "",
|
||||
default: "",
|
||||
lg: "",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
size: 'default',
|
||||
size: "default",
|
||||
},
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
export type AvatarVariants = VariantProps<typeof avatarVariants>
|
||||
export type AvatarVariants = VariantProps<typeof avatarVariants>;
|
||||
@@ -1,18 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import type { PrimitiveProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import type { BadgeVariants } from '.'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { Primitive } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { badgeVariants } from '.'
|
||||
import type { PrimitiveProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { BadgeVariants } from ".";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { Primitive } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { badgeVariants } from ".";
|
||||
|
||||
const props = defineProps<PrimitiveProps & {
|
||||
variant?: BadgeVariants['variant']
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
const props = defineProps<
|
||||
PrimitiveProps & {
|
||||
variant?: BadgeVariants["variant"];
|
||||
class?: HTMLAttributes["class"];
|
||||
}
|
||||
>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,35 +1,39 @@
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import { cva } from 'class-variance-authority'
|
||||
import type { VariantProps } from "class-variance-authority";
|
||||
import { cva } from "class-variance-authority";
|
||||
|
||||
export { default as Badge } from './Badge.vue'
|
||||
export { default as Badge } from "./Badge.vue";
|
||||
|
||||
export const badgeVariants = cva(
|
||||
'h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none',
|
||||
"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
|
||||
secondary: 'bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80',
|
||||
destructive: 'bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20',
|
||||
outline: 'border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground',
|
||||
ghost: 'hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50',
|
||||
link: 'text-primary underline-offset-4 hover:underline',
|
||||
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
||||
destructive:
|
||||
"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",
|
||||
outline:
|
||||
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
||||
ghost:
|
||||
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
// Status. The five semantic kinds the dashboard's pills used, and the
|
||||
// only place status colour is decided: a task state, a gate result, a
|
||||
// log level and a trend all draw from the same ramp, so the same
|
||||
// colour always means the same thing. Soft background over the solid
|
||||
// tone rather than white text, which would not hold contrast on the
|
||||
// lighter kinds.
|
||||
ok: 'bg-ok-soft text-ok',
|
||||
warn: 'bg-warn-soft text-warn',
|
||||
danger: 'bg-danger-soft text-danger',
|
||||
info: 'bg-info-soft text-info',
|
||||
idle: 'bg-idle-soft text-idle',
|
||||
ok: "bg-ok-soft text-ok",
|
||||
warn: "bg-warn-soft text-warn",
|
||||
danger: "bg-danger-soft text-danger",
|
||||
info: "bg-info-soft text-info",
|
||||
idle: "bg-idle-soft text-idle",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
variant: "default",
|
||||
},
|
||||
},
|
||||
)
|
||||
export type BadgeVariants = VariantProps<typeof badgeVariants>
|
||||
);
|
||||
export type BadgeVariants = VariantProps<typeof badgeVariants>;
|
||||
@@ -1,20 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import type { PrimitiveProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import type { ButtonVariants } from '.'
|
||||
import { Primitive } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { buttonVariants } from '.'
|
||||
import type { PrimitiveProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { ButtonVariants } from ".";
|
||||
import { Primitive } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from ".";
|
||||
|
||||
interface Props extends PrimitiveProps {
|
||||
variant?: ButtonVariants['variant']
|
||||
size?: ButtonVariants['size']
|
||||
class?: HTMLAttributes['class']
|
||||
variant?: ButtonVariants["variant"];
|
||||
size?: ButtonVariants["size"];
|
||||
class?: HTMLAttributes["class"];
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
as: 'button',
|
||||
})
|
||||
as: "button",
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,39 +1,47 @@
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import { cva } from 'class-variance-authority'
|
||||
import type { VariantProps } from "class-variance-authority";
|
||||
import { cva } from "class-variance-authority";
|
||||
|
||||
export { default as Button } from './Button.vue'
|
||||
export { default as Button } from "./Button.vue";
|
||||
|
||||
export const buttonVariants = cva(
|
||||
'focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 active:not-aria-[haspopup]:translate-y-px [&_svg:not([class*=size-])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 active:not-aria-[haspopup]:translate-y-px [&_svg:not([class*=size-])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
|
||||
outline: 'border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground',
|
||||
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
|
||||
ghost: 'hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground',
|
||||
destructive: 'bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30',
|
||||
link: 'text-primary underline-offset-4 hover:underline',
|
||||
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
||||
outline:
|
||||
"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
||||
ghost:
|
||||
"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
|
||||
destructive:
|
||||
"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
// An action that exists because something needs a human has to look
|
||||
// unlike one that is always present. `destructive` would overstate it:
|
||||
// nothing is broken, it is waiting.
|
||||
attention: 'border-warn bg-warn-soft font-medium text-warn hover:bg-warn-soft/80',
|
||||
attention:
|
||||
"border-warn bg-warn-soft font-medium text-warn hover:bg-warn-soft/80",
|
||||
},
|
||||
size: {
|
||||
'default': 'h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
||||
'xs': 'h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*=size-])]:size-3',
|
||||
'sm': 'h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*=size-])]:size-3.5',
|
||||
'lg': 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
||||
'icon': 'size-8',
|
||||
'icon-xs': 'size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*=size-])]:size-3',
|
||||
'icon-sm': 'size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg',
|
||||
'icon-lg': 'size-9',
|
||||
default:
|
||||
"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
||||
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*=size-])]:size-3",
|
||||
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*=size-])]:size-3.5",
|
||||
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
||||
icon: "size-8",
|
||||
"icon-xs":
|
||||
"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*=size-])]:size-3",
|
||||
"icon-sm":
|
||||
"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
||||
"icon-lg": "size-9",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
},
|
||||
)
|
||||
export type ButtonVariants = VariantProps<typeof buttonVariants>
|
||||
);
|
||||
export type ButtonVariants = VariantProps<typeof buttonVariants>;
|
||||
@@ -1,20 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
size?: 'default' | 'sm'
|
||||
}>(), {
|
||||
size: 'default',
|
||||
})
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
class?: HTMLAttributes["class"];
|
||||
size?: "default" | "sm";
|
||||
}>(),
|
||||
{
|
||||
size: "default",
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="card"
|
||||
:data-size="size"
|
||||
:class="cn('ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="card-action"
|
||||
:class="cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'col-start-2 row-span-2 row-start-1 self-start justify-self-end',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="card-footer"
|
||||
:class="cn('bg-muted/50 rounded-b-xl border-t p-4 group-data-[size=sm]/card:p-3 flex items-center', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'bg-muted/50 rounded-b-xl border-t p-4 group-data-[size=sm]/card:p-3 flex items-center',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="card-header"
|
||||
:class="cn('gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
class?: HTMLAttributes["class"];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="card-title"
|
||||
:class="cn('text-base leading-snug font-medium group-data-[size=sm]/card:text-sm cn-font-heading', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'text-base leading-snug font-medium group-data-[size=sm]/card:text-sm cn-font-heading',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export { default as Card } from './Card.vue'
|
||||
export { default as CardAction } from './CardAction.vue'
|
||||
export { default as CardContent } from './CardContent.vue'
|
||||
export { default as CardDescription } from './CardDescription.vue'
|
||||
export { default as CardFooter } from './CardFooter.vue'
|
||||
export { default as CardHeader } from './CardHeader.vue'
|
||||
export { default as CardTitle } from './CardTitle.vue'
|
||||
export { default as Card } from "./Card.vue";
|
||||
export { default as CardAction } from "./CardAction.vue";
|
||||
export { default as CardContent } from "./CardContent.vue";
|
||||
export { default as CardDescription } from "./CardDescription.vue";
|
||||
export { default as CardFooter } from "./CardFooter.vue";
|
||||
export { default as CardHeader } from "./CardHeader.vue";
|
||||
export { default as CardTitle } from "./CardTitle.vue";
|
||||
@@ -1,18 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import type { CheckboxRootEmits, CheckboxRootProps } from 'reka-ui'
|
||||
import type { CheckboxRootEmits, CheckboxRootProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { CheckIcon } from '@lucide/vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { CheckIcon } from "@lucide/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<CheckboxRootProps & { class?: HTMLAttributes['class'] }>()
|
||||
const emits = defineEmits<CheckboxRootEmits>()
|
||||
const props = defineProps<
|
||||
CheckboxRootProps & { class?: HTMLAttributes["class"] }
|
||||
>();
|
||||
const emits = defineEmits<CheckboxRootEmits>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -20,7 +22,12 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
v-slot="slotProps"
|
||||
data-slot="checkbox"
|
||||
v-bind="forwarded"
|
||||
:class="cn('border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[4px] border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 aria-invalid:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[4px] border transition-colors group-has-disabled/field:opacity-50 focus-visible:ring-3 aria-invalid:ring-3 peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<CheckboxIndicator
|
||||
data-slot="checkbox-indicator"
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { default as Checkbox } from './Checkbox.vue'
|
||||
export { default as Checkbox } from "./Checkbox.vue";
|
||||
@@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { CollapsibleRootEmits, CollapsibleRootProps } from 'reka-ui'
|
||||
import { CollapsibleRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
import type { CollapsibleRootEmits, CollapsibleRootProps } from "reka-ui";
|
||||
import { CollapsibleRoot, useForwardPropsEmits } from "reka-ui";
|
||||
|
||||
const props = defineProps<CollapsibleRootProps>()
|
||||
const emits = defineEmits<CollapsibleRootEmits>()
|
||||
const props = defineProps<CollapsibleRootProps>();
|
||||
const emits = defineEmits<CollapsibleRootEmits>();
|
||||
|
||||
const forwarded = useForwardPropsEmits(props, emits)
|
||||
const forwarded = useForwardPropsEmits(props, emits);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { CollapsibleContentProps } from 'reka-ui'
|
||||
import { CollapsibleContent } from 'reka-ui'
|
||||
import type { CollapsibleContentProps } from "reka-ui";
|
||||
import { CollapsibleContent } from "reka-ui";
|
||||
|
||||
const props = defineProps<CollapsibleContentProps>()
|
||||
const props = defineProps<CollapsibleContentProps>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CollapsibleContent
|
||||
data-slot="collapsible-content"
|
||||
v-bind="props"
|
||||
>
|
||||
<CollapsibleContent data-slot="collapsible-content" v-bind="props">
|
||||
<slot />
|
||||
</CollapsibleContent>
|
||||
</template>
|
||||
@@ -1,15 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { CollapsibleTriggerProps } from 'reka-ui'
|
||||
import { CollapsibleTrigger } from 'reka-ui'
|
||||
import type { CollapsibleTriggerProps } from "reka-ui";
|
||||
import { CollapsibleTrigger } from "reka-ui";
|
||||
|
||||
const props = defineProps<CollapsibleTriggerProps>()
|
||||
const props = defineProps<CollapsibleTriggerProps>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CollapsibleTrigger
|
||||
data-slot="collapsible-trigger"
|
||||
v-bind="props"
|
||||
>
|
||||
<CollapsibleTrigger data-slot="collapsible-trigger" v-bind="props">
|
||||
<slot />
|
||||
</CollapsibleTrigger>
|
||||
</template>
|
||||
@@ -1,3 +1,3 @@
|
||||
export { default as Collapsible } from './Collapsible.vue'
|
||||
export { default as CollapsibleContent } from './CollapsibleContent.vue'
|
||||
export { default as CollapsibleTrigger } from './CollapsibleTrigger.vue'
|
||||
export { default as Collapsible } from "./Collapsible.vue";
|
||||
export { default as CollapsibleContent } from "./CollapsibleContent.vue";
|
||||
export { default as CollapsibleTrigger } from "./CollapsibleTrigger.vue";
|
||||
@@ -1,19 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import type { DialogRootEmits, DialogRootProps } from 'reka-ui'
|
||||
import { DialogRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
import type { DialogRootEmits, DialogRootProps } from "reka-ui";
|
||||
import { DialogRoot, useForwardPropsEmits } from "reka-ui";
|
||||
|
||||
const props = defineProps<DialogRootProps>()
|
||||
const emits = defineEmits<DialogRootEmits>()
|
||||
const props = defineProps<DialogRootProps>();
|
||||
const emits = defineEmits<DialogRootEmits>();
|
||||
|
||||
const forwarded = useForwardPropsEmits(props, emits)
|
||||
const forwarded = useForwardPropsEmits(props, emits);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DialogRoot
|
||||
v-slot="slotProps"
|
||||
data-slot="dialog"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<DialogRoot v-slot="slotProps" data-slot="dialog" v-bind="forwarded">
|
||||
<slot v-bind="slotProps" />
|
||||
</DialogRoot>
|
||||
</template>
|
||||
@@ -1,15 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { DialogCloseProps } from 'reka-ui'
|
||||
import { DialogClose } from 'reka-ui'
|
||||
import type { DialogCloseProps } from "reka-ui";
|
||||
import { DialogClose } from "reka-ui";
|
||||
|
||||
const props = defineProps<DialogCloseProps>()
|
||||
const props = defineProps<DialogCloseProps>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DialogClose
|
||||
data-slot="dialog-close"
|
||||
v-bind="props"
|
||||
>
|
||||
<DialogClose data-slot="dialog-close" v-bind="props">
|
||||
<slot />
|
||||
</DialogClose>
|
||||
</template>
|
||||
@@ -1,31 +1,39 @@
|
||||
<script setup lang="ts">
|
||||
import type { DialogContentEmits, DialogContentProps } from 'reka-ui'
|
||||
import type { DialogContentEmits, DialogContentProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { XIcon } from '@lucide/vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { XIcon } from "@lucide/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import {
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogPortal,
|
||||
useForwardPropsEmits,
|
||||
} from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import DialogOverlay from './DialogOverlay.vue'
|
||||
} from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import DialogOverlay from "./DialogOverlay.vue";
|
||||
|
||||
defineOptions({
|
||||
inheritAttrs: false,
|
||||
})
|
||||
});
|
||||
|
||||
const props = withDefaults(defineProps<DialogContentProps & { class?: HTMLAttributes['class'], showCloseButton?: boolean }>(), {
|
||||
showCloseButton: true,
|
||||
})
|
||||
const emits = defineEmits<DialogContentEmits>()
|
||||
const props = withDefaults(
|
||||
defineProps<
|
||||
DialogContentProps & {
|
||||
class?: HTMLAttributes["class"];
|
||||
showCloseButton?: boolean;
|
||||
}
|
||||
>(),
|
||||
{
|
||||
showCloseButton: true,
|
||||
},
|
||||
);
|
||||
const emits = defineEmits<DialogContentEmits>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -34,15 +42,16 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
<DialogContent
|
||||
data-slot="dialog-content"
|
||||
v-bind="{ ...$attrs, ...forwarded }"
|
||||
:class="cn('bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
|
||||
<DialogClose
|
||||
v-if="showCloseButton"
|
||||
data-slot="dialog-close"
|
||||
as-child
|
||||
>
|
||||
<DialogClose v-if="showCloseButton" data-slot="dialog-close" as-child>
|
||||
<Button variant="ghost" class="absolute top-2 right-2" size="icon-sm">
|
||||
<XIcon />
|
||||
<span class="sr-only">Close</span>
|
||||
|
||||
@@ -1,22 +1,29 @@
|
||||
<script setup lang="ts">
|
||||
import type { DialogDescriptionProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { DialogDescription, useForwardProps } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { DialogDescriptionProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { DialogDescription, useForwardProps } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<DialogDescriptionProps & { class?: HTMLAttributes['class'] }>()
|
||||
const props = defineProps<
|
||||
DialogDescriptionProps & { class?: HTMLAttributes["class"] }
|
||||
>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
const forwardedProps = useForwardProps(delegatedProps);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DialogDescription
|
||||
data-slot="dialog-description"
|
||||
v-bind="forwardedProps"
|
||||
:class="cn('text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</DialogDescription>
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { DialogClose } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { DialogClose } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
showCloseButton?: boolean
|
||||
}>(), {
|
||||
showCloseButton: false,
|
||||
})
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
class?: HTMLAttributes["class"];
|
||||
showCloseButton?: boolean;
|
||||
}>(),
|
||||
{
|
||||
showCloseButton: false,
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="dialog-footer"
|
||||
:class="cn('bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', props.class)"
|
||||
:class="
|
||||
cn(
|
||||
'bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
<DialogClose v-if="showCloseButton" as-child>
|
||||
<Button variant="outline">
|
||||
Close
|
||||
</Button>
|
||||
<Button variant="outline"> Close </Button>
|
||||
</DialogClose>
|
||||
</div>
|
||||
</template>
|
||||
Loaded 100 of 608 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user