devnonla-ui 0.19.2 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/package.json +1 -1
- package/src/alert/Alert.tsx +7 -7
- package/src/app/App.tsx +11 -7
- package/src/breadcrumb/Breadcrumb.tsx +80 -0
- package/src/button/Button.tsx +48 -33
- package/src/button/ButtonCopy.tsx +2 -2
- package/src/calendar/Calendar.tsx +12 -12
- package/src/card/Card.tsx +15 -10
- package/src/chat/AgentPanel.tsx +1 -1
- package/src/chat/index.ts +1 -5
- package/src/chat/message-ui/ChatError.tsx +1 -1
- package/src/chat/message-ui/ChatInput.tsx +4 -4
- package/src/chat/message-ui/ChatThinking.tsx +1 -1
- package/src/chat/message-ui/ChatUserMessage.tsx +3 -3
- package/src/chat/message-ui/ChatWelcome.tsx +2 -2
- package/src/chat/tool-ui/BackgroundTasksBar.tsx +6 -6
- package/src/chat/tool-ui/ChatToolCall.tsx +4 -4
- package/src/chat/tool-ui/ToolUiBadge.tsx +1 -1
- package/src/chat/tool-ui/ToolUiTrailing.tsx +1 -1
- package/src/chat/tool-ui/registry.ts +5 -19
- package/src/checkbox/Checkbox.tsx +12 -10
- package/src/colorpicker/ColorPicker.tsx +2 -2
- package/src/command-palette/CommandPalette.tsx +223 -0
- package/src/drawer/Drawer.tsx +1 -1
- package/src/dropdown/Dropdown.tsx +4 -3
- package/src/dropdown/menuClasses.ts +2 -2
- package/src/empty/Empty.tsx +23 -9
- package/src/form/FormItem.tsx +1 -1
- package/src/form/variants/FieldRadio.tsx +2 -2
- package/src/form/variants/FieldRepeaterItem.tsx +1 -1
- package/src/icon/Icon.tsx +14 -4
- package/src/icon/glyphs.ts +47 -38
- package/src/index.ts +8 -2
- package/src/input/EditableInput.tsx +3 -3
- package/src/input/Input.tsx +30 -13
- package/src/kbd/Kbd.tsx +32 -0
- package/src/lib/cn.ts +7 -0
- package/src/lib/markdownScale.ts +7 -5
- package/src/lib/sizes.ts +1 -1
- package/src/lib/surface.ts +2 -2
- package/src/markdown-editor/MarkdownDiff.tsx +4 -4
- package/src/markdown-editor/MarkdownPreview.tsx +1 -1
- package/src/markdown-editor/MarkdownSource.tsx +2 -2
- package/src/markdown-editor/MarkdownTable.tsx +2 -2
- package/src/markdown-editor/MermaidBlock.tsx +5 -5
- package/src/markdown-editor/ReactCodeFrame.tsx +1 -1
- package/src/menu/Menu.tsx +2 -2
- package/src/message/message.tsx +8 -8
- package/src/modal/Modal.tsx +2 -2
- package/src/page-header/PageHeader.tsx +33 -0
- package/src/pagination/Pagination.tsx +3 -3
- package/src/popconfirm/Popconfirm.tsx +3 -3
- package/src/scroll/OverlayScroll.tsx +1 -1
- package/src/segmented/Segmented.tsx +16 -7
- package/src/select/Select.tsx +76 -47
- package/src/sidebar/Sidebar.tsx +15 -4
- package/src/sortable-tree/SortableTree.tsx +1 -1
- package/src/splitter/Splitter.tsx +1 -1
- package/src/styles.css +258 -45
- package/src/switch/Switch.tsx +21 -20
- package/src/table/Table.tsx +32 -18
- package/src/tabs/Tabs.tsx +16 -13
- package/src/tag/Tag.tsx +16 -7
- package/src/theme-switcher/ThemeSwitcher.tsx +1 -1
- package/src/timepicker/TimePicker.tsx +2 -2
- package/src/tooltip/Tooltip.tsx +25 -3
- package/src/blob-shape/BlobShape.tsx +0 -337
- package/src/chat/tool-ui/GetCurrentTimeToolUI.tsx +0 -51
- package/src/chat/tool-ui/ReadSkillToolUI.tsx +0 -82
- package/src/chat/tool-ui/RunJsToolUI.tsx +0 -108
- package/src/chat/tool-ui/WebFetchToolUI.tsx +0 -64
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Icon } from "../../icon/Icon";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
import { Shimmer } from "../../shimmer/Shimmer";
|
|
4
|
-
import { chatRowClass, chatToolLineClass } from "../chatRhythm";
|
|
5
|
-
import { parseJsonObject } from "../common/utils";
|
|
6
|
-
import { ToolUiBadge } from "./ToolUiBadge";
|
|
7
|
-
import { ToolUiTrailing } from "./ToolUiTrailing";
|
|
8
|
-
import { isToolRunning, type ToolUIProps } from "./types";
|
|
9
|
-
|
|
10
|
-
type ReadSkillInput = { name?: string; reference?: string };
|
|
11
|
-
type SkillRef = { name?: string; title?: string };
|
|
12
|
-
type ReadSkillOutput = {
|
|
13
|
-
ok?: boolean;
|
|
14
|
-
error?: string;
|
|
15
|
-
skill?: string;
|
|
16
|
-
reference?: string;
|
|
17
|
-
title?: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
content?: string;
|
|
20
|
-
references?: SkillRef[];
|
|
21
|
-
available_references?: SkillRef[];
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
function refNames(list?: SkillRef[]): string[] {
|
|
25
|
-
if (!Array.isArray(list)) return [];
|
|
26
|
-
return list.map((r) => (typeof r.name === "string" ? r.name.trim() : "")).filter(Boolean);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function ReadSkillToolUI({ msg, assistantLabel = "Assistant", assistantColor, showAvatar = false, generating = false }: ToolUIProps) {
|
|
30
|
-
const hasError = Boolean(msg.toolError);
|
|
31
|
-
const input = parseJsonObject<ReadSkillInput>(msg.toolInput) ?? {};
|
|
32
|
-
const output = parseJsonObject<ReadSkillOutput>(msg.toolOutput);
|
|
33
|
-
const failed = hasError || output?.ok === false;
|
|
34
|
-
const running = isToolRunning(msg, generating);
|
|
35
|
-
|
|
36
|
-
const skillName = (output?.skill || input.name || "").trim();
|
|
37
|
-
const reference = (output?.reference || input.reference || "").trim();
|
|
38
|
-
const available = refNames(output?.references ?? output?.available_references);
|
|
39
|
-
const content = output?.content?.trim() || "";
|
|
40
|
-
const body = failed ? (output?.error ?? (typeof msg.toolError === "string" ? msg.toolError : null) ?? "Failed to read skill") : content;
|
|
41
|
-
|
|
42
|
-
const verb = (() => {
|
|
43
|
-
if (failed) return "Failed to read skill";
|
|
44
|
-
if (running) return reference ? "Reading ref" : "Reading skill";
|
|
45
|
-
return reference ? "Read skill ref" : "Read skill";
|
|
46
|
-
})();
|
|
47
|
-
|
|
48
|
-
const targetLabel = (() => {
|
|
49
|
-
if (!skillName && !reference) return null;
|
|
50
|
-
if (reference) return skillName ? `${skillName} / ${reference}` : reference;
|
|
51
|
-
return skillName || null;
|
|
52
|
-
})();
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<div className={`${chatRowClass} animate-fadeIn`}>
|
|
56
|
-
<ToolUiBadge show={showAvatar} label={assistantLabel} color={assistantColor} />
|
|
57
|
-
<details className="group/readskill px-4" style={{ overflowAnchor: "none" }}>
|
|
58
|
-
<summary className={cn(chatToolLineClass, "cursor-pointer list-none select-none [&::-webkit-details-marker]:hidden")}>
|
|
59
|
-
<Icon name={reference ? "document" : "book"} size={13} className="shrink-0 text-muted-foreground" />
|
|
60
|
-
<Shimmer active={running} className="min-w-0 truncate font-normal text-muted-foreground">
|
|
61
|
-
{verb}
|
|
62
|
-
{targetLabel ? <span className="text-tertiary-foreground"> {targetLabel}</span> : null}
|
|
63
|
-
</Shimmer>
|
|
64
|
-
<ToolUiTrailing failed={failed} chevron chevronClassName="group-hover/readskill:opacity-100 group-open/readskill:opacity-100 group-open/readskill:rotate-90" />
|
|
65
|
-
</summary>
|
|
66
|
-
{body ? (
|
|
67
|
-
<pre className={cn("m-0 mt-1.5 mb-1 max-h-40 overflow-y-auto rounded-lg border px-3 py-2 font-mono text-sm font-normal leading-[1.65] break-all whitespace-pre-wrap", failed ? "border-destructive/35 bg-destructive/6 text-destructive" : "border-border bg-card text-muted-foreground")}>{body}</pre>
|
|
68
|
-
) : null}
|
|
69
|
-
{!running && !reference && available.length > 0 ? (
|
|
70
|
-
<div className="mt-0.5 mb-1 flex flex-wrap items-center gap-1">
|
|
71
|
-
<span className="text-sm font-medium tracking-wide text-quaternary-foreground uppercase">Refs</span>
|
|
72
|
-
{available.map((name) => (
|
|
73
|
-
<span key={name} className="inline-flex max-w-full items-center rounded-md border border-border-secondary bg-muted/40 px-1.5 py-0.5 font-mono text-sm leading-[1.4] text-tertiary-foreground">
|
|
74
|
-
{skillName ? `${skillName} / ${name}` : name}
|
|
75
|
-
</span>
|
|
76
|
-
))}
|
|
77
|
-
</div>
|
|
78
|
-
) : null}
|
|
79
|
-
</details>
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { CodeBlock } from "../../codeblock/CodeBlock";
|
|
2
|
-
import { Icon } from "../../icon/Icon";
|
|
3
|
-
import { cn } from "../../lib/cn";
|
|
4
|
-
import { Shimmer } from "../../shimmer/Shimmer";
|
|
5
|
-
import { chatRowClass, chatToolLineClass } from "../chatRhythm";
|
|
6
|
-
import { parseBgTaskRef } from "../common/bgTasks";
|
|
7
|
-
import { parseJsonObject, prettyJson } from "../common/utils";
|
|
8
|
-
import { ChatSpinner } from "../message-ui/ChatSpinner";
|
|
9
|
-
import { BackgroundTaskToolUI } from "./BackgroundTaskToolUI";
|
|
10
|
-
import { ToolUiBadge } from "./ToolUiBadge";
|
|
11
|
-
import { ToolUiTrailing } from "./ToolUiTrailing";
|
|
12
|
-
import { isToolRunning, type ToolUIProps } from "./types";
|
|
13
|
-
|
|
14
|
-
type JsInput = { code?: string };
|
|
15
|
-
type JsOutput = {
|
|
16
|
-
ok?: boolean;
|
|
17
|
-
result?: unknown;
|
|
18
|
-
error?: string;
|
|
19
|
-
console?: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
function extractCode(input: unknown): string {
|
|
23
|
-
const parsed = parseJsonObject<JsInput>(input);
|
|
24
|
-
if (parsed?.code && typeof parsed.code === "string") return parsed.code;
|
|
25
|
-
if (typeof input === "string") return input;
|
|
26
|
-
return "";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function resultText(value: unknown): string {
|
|
30
|
-
if (typeof value === "string") return value;
|
|
31
|
-
if (value === undefined) return "undefined";
|
|
32
|
-
if (typeof value === "number" || typeof value === "boolean" || value === null) return String(value);
|
|
33
|
-
return prettyJson(value);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function SandboxOutput({
|
|
37
|
-
running,
|
|
38
|
-
failed,
|
|
39
|
-
consoleOut,
|
|
40
|
-
result,
|
|
41
|
-
}: {
|
|
42
|
-
running: boolean;
|
|
43
|
-
failed: boolean;
|
|
44
|
-
consoleOut: string | null;
|
|
45
|
-
result: unknown;
|
|
46
|
-
}) {
|
|
47
|
-
if (running) {
|
|
48
|
-
return (
|
|
49
|
-
<div className="flex items-center gap-2 border-t border-border px-3 py-2 text-sm text-muted-foreground">
|
|
50
|
-
<ChatSpinner />
|
|
51
|
-
<Shimmer>Running…</Shimmer>
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div className={cn("max-h-40 overflow-y-auto border-t px-3 py-2 font-mono text-sm leading-[1.65]", failed ? "border-destructive/35 bg-destructive/6" : "border-border")}>
|
|
58
|
-
{consoleOut ? <pre className="m-0 whitespace-pre-wrap break-all text-tertiary-foreground">{consoleOut}</pre> : null}
|
|
59
|
-
{failed ? (
|
|
60
|
-
<pre className={cn("m-0 whitespace-pre-wrap break-all text-destructive", consoleOut && "mt-1")}>{resultText(result)}</pre>
|
|
61
|
-
) : (
|
|
62
|
-
<div className={cn("flex gap-1.5 whitespace-pre-wrap break-all text-foreground", consoleOut && "mt-1")}>
|
|
63
|
-
<span className="shrink-0 select-none text-quaternary-foreground">{"=>"}</span>
|
|
64
|
-
<span>{resultText(result)}</span>
|
|
65
|
-
</div>
|
|
66
|
-
)}
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function RunJsToolUI({ msg, assistantLabel = "Assistant", assistantColor, showAvatar = false, generating = false }: ToolUIProps) {
|
|
72
|
-
if (parseBgTaskRef(msg.toolOutput)) {
|
|
73
|
-
return <BackgroundTaskToolUI msg={msg} assistantLabel={assistantLabel} assistantColor={assistantColor} showAvatar={showAvatar} />;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const hasError = Boolean(msg.toolError);
|
|
77
|
-
const code = extractCode(msg.toolInput);
|
|
78
|
-
const output = parseJsonObject<JsOutput>(msg.toolOutput);
|
|
79
|
-
const running = isToolRunning(msg, generating);
|
|
80
|
-
const failed = hasError || output?.ok === false;
|
|
81
|
-
const consoleOut = output?.console?.trim() || null;
|
|
82
|
-
const resultBody = failed ? (output?.error ?? (typeof msg.toolError === "string" ? msg.toolError : null) ?? "Execution failed") : output && "result" in output ? output.result : undefined;
|
|
83
|
-
const showOutput = running || failed || consoleOut != null || (output != null && "result" in output);
|
|
84
|
-
const verb = failed ? "JS failed" : running ? "Running JS" : "Ran JS";
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<div className={`${chatRowClass} animate-fadeIn`}>
|
|
88
|
-
<ToolUiBadge show={showAvatar} label={assistantLabel} color={assistantColor} />
|
|
89
|
-
<details className="group/runjs px-4" style={{ overflowAnchor: "none" }}>
|
|
90
|
-
<summary className={cn(chatToolLineClass, "cursor-pointer list-none select-none [&::-webkit-details-marker]:hidden")}>
|
|
91
|
-
<Icon name="code" size={13} className="shrink-0 text-muted-foreground" />
|
|
92
|
-
<Shimmer active={running} className="min-w-0 truncate font-normal text-muted-foreground">{verb}</Shimmer>
|
|
93
|
-
<ToolUiTrailing running={running} failed={failed} chevron chevronClassName="group-hover/runjs:opacity-100 group-open/runjs:opacity-100 group-open/runjs:rotate-90" />
|
|
94
|
-
</summary>
|
|
95
|
-
|
|
96
|
-
{code ? (
|
|
97
|
-
<CodeBlock code={code} language="javascript" title="JS" className={cn("mt-1.5 mb-1", failed && "border-destructive/35")}>
|
|
98
|
-
{showOutput ? <SandboxOutput running={running} failed={failed} consoleOut={consoleOut} result={resultBody} /> : null}
|
|
99
|
-
</CodeBlock>
|
|
100
|
-
) : showOutput ? (
|
|
101
|
-
<div className={cn("mt-1.5 mb-1 overflow-hidden rounded-lg border", failed ? "border-destructive/35" : "border-border")}>
|
|
102
|
-
<SandboxOutput running={running} failed={failed} consoleOut={consoleOut} result={resultBody} />
|
|
103
|
-
</div>
|
|
104
|
-
) : null}
|
|
105
|
-
</details>
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Icon } from "../../icon/Icon";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
import { Shimmer } from "../../shimmer/Shimmer";
|
|
4
|
-
import { chatRowClass, chatToolLineClass } from "../chatRhythm";
|
|
5
|
-
import { parseJsonObject } from "../common/utils";
|
|
6
|
-
import { ToolUiBadge } from "./ToolUiBadge";
|
|
7
|
-
import { ToolUiTrailing } from "./ToolUiTrailing";
|
|
8
|
-
import { isToolRunning, type ToolUIProps } from "./types";
|
|
9
|
-
|
|
10
|
-
type FetchInput = {
|
|
11
|
-
url?: string;
|
|
12
|
-
actions?: { action?: string; url?: string }[];
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type FetchOutput = {
|
|
16
|
-
ok?: boolean;
|
|
17
|
-
url?: string;
|
|
18
|
-
text?: string;
|
|
19
|
-
error?: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
function inputUrl(input: unknown): string {
|
|
23
|
-
const rec = parseJsonObject<FetchInput>(input);
|
|
24
|
-
if (rec?.url) return rec.url;
|
|
25
|
-
const nav = rec?.actions?.find((a) => a.action === "navigate" && a.url);
|
|
26
|
-
return nav?.url || "";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function WebFetchToolUI({ msg, assistantLabel = "Assistant", assistantColor, showAvatar = false, generating = false }: ToolUIProps) {
|
|
30
|
-
const hasError = Boolean(msg.toolError);
|
|
31
|
-
const output = parseJsonObject<FetchOutput>(msg.toolOutput);
|
|
32
|
-
const failed = hasError || output?.ok === false;
|
|
33
|
-
const running = isToolRunning(msg, generating);
|
|
34
|
-
const url = output?.url || inputUrl(msg.toolInput) || "—";
|
|
35
|
-
const body = failed ? (output?.error ?? (typeof msg.toolError === "string" ? msg.toolError : null) ?? "Tool execution failed") : output?.text?.trim() || "";
|
|
36
|
-
const expandable = Boolean(body);
|
|
37
|
-
const verb = running ? "Fetching page" : failed ? "Fetch page" : "Fetched page";
|
|
38
|
-
|
|
39
|
-
const header = (
|
|
40
|
-
<>
|
|
41
|
-
<Icon name="globe" size={13} className="shrink-0 text-muted-foreground" />
|
|
42
|
-
<Shimmer active={running} className="min-w-0 truncate font-normal text-muted-foreground">
|
|
43
|
-
{verb} <span className="text-tertiary-foreground">{url}</span>
|
|
44
|
-
</Shimmer>
|
|
45
|
-
<ToolUiTrailing failed={failed} chevron={expandable} chevronClassName="group-hover/webfetch:opacity-100 group-open/webfetch:opacity-100 group-open/webfetch:rotate-90" />
|
|
46
|
-
</>
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<div className={`${chatRowClass} animate-fadeIn`}>
|
|
51
|
-
<ToolUiBadge show={showAvatar} label={assistantLabel} color={assistantColor} />
|
|
52
|
-
{expandable ? (
|
|
53
|
-
<details className="group/webfetch px-4" style={{ overflowAnchor: "none" }}>
|
|
54
|
-
<summary className={cn(chatToolLineClass, "cursor-pointer list-none select-none [&::-webkit-details-marker]:hidden")}>{header}</summary>
|
|
55
|
-
<pre className={cn("m-0 mt-1.5 mb-1 max-h-40 overflow-y-auto rounded-lg border px-3 py-2 font-mono text-sm font-normal leading-[1.65] break-all whitespace-pre-wrap", failed ? "border-destructive/35 bg-destructive/6 text-destructive" : "border-border bg-card text-muted-foreground")}>{body}</pre>
|
|
56
|
-
</details>
|
|
57
|
-
) : (
|
|
58
|
-
<div className="px-4">
|
|
59
|
-
<div className={chatToolLineClass}>{header}</div>
|
|
60
|
-
</div>
|
|
61
|
-
)}
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
}
|