devnonla-ui 0.7.1 → 0.9.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 +31 -4
- package/package.json +3 -3
- package/src/app/App.tsx +5 -1
- package/src/app/context.ts +5 -3
- package/src/button/Button.tsx +2 -2
- package/src/button/ButtonCopy.tsx +2 -2
- package/src/card/Card.tsx +81 -0
- package/src/chat/AgentChatbox.tsx +1 -1
- package/src/chat/AgentPanel.tsx +1 -1
- package/src/chat/message-ui/ChatError.tsx +2 -2
- package/src/chat/message-ui/ChatInput.tsx +6 -6
- package/src/chat/message-ui/ChatMarkdown.tsx +8 -7
- package/src/chat/message-ui/ChatMarkdownTable.tsx +1 -1
- package/src/chat/message-ui/ChatThinking.tsx +3 -3
- package/src/chat/message-ui/ChatUserMessage.tsx +3 -3
- package/src/chat/message-ui/MermaidBlock.tsx +76 -70
- package/src/chat/tool-ui/BackgroundTasksBar.tsx +3 -3
- package/src/chat/tool-ui/CallAgentToolUI.tsx +3 -3
- package/src/chat/tool-ui/ChatToolCall.tsx +4 -4
- package/src/chat/tool-ui/GetCurrentTimeToolUI.tsx +2 -2
- package/src/chat/tool-ui/ReadSkillToolUI.tsx +2 -2
- package/src/chat/tool-ui/RunJsToolUI.tsx +2 -2
- package/src/chat/tool-ui/ToolUiTrailing.tsx +3 -3
- package/src/chat/tool-ui/WebFetchToolUI.tsx +2 -2
- package/src/checkbox/Checkbox.tsx +17 -4
- package/src/codeblock/CodeBlock.tsx +4 -10
- package/src/datepicker/DatePicker.tsx +3 -3
- package/src/desktop/DesktopHeader.tsx +1 -1
- package/src/desktop/DesktopIcon.tsx +2 -2
- package/src/desktop/DesktopWindow.tsx +51 -29
- package/src/empty/Empty.tsx +8 -5
- package/src/form/FormItem.tsx +1 -1
- package/src/form-layout/FormLayout.tsx +1 -1
- package/src/icon/SolarIcon.tsx +39 -0
- package/src/icon/solar.ts +172 -0
- package/src/index.ts +24 -12
- package/src/input/EditableInput.tsx +3 -3
- package/src/input/Input.tsx +3 -3
- package/src/lib/sizes.ts +9 -6
- package/src/lib/surface.ts +1 -1
- package/src/markdown-editor/MarkdownDiff.tsx +211 -0
- package/src/markdown-editor/MarkdownEditor.tsx +294 -0
- package/src/markdown-editor/MarkdownPreview.tsx +326 -0
- package/src/markdown-editor/MarkdownSource.tsx +72 -0
- package/src/markdown-editor/blocks.ts +329 -0
- package/src/markdown-editor/diff.ts +296 -0
- package/src/menu/Menu.tsx +3 -3
- package/src/pagination/Pagination.tsx +8 -7
- package/src/scroll/OverlayScroll.tsx +2 -2
- package/src/segmented/Segmented.tsx +2 -2
- package/src/select/Select.tsx +192 -63
- package/src/sidebar/Sidebar.tsx +9 -8
- package/src/spin/Spin.tsx +17 -11
- package/src/styles.css +273 -107
- package/src/switch/Switch.tsx +17 -3
- package/src/table/Table.tsx +63 -28
- package/src/theme-toggle/ThemeToggle.tsx +33 -0
- package/src/theme.ts +72 -0
- package/src/timepicker/TimePicker.tsx +1 -1
- package/src/icon/FluentIcon.tsx +0 -28
- package/src/icon/fluent.ts +0 -75
|
@@ -1,79 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useCallback, useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
|
|
2
|
+
import { Button } from "../../button/Button";
|
|
3
3
|
import { CodeBlock } from "../../codeblock/CodeBlock";
|
|
4
|
+
import { SolarIcon } from "../../icon/SolarIcon";
|
|
4
5
|
import { cn } from "../../lib/cn";
|
|
6
|
+
import { getColorMode, subscribeColorMode } from "../../theme";
|
|
5
7
|
import { sanitizeMermaid } from "./sanitizeMermaid";
|
|
6
8
|
|
|
9
|
+
/** Official Mermaid palettes: `default` is light, `dark` is dark. */
|
|
10
|
+
function useMermaidTheme(): "default" | "dark" {
|
|
11
|
+
const mode = useSyncExternalStore(subscribeColorMode, getColorMode, () => "dark" as const);
|
|
12
|
+
return mode === "light" ? "default" : "dark";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Mermaid keeps one global theme. Render one diagram at a time so a cancelled pass cannot overwrite it. */
|
|
16
|
+
let mermaidQueue: Promise<unknown> = Promise.resolve();
|
|
17
|
+
|
|
18
|
+
function enqueueMermaid<T>(task: () => Promise<T>): Promise<T> {
|
|
19
|
+
const run = mermaidQueue.then(task, task);
|
|
20
|
+
mermaidQueue = run.then(
|
|
21
|
+
() => undefined,
|
|
22
|
+
() => undefined,
|
|
23
|
+
);
|
|
24
|
+
return run;
|
|
25
|
+
}
|
|
26
|
+
|
|
7
27
|
export type MermaidBlockProps = {
|
|
8
28
|
children: string;
|
|
9
29
|
className?: string;
|
|
10
30
|
};
|
|
11
31
|
|
|
12
|
-
type MermaidTheme = "light" | "dark";
|
|
13
|
-
|
|
14
|
-
const btnClass = "flex items-center gap-1 px-2 py-1 rounded-lg border border-border text-muted-foreground text-xs cursor-pointer transition-colors hover:text-primary hover:border-primary/30 bg-transparent";
|
|
15
|
-
|
|
16
32
|
export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
17
33
|
const id = useId().replace(/:/g, "_");
|
|
34
|
+
const theme = useMermaidTheme();
|
|
18
35
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
19
36
|
const dialogRef = useRef<HTMLDialogElement>(null);
|
|
20
37
|
const fullscreenRef = useRef<HTMLDivElement>(null);
|
|
21
38
|
const [error, setError] = useState<string | null>(null);
|
|
22
39
|
const [svgContent, setSvgContent] = useState("");
|
|
23
|
-
const [theme, setTheme] = useState<MermaidTheme>("light");
|
|
24
40
|
const [zoom, setZoom] = useState(1);
|
|
25
41
|
const [pan, setPan] = useState({ x: 0, y: 0 });
|
|
26
42
|
const dragRef = useRef({ active: false, startX: 0, startY: 0, panX: 0, panY: 0 });
|
|
27
43
|
const [isDragging, setIsDragging] = useState(false);
|
|
28
44
|
|
|
29
|
-
const isDark = theme === "dark";
|
|
30
|
-
const surfaceClass = isDark ? "bg-[#1e1e1e]" : "bg-card";
|
|
31
|
-
|
|
32
45
|
useEffect(() => {
|
|
33
46
|
let cancelled = false;
|
|
34
47
|
|
|
35
48
|
const render = async () => {
|
|
36
49
|
const { default: mermaid } = await import("mermaid");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
if (cancelled) return;
|
|
51
|
+
|
|
52
|
+
await enqueueMermaid(async () => {
|
|
53
|
+
if (cancelled) return;
|
|
54
|
+
mermaid.initialize({
|
|
55
|
+
startOnLoad: false,
|
|
56
|
+
theme,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const raw = children.trim();
|
|
60
|
+
const renderId = `mermaid-${id}-${theme}`;
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
document.getElementById(`d${renderId}`)?.remove();
|
|
64
|
+
const { svg } = await mermaid.render(renderId, raw);
|
|
65
|
+
if (!cancelled) {
|
|
66
|
+
setSvgContent(svg);
|
|
67
|
+
setError(null);
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
} catch {
|
|
71
|
+
document.getElementById(`d${renderId}`)?.remove();
|
|
51
72
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
setError(
|
|
73
|
+
|
|
74
|
+
if (cancelled) return;
|
|
75
|
+
const sanitized = sanitizeMermaid(raw);
|
|
76
|
+
try {
|
|
77
|
+
const sanitizedId = `${renderId}-s`;
|
|
78
|
+
document.getElementById(sanitizedId)?.remove();
|
|
79
|
+
document.getElementById(`d${sanitizedId}`)?.remove();
|
|
80
|
+
const { svg } = await mermaid.render(sanitizedId, sanitized);
|
|
81
|
+
if (!cancelled) {
|
|
82
|
+
setSvgContent(svg);
|
|
83
|
+
setError(null);
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
if (!cancelled) setError(String(err));
|
|
66
87
|
}
|
|
67
|
-
}
|
|
68
|
-
if (!cancelled) setError(String(err));
|
|
69
|
-
}
|
|
88
|
+
});
|
|
70
89
|
};
|
|
71
90
|
|
|
72
91
|
void render();
|
|
73
92
|
return () => {
|
|
74
93
|
cancelled = true;
|
|
75
94
|
};
|
|
76
|
-
}, [children, id, theme
|
|
95
|
+
}, [children, id, theme]);
|
|
77
96
|
|
|
78
97
|
useEffect(() => {
|
|
79
98
|
if (containerRef.current && svgContent) containerRef.current.innerHTML = svgContent;
|
|
@@ -90,8 +109,6 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
|
90
109
|
setPan({ x: 0, y: 0 });
|
|
91
110
|
}, []);
|
|
92
111
|
|
|
93
|
-
const toggleTheme = () => setTheme((prev) => (prev === "light" ? "dark" : "light"));
|
|
94
|
-
|
|
95
112
|
const downloadSvg = () => {
|
|
96
113
|
if (!svgContent) return;
|
|
97
114
|
const blob = new Blob([svgContent], { type: "image/svg+xml;charset=utf-8" });
|
|
@@ -113,7 +130,6 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
|
113
130
|
|
|
114
131
|
const closeFullscreen = () => {
|
|
115
132
|
dialogRef.current?.close();
|
|
116
|
-
resetView();
|
|
117
133
|
};
|
|
118
134
|
|
|
119
135
|
const handleWheel = useCallback((e: React.WheelEvent) => {
|
|
@@ -173,47 +189,37 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
|
173
189
|
|
|
174
190
|
return (
|
|
175
191
|
<>
|
|
176
|
-
<div className={cn("my-3 last:mb-0 group relative rounded-xl border border-border overflow-hidden",
|
|
192
|
+
<div className={cn("my-3 last:mb-0 group relative rounded-xl border border-border overflow-hidden bg-card", className)}>
|
|
177
193
|
<div className="absolute top-2 right-2 z-10 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
178
|
-
<
|
|
179
|
-
{isDark ? <Sun size={14} aria-hidden /> : <Moon size={14} aria-hidden />}
|
|
180
|
-
</button>
|
|
181
|
-
<button type="button" onClick={downloadSvg} className={cn(btnClass, surfaceClass)} title="Download SVG" disabled={!svgContent}>
|
|
182
|
-
<Download size={14} aria-hidden />
|
|
183
|
-
</button>
|
|
184
|
-
<button type="button" onClick={openFullscreen} className={cn(btnClass, surfaceClass)} title="Fullscreen">
|
|
185
|
-
<Maximize2 size={14} aria-hidden />
|
|
186
|
-
</button>
|
|
194
|
+
<Button size="small" icon={<SolarIcon name="maximize-linear" size={12} />} title="Fullscreen" aria-label="Fullscreen" onClick={openFullscreen} />
|
|
187
195
|
</div>
|
|
188
196
|
<div ref={containerRef} className="flex justify-center p-6 overflow-x-auto [&_svg]:max-w-full" />
|
|
189
197
|
</div>
|
|
190
198
|
|
|
191
199
|
<dialog
|
|
192
200
|
ref={dialogRef}
|
|
193
|
-
className=
|
|
201
|
+
className="m-0 p-0 w-screen h-screen max-w-none max-h-none backdrop:bg-black/40 open:flex open:flex-col bg-card"
|
|
202
|
+
onClose={resetView}
|
|
194
203
|
onKeyDown={(e) => {
|
|
195
|
-
if (e.key
|
|
204
|
+
if (e.key !== "Escape") return;
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
e.stopPropagation();
|
|
207
|
+
closeFullscreen();
|
|
196
208
|
}}
|
|
197
209
|
>
|
|
198
210
|
<div className="fixed top-5 right-5 z-50 flex items-center gap-1.5">
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<Download size={16} aria-hidden />
|
|
204
|
-
</button>
|
|
205
|
-
<button type="button" onClick={closeFullscreen} className={cn(btnClass, surfaceClass, "px-3 py-2 text-sm shadow-md")} title="Exit fullscreen">
|
|
206
|
-
<Minimize2 size={16} aria-hidden />
|
|
207
|
-
<span>Exit</span>
|
|
208
|
-
</button>
|
|
211
|
+
<Button size="small" icon={<SolarIcon name="download-linear" size={12} />} title="Download SVG" aria-label="Download SVG" onClick={downloadSvg} disabled={!svgContent} />
|
|
212
|
+
<Button size="small" icon={<SolarIcon name="minimize-linear" size={12} />} title="Exit fullscreen" onClick={closeFullscreen}>
|
|
213
|
+
Exit
|
|
214
|
+
</Button>
|
|
209
215
|
</div>
|
|
210
216
|
|
|
211
|
-
<div className=
|
|
217
|
+
<div className="fixed bottom-5 left-1/2 -translate-x-1/2 z-50 flex items-center gap-2 px-3 py-1.5 rounded-full border border-border text-xs text-muted-foreground shadow-md select-none bg-card">
|
|
212
218
|
<span>{Math.round(zoom * 100)}%</span>
|
|
213
219
|
{!isDefaultView ? (
|
|
214
|
-
<
|
|
220
|
+
<Button type="text" size="small" onClick={resetView}>
|
|
215
221
|
Reset
|
|
216
|
-
</
|
|
222
|
+
</Button>
|
|
217
223
|
) : null}
|
|
218
224
|
</div>
|
|
219
225
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChevronDown, Square } from "lucide-react";
|
|
2
1
|
import { type ReactNode, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import { SolarIcon } from "../../icon/SolarIcon";
|
|
3
3
|
import { cn } from "../../lib/cn";
|
|
4
4
|
import { Modal } from "../../modal/Modal";
|
|
5
5
|
import { Popconfirm } from "../../popconfirm/Popconfirm";
|
|
@@ -56,7 +56,7 @@ function TaskRow({
|
|
|
56
56
|
</button>
|
|
57
57
|
<Popconfirm title={`Stop ${formatToolName(task.toolName)}?`} okText="Stop" okType="danger" onConfirm={onCancel} getPopupContainer={() => document.body}>
|
|
58
58
|
<button type="button" disabled={cancelling} title="Stop" aria-label={`Stop ${formatToolName(task.toolName)}`} className="inline-flex size-5 shrink-0 items-center justify-center rounded cursor-pointer text-destructive transition-colors hover:bg-destructive/10 disabled:opacity-40">
|
|
59
|
-
<
|
|
59
|
+
<SolarIcon name="stop-bold" size={10} />
|
|
60
60
|
</button>
|
|
61
61
|
</Popconfirm>
|
|
62
62
|
</div>
|
|
@@ -120,7 +120,7 @@ export function BackgroundTasksBar({ children, tasks = [], cancellingIds, onCanc
|
|
|
120
120
|
<div className="absolute inset-x-6 bottom-[calc(100%)] z-20 overflow-hidden rounded-t-lg border-x border-t border-border">
|
|
121
121
|
<div className={cn("flex h-7.5 items-center gap-1 px-1", open && "border-b border-border-subtle")}>
|
|
122
122
|
<button type="button" onClick={() => setOpen((v) => !v)} className="flex min-w-0 flex-1 cursor-pointer font-medium items-center gap-1 rounded-md px-1.5 py-1 text-[13px] text-muted-foreground/90 transition-colors hover:text-foreground" aria-expanded={open} aria-label={label}>
|
|
123
|
-
<
|
|
123
|
+
<SolarIcon name="alt-arrow-down-linear" size={13} className={cn("shrink-0 transition-transform duration-150", !open && "-rotate-90")} />
|
|
124
124
|
<span className="truncate">{label}</span>
|
|
125
125
|
</button>
|
|
126
126
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode, useEffect, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { SolarIcon } from "../../icon/SolarIcon";
|
|
3
3
|
import { cn } from "../../lib/cn";
|
|
4
4
|
import { Shimmer } from "../../shimmer/Shimmer";
|
|
5
5
|
import { Spin } from "../../spin/Spin";
|
|
@@ -126,7 +126,7 @@ export function CallAgentToolUI({ msg, assistantLabel = "Assistant", assistantCo
|
|
|
126
126
|
{calling ? (
|
|
127
127
|
<Spin variant="agent" size="small" className="shrink-0" />
|
|
128
128
|
) : (
|
|
129
|
-
<
|
|
129
|
+
<SolarIcon name="dialog-2-linear" size={13} className="shrink-0 text-muted-foreground" />
|
|
130
130
|
)}
|
|
131
131
|
<Shimmer active={calling} className="min-w-0 flex-1 truncate text-[14px] font-medium text-foreground">Calling {calleeName}</Shimmer>
|
|
132
132
|
{bgRunning ? <span className="text-[14px] tabular-nums text-muted-foreground">{formatBgElapsed(timestampMs(msg.timestamp), now)}</span> : null}
|
|
@@ -138,7 +138,7 @@ export function CallAgentToolUI({ msg, assistantLabel = "Assistant", assistantCo
|
|
|
138
138
|
<div className="flex flex-col gap-3 px-3 py-3">
|
|
139
139
|
{composing || hasRequest ? (
|
|
140
140
|
<AgentTurn name={assistantLabel} align="end">
|
|
141
|
-
<div className="rounded-2xl rounded-tr-sm border border-
|
|
141
|
+
<div className="rounded-2xl rounded-tr-sm border border-solid border-(--nonla-input) bg-well-strong px-3 py-2 text-left">
|
|
142
142
|
{composing ? <TypingDots /> : <p className="m-0 text-[14px] leading-[1.55] whitespace-pre-wrap text-foreground">{requestMessage}</p>}
|
|
143
143
|
</div>
|
|
144
144
|
</AgentTurn>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { SolarIcon } from "../../icon/SolarIcon";
|
|
3
3
|
import { cn } from "../../lib/cn";
|
|
4
4
|
import { Shimmer } from "../../shimmer/Shimmer";
|
|
5
5
|
import { formatToolName, hasMeaningfulInput, prettyJson } from "../common/utils";
|
|
@@ -28,7 +28,7 @@ export function ChatToolCall({ toolName = "Tool", label, toolInput, toolOutput,
|
|
|
28
28
|
const [open, setOpen] = useState(defaultOpen);
|
|
29
29
|
const displayLabel = label ?? formatToolName(toolName);
|
|
30
30
|
|
|
31
|
-
const identityIcon = icon ?? <
|
|
31
|
+
const identityIcon = icon ?? <SolarIcon name="code-square-linear" size={13} className="shrink-0" />;
|
|
32
32
|
|
|
33
33
|
const header = (
|
|
34
34
|
<>
|
|
@@ -52,7 +52,7 @@ export function ChatToolCall({ toolName = "Tool", label, toolInput, toolOutput,
|
|
|
52
52
|
)}
|
|
53
53
|
|
|
54
54
|
{open && expandable ? (
|
|
55
|
-
<div className="mt-1.5 mb-1 overflow-hidden rounded-lg font-mono text-[13px]">
|
|
55
|
+
<div className="mt-1.5 mb-1 overflow-hidden rounded-lg border border-border bg-card font-mono text-[13px]">
|
|
56
56
|
{hasInput ? <pre className="m-0 max-h-27.5 overflow-y-auto bg-well px-3 py-1.5 break-all whitespace-pre-wrap font-normal leading-[1.65] text-muted-foreground">{prettyJson(toolInput)}</pre> : null}
|
|
57
57
|
{running ? (
|
|
58
58
|
<div className="bg-well-strong px-3 py-1.5 text-muted-foreground">
|
|
@@ -60,7 +60,7 @@ export function ChatToolCall({ toolName = "Tool", label, toolInput, toolOutput,
|
|
|
60
60
|
</div>
|
|
61
61
|
) : null}
|
|
62
62
|
{!isPending ? (
|
|
63
|
-
<pre className={cn("m-0 max-h-75 overflow-y-auto px-3 py-1.5 break-all whitespace-pre-wrap font-normal leading-[1.65] text-muted-foreground", hasError
|
|
63
|
+
<pre className={cn("m-0 max-h-75 overflow-y-auto bg-well-strong px-3 py-1.5 break-all whitespace-pre-wrap font-normal leading-[1.65] text-muted-foreground", hasError && "bg-destructive/6")}>
|
|
64
64
|
{hasOutput ? prettyJson(toolOutput) : typeof toolError === "string" ? toolError : "Tool execution failed"}
|
|
65
65
|
</pre>
|
|
66
66
|
) : null}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SolarIcon } from "../../icon/SolarIcon";
|
|
2
2
|
import { Shimmer } from "../../shimmer/Shimmer";
|
|
3
3
|
import { parseJsonObject } from "../common/utils";
|
|
4
4
|
import { ToolUiBadge } from "./ToolUiBadge";
|
|
@@ -40,7 +40,7 @@ export function GetCurrentTimeToolUI({ msg, assistantLabel = "Assistant", assist
|
|
|
40
40
|
<ToolUiBadge show={showAvatar} label={assistantLabel} color={assistantColor} />
|
|
41
41
|
<div className="px-4 pb-1">
|
|
42
42
|
<div className="flex items-center gap-2 py-1">
|
|
43
|
-
<
|
|
43
|
+
<SolarIcon name="clock-circle-linear" size={13} className="shrink-0 text-muted-foreground" />
|
|
44
44
|
<Shimmer active={running} className="truncate text-[14px] font-medium tabular-nums text-muted-foreground">{hasError ? "Failed to get time" : running ? "Getting time…" : label}</Shimmer>
|
|
45
45
|
<ToolUiTrailing failed={hasError} />
|
|
46
46
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SolarIcon } from "../../icon/SolarIcon";
|
|
2
2
|
import { cn } from "../../lib/cn";
|
|
3
3
|
import { Shimmer } from "../../shimmer/Shimmer";
|
|
4
4
|
import { parseJsonObject } from "../common/utils";
|
|
@@ -55,7 +55,7 @@ export function ReadSkillToolUI({ msg, assistantLabel = "Assistant", assistantCo
|
|
|
55
55
|
<ToolUiBadge show={showAvatar} label={assistantLabel} color={assistantColor} />
|
|
56
56
|
<details className="group/readskill px-4 pb-2" style={{ overflowAnchor: "none" }}>
|
|
57
57
|
<summary className="flex cursor-pointer list-none items-center gap-2 py-0.5 text-[14px] leading-5.5 select-none [&::-webkit-details-marker]:hidden">
|
|
58
|
-
<
|
|
58
|
+
<SolarIcon name={reference ? "document-text-linear" : "book-linear"} size={13} className="shrink-0 text-muted-foreground" />
|
|
59
59
|
<Shimmer active={running} className="min-w-0 truncate font-medium text-muted-foreground">
|
|
60
60
|
{verb}
|
|
61
61
|
{targetLabel ? <span className="font-normal text-tertiary-foreground"> {targetLabel}</span> : null}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodeBlock } from "../../codeblock/CodeBlock";
|
|
2
|
-
import {
|
|
2
|
+
import { SolarIcon } from "../../icon/SolarIcon";
|
|
3
3
|
import { cn } from "../../lib/cn";
|
|
4
4
|
import { Shimmer } from "../../shimmer/Shimmer";
|
|
5
5
|
import { parseBgTaskRef } from "../common/bgTasks";
|
|
@@ -87,7 +87,7 @@ export function RunJsToolUI({ msg, assistantLabel = "Assistant", assistantColor,
|
|
|
87
87
|
<ToolUiBadge show={showAvatar} label={assistantLabel} color={assistantColor} />
|
|
88
88
|
<details className="group/runjs px-4 pb-2" style={{ overflowAnchor: "none" }}>
|
|
89
89
|
<summary className="flex cursor-pointer list-none items-center gap-2 py-0.5 text-[14px] leading-5.5 select-none [&::-webkit-details-marker]:hidden">
|
|
90
|
-
<
|
|
90
|
+
<SolarIcon name="code-square-linear" size={13} className="shrink-0 text-muted-foreground" />
|
|
91
91
|
<Shimmer active={running} className="min-w-0 truncate font-medium text-muted-foreground">{verb}</Shimmer>
|
|
92
92
|
<ToolUiTrailing running={running} failed={failed} chevron chevronClassName="group-hover/runjs:opacity-100 group-open/runjs:opacity-100 group-open/runjs:rotate-90" />
|
|
93
93
|
</summary>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SolarIcon } from "../../icon/SolarIcon";
|
|
2
2
|
import { cn } from "../../lib/cn";
|
|
3
3
|
import { ChatSpinner } from "../message-ui/ChatSpinner";
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ export function ToolUiTrailing({
|
|
|
14
14
|
chevronClassName?: string;
|
|
15
15
|
}) {
|
|
16
16
|
if (running) return <ChatSpinner />;
|
|
17
|
-
if (failed) return <
|
|
17
|
+
if (failed) return <SolarIcon name="close-circle-linear" size={13} className="text-destructive" />;
|
|
18
18
|
if (!chevron) return null;
|
|
19
|
-
return <
|
|
19
|
+
return <SolarIcon name="alt-arrow-right-linear" size={12} className={cn("shrink-0 opacity-0 transition-[opacity,transform] duration-150", chevronClassName)} />;
|
|
20
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SolarIcon } from "../../icon/SolarIcon";
|
|
2
2
|
import { cn } from "../../lib/cn";
|
|
3
3
|
import { Shimmer } from "../../shimmer/Shimmer";
|
|
4
4
|
import { parseJsonObject } from "../common/utils";
|
|
@@ -37,7 +37,7 @@ export function WebFetchToolUI({ msg, assistantLabel = "Assistant", assistantCol
|
|
|
37
37
|
|
|
38
38
|
const header = (
|
|
39
39
|
<>
|
|
40
|
-
<
|
|
40
|
+
<SolarIcon name="globe-linear" size={13} className="shrink-0 text-muted-foreground" />
|
|
41
41
|
<Shimmer active={running} className="min-w-0 truncate font-medium text-muted-foreground">
|
|
42
42
|
{verb} <span className="font-normal text-tertiary-foreground">{url}</span>
|
|
43
43
|
</Shimmer>
|
|
@@ -2,6 +2,9 @@ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
|
2
2
|
import { type ComponentPropsWithoutRef, forwardRef, type ReactNode } from "react";
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
|
|
5
|
+
/** Checked fill. `white` is the on-state for dark surfaces — the mark stays ink. */
|
|
6
|
+
export type CheckboxColor = "brand" | "success" | "white";
|
|
7
|
+
|
|
5
8
|
export type CheckboxProps = Omit<ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, "onCheckedChange" | "checked" | "onChange"> & {
|
|
6
9
|
checked?: boolean | "indeterminate";
|
|
7
10
|
defaultChecked?: boolean;
|
|
@@ -9,6 +12,16 @@ export type CheckboxProps = Omit<ComponentPropsWithoutRef<typeof CheckboxPrimiti
|
|
|
9
12
|
onChange?: (checked: boolean) => void;
|
|
10
13
|
children?: ReactNode;
|
|
11
14
|
indeterminate?: boolean;
|
|
15
|
+
color?: CheckboxColor;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const CHECKED_FILL: Record<CheckboxColor, string> = {
|
|
19
|
+
brand:
|
|
20
|
+
"data-[state=checked]:bg-brand data-[state=checked]:border-brand data-[state=checked]:text-(--nonla-solid-fg) data-[state=indeterminate]:bg-brand data-[state=indeterminate]:border-brand data-[state=indeterminate]:text-(--nonla-solid-fg)",
|
|
21
|
+
success:
|
|
22
|
+
"data-[state=checked]:bg-success data-[state=checked]:border-success data-[state=checked]:text-(--nonla-solid-fg) data-[state=indeterminate]:bg-success data-[state=indeterminate]:border-success data-[state=indeterminate]:text-(--nonla-solid-fg)",
|
|
23
|
+
white:
|
|
24
|
+
"data-[state=checked]:bg-white data-[state=checked]:border-white data-[state=checked]:text-[#141414] data-[state=indeterminate]:bg-white data-[state=indeterminate]:border-white data-[state=indeterminate]:text-[#141414]",
|
|
12
25
|
};
|
|
13
26
|
|
|
14
27
|
function CheckIcon() {
|
|
@@ -20,7 +33,7 @@ function CheckIcon() {
|
|
|
20
33
|
}
|
|
21
34
|
|
|
22
35
|
export const Checkbox = forwardRef<HTMLButtonElement, CheckboxProps>(function Checkbox(
|
|
23
|
-
{ className, checked, defaultChecked, onChange, children, indeterminate, disabled, ...rest },
|
|
36
|
+
{ className, checked, defaultChecked, onChange, children, indeterminate, disabled, color = "brand", ...rest },
|
|
24
37
|
ref,
|
|
25
38
|
) {
|
|
26
39
|
const resolved = indeterminate ? "indeterminate" : checked;
|
|
@@ -34,9 +47,9 @@ export const Checkbox = forwardRef<HTMLButtonElement, CheckboxProps>(function Ch
|
|
|
34
47
|
disabled={disabled}
|
|
35
48
|
onCheckedChange={(v) => onChange?.(v === true)}
|
|
36
49
|
className={cn(
|
|
37
|
-
"size-4 shrink-0 rounded-sm border border-input bg-(--
|
|
38
|
-
"focus-visible:outline-none
|
|
39
|
-
|
|
50
|
+
"size-4 shrink-0 rounded-sm border border-input bg-(--nonla-surface) transition-colors duration-150 ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
51
|
+
"focus-visible:outline-none",
|
|
52
|
+
CHECKED_FILL[color],
|
|
40
53
|
className,
|
|
41
54
|
)}
|
|
42
55
|
{...rest}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FileText } from "lucide-react";
|
|
2
1
|
import { type ComponentProps, createContext, type ReactNode, useContext, useMemo } from "react";
|
|
3
2
|
import { ButtonCopy } from "../button/ButtonCopy";
|
|
4
3
|
import { cn } from "../lib/cn";
|
|
@@ -45,22 +44,17 @@ export function CodeBlock({ code, language, title, lineNumbers = false, wordWrap
|
|
|
45
44
|
|
|
46
45
|
return (
|
|
47
46
|
<CodeBlockContext.Provider value={{ code }}>
|
|
48
|
-
<div className={cn("nonla-codeblock relative flex min-w-0 w-full flex-col overflow-clip rounded-
|
|
49
|
-
<div className="flex h-
|
|
47
|
+
<div className={cn("nonla-codeblock relative flex min-w-0 w-full flex-col overflow-clip rounded-xl border border-border bg-card text-sm text-foreground", className)} data-language={language} {...props}>
|
|
48
|
+
<div className="flex h-8 items-center justify-between gap-2 pl-3 pr-1 text-xs text-muted-foreground">
|
|
50
49
|
<div className="flex min-w-0 items-center gap-2">
|
|
51
|
-
{label ?
|
|
52
|
-
<>
|
|
53
|
-
<FileText size={14} className="shrink-0" aria-hidden />
|
|
54
|
-
<span className="truncate font-medium">{label}</span>
|
|
55
|
-
</>
|
|
56
|
-
) : null}
|
|
50
|
+
{label ? <span className="truncate font-medium">{label}</span> : null}
|
|
57
51
|
</div>
|
|
58
52
|
<CodeBlockCopyButton />
|
|
59
53
|
</div>
|
|
60
54
|
|
|
61
55
|
<OverlayScroll
|
|
62
56
|
autoHeight
|
|
63
|
-
className=
|
|
57
|
+
className="nonla-codeblock-body nonla-codeblock-well min-w-0 bg-card font-mono text-[13px] leading-5 max-h-96"
|
|
64
58
|
innerClassName={wordWrap ? undefined : "overflow-x-auto"}
|
|
65
59
|
>
|
|
66
60
|
<pre className={cn("nonla-codeblock-pre m-0 whitespace-pre break-normal", lineNumbers && "nonla-codeblock-lines", wordWrap && "whitespace-pre-wrap wrap-break-word")}>
|
|
@@ -278,7 +278,7 @@ const DatePickerRoot = forwardRef<HTMLButtonElement, DatePickerProps>(function D
|
|
|
278
278
|
) : null
|
|
279
279
|
}
|
|
280
280
|
>
|
|
281
|
-
<span className={cn(!selected && "text-
|
|
281
|
+
<span className={cn(!selected && "text-placeholder")}>{selected ? label : placeholder}</span>
|
|
282
282
|
</TriggerChrome>
|
|
283
283
|
</PopoverPrimitive.Trigger>
|
|
284
284
|
<PopoverPrimitive.Portal container={portal}>
|
|
@@ -418,9 +418,9 @@ const RangePicker = forwardRef<HTMLButtonElement, RangePickerProps>(function Ran
|
|
|
418
418
|
}
|
|
419
419
|
>
|
|
420
420
|
<span className="inline-flex min-w-0 items-center gap-1.5">
|
|
421
|
-
<span className={cn("truncate", !selected?.from && "text-
|
|
421
|
+
<span className={cn("truncate", !selected?.from && "text-placeholder")}>{selected?.from ? startLabel : placeholders[0]}</span>
|
|
422
422
|
<span className="shrink-0 text-muted-foreground">{separator}</span>
|
|
423
|
-
<span className={cn("truncate", !rangeComplete && "text-
|
|
423
|
+
<span className={cn("truncate", !rangeComplete && "text-placeholder")}>{rangeComplete ? endLabel : placeholders[1]}</span>
|
|
424
424
|
</span>
|
|
425
425
|
</TriggerChrome>
|
|
426
426
|
</PopoverPrimitive.Trigger>
|
|
@@ -76,7 +76,7 @@ export function DesktopHeader({ left, right, className }: DesktopHeaderProps) {
|
|
|
76
76
|
return (
|
|
77
77
|
<header
|
|
78
78
|
className={cn(
|
|
79
|
-
"nonla-header-layer fixed inset-x-0 top-0 flex h-desktop-bar items-center justify-between gap-3 border-0 bg-
|
|
79
|
+
"nonla-header-layer fixed inset-x-0 top-0 flex h-desktop-bar items-center justify-between gap-3 border-0 bg-background px-3",
|
|
80
80
|
className,
|
|
81
81
|
)}
|
|
82
82
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, type ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { SolarIcon } from "../icon/SolarIcon";
|
|
3
3
|
|
|
4
4
|
const iconButtonClass =
|
|
5
5
|
"group w-[96px] flex flex-col items-center gap-0.5 py-2 px-0 rounded-md border-none cursor-pointer select-none outline-none bg-transparent focus-visible:outline-2 focus-visible:outline-brand motion-safe:transition-transform motion-safe:hover:-translate-y-0.5 motion-safe:active:scale-[0.98]";
|
|
@@ -19,7 +19,7 @@ export const DesktopIcon = forwardRef<
|
|
|
19
19
|
>(function DesktopIcon({ label, icon, media, active = false, onCard = false, onClick }, ref) {
|
|
20
20
|
return (
|
|
21
21
|
<button ref={ref} type="button" title={label} aria-label={label} aria-current={active ? "true" : undefined} dir="ltr" onClick={onClick} className={iconButtonClass}>
|
|
22
|
-
{media ?? <
|
|
22
|
+
{media ?? <SolarIcon name={icon ?? "stars-linear"} size={32} />}
|
|
23
23
|
<span className={`${labelClass} ${onCard ? "text-foreground" : "text-white [text-shadow:0_1px_2px_rgba(0,0,0,0.85)]"}`}>{label}</span>
|
|
24
24
|
</button>
|
|
25
25
|
);
|