@ctrl-ui/react 0.9.5 → 0.9.8
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 +38 -2
- package/dist/action-bar.js +16 -8
- package/dist/activity.d.ts +4 -2
- package/dist/activity.js +5 -2
- package/dist/audio-visualizer.js +1 -1
- package/dist/blocks/agent-run-clock.d.ts +5 -0
- package/dist/blocks/agent-run-clock.js +52 -0
- package/dist/blocks/agent-run-sidebar.d.ts +13 -0
- package/dist/blocks/agent-run-sidebar.js +101 -0
- package/dist/blocks/agent-run-status.d.ts +32 -0
- package/dist/blocks/agent-run-status.js +27 -0
- package/dist/blocks/agent-run.d.ts +82 -0
- package/dist/blocks/agent-run.js +262 -0
- package/dist/blocks/coding-agent.d.ts +1 -1
- package/dist/blocks/coding-agent.js +50 -69
- package/dist/blocks/design-canvas-data.d.ts +1 -1
- package/dist/blocks/design-canvas-inspector.js +1 -1
- package/dist/blocks/design-canvas.d.ts +2 -1
- package/dist/blocks/design-canvas.js +56 -42
- package/dist/blocks/discussion.js +1 -1
- package/dist/blocks/file-explorer.js +66 -47
- package/dist/blocks/settings.js +37 -41
- package/dist/blocks/team-chat.js +2 -1
- package/dist/blocks/theme-toggle.d.ts +2 -1
- package/dist/blocks/theme-toggle.js +13 -4
- package/dist/chat-message.js +33 -39
- package/dist/hooks/use-mobile.d.ts +1 -1
- package/dist/hooks/use-mobile.js +1 -1
- package/dist/knob-contracts/badge-knobs.d.ts +1 -1
- package/dist/knob-contracts/badge-knobs.js +3 -1
- package/dist/knob-contracts/button-knobs.d.ts +1 -1
- package/dist/knob-contracts/button-knobs.js +1 -0
- package/dist/knob-contracts/calendar-knobs.d.ts +1 -1
- package/dist/knob-contracts/calendar-knobs.js +9 -1
- package/dist/knob-contracts/card-knobs.d.ts +1 -1
- package/dist/knob-contracts/card-knobs.js +5 -1
- package/dist/knob-contracts/choice-knobs.d.ts +1 -1
- package/dist/knob-contracts/choice-knobs.js +1 -0
- package/dist/knob-contracts/collapsible-knobs.d.ts +1 -1
- package/dist/knob-contracts/collapsible-knobs.js +5 -1
- package/dist/knob-contracts/emoji-picker-knobs.d.ts +1 -1
- package/dist/knob-contracts/emoji-picker-knobs.js +3 -1
- package/dist/knob-contracts/field-knobs.d.ts +1 -1
- package/dist/knob-contracts/field-knobs.js +17 -1
- package/dist/knob-contracts/infinite-canvas-knobs.d.ts +1 -1
- package/dist/knob-contracts/infinite-canvas-knobs.js +1 -7
- package/dist/knob-contracts/item-knobs.d.ts +1 -1
- package/dist/knob-contracts/item-knobs.js +5 -1
- package/dist/knob-contracts/kbd-knobs.d.ts +1 -1
- package/dist/knob-contracts/kbd-knobs.js +4 -1
- package/dist/knob-contracts/page-layout-knobs.d.ts +1 -1
- package/dist/knob-contracts/page-layout-knobs.js +1 -0
- package/dist/knob-contracts/pagination-knobs.d.ts +1 -1
- package/dist/knob-contracts/pagination-knobs.js +2 -1
- package/dist/knob-contracts/popup-knobs.d.ts +1 -1
- package/dist/knob-contracts/popup-knobs.js +9 -0
- package/dist/knob-contracts/range-knobs.d.ts +1 -1
- package/dist/knob-contracts/range-knobs.js +2 -0
- package/dist/knob-contracts/sidebar-knobs.d.ts +1 -1
- package/dist/knob-contracts/sidebar-knobs.js +2 -0
- package/dist/knob-contracts/swap-knobs.d.ts +4 -0
- package/dist/knob-contracts/swap-knobs.js +9 -0
- package/dist/knob-contracts/tabs-knobs.d.ts +1 -1
- package/dist/knob-contracts/tabs-knobs.js +3 -0
- package/dist/knob-contracts/timeline-knobs.d.ts +1 -1
- package/dist/knob-contracts/timeline-knobs.js +5 -1
- package/dist/knob-contracts/tool-approval-knobs.d.ts +4 -0
- package/dist/knob-contracts/tool-approval-knobs.js +32 -0
- package/dist/knob-contracts/tree-knobs.d.ts +1 -1
- package/dist/knob-contracts/tree-knobs.js +3 -1
- package/dist/lib/infinite-canvas-camera-store.d.ts +65 -0
- package/dist/lib/infinite-canvas-camera-store.js +233 -0
- package/dist/lib/infinite-canvas-camera.d.ts +33 -0
- package/dist/lib/infinite-canvas-camera.js +98 -0
- package/dist/lib/infinite-canvas-navigation.d.ts +19 -0
- package/dist/lib/infinite-canvas-navigation.js +395 -0
- package/dist/markdown-editor/bubble-menu.d.ts +6 -0
- package/dist/markdown-editor/bubble-menu.js +45 -0
- package/dist/markdown-editor/toolbar.d.ts +17 -1
- package/dist/markdown-editor/toolbar.js +103 -81
- package/dist/skin.d.ts +2 -0
- package/dist/styles/index.css +11 -10
- package/dist/styles/recipes/activity.css +12 -0
- package/dist/styles/recipes/avatar.css +1 -1
- package/dist/styles/recipes/badge.css +17 -0
- package/dist/styles/recipes/button-group.css +12 -6
- package/dist/styles/recipes/button.css +20 -3
- package/dist/styles/recipes/calendar.css +82 -6
- package/dist/styles/recipes/card.css +40 -5
- package/dist/styles/recipes/chat-message-edit.css +6 -21
- package/dist/styles/recipes/choice.css +9 -2
- package/dist/styles/recipes/collapsible.css +8 -1
- package/dist/styles/recipes/color-picker-values.css +4 -0
- package/dist/styles/recipes/emoji-picker.css +29 -8
- package/dist/styles/recipes/field-parts.css +80 -5
- package/dist/styles/recipes/field.css +113 -40
- package/dist/styles/recipes/infinite-canvas.css +17 -57
- package/dist/styles/recipes/item.css +33 -5
- package/dist/styles/recipes/kbd.css +26 -6
- package/dist/styles/recipes/markdown-editor.css +12 -0
- package/dist/styles/recipes/morphing-panel.css +1 -1
- package/dist/styles/recipes/page-layout.css +18 -2
- package/dist/styles/recipes/pagination.css +8 -0
- package/dist/styles/recipes/popup-controls.css +9 -0
- package/dist/styles/recipes/popup-drawer.css +1 -0
- package/dist/styles/recipes/popup-lists.css +55 -6
- package/dist/styles/recipes/popup-motion.css +7 -1
- package/dist/styles/recipes/popup.css +10 -0
- package/dist/styles/recipes/range.css +16 -2
- package/dist/styles/recipes/sidebar-mobile.css +1 -1
- package/dist/styles/recipes/sidebar-parts.css +17 -1
- package/dist/styles/recipes/sidebar.css +11 -0
- package/dist/styles/recipes/swap.css +143 -0
- package/dist/styles/recipes/tabs.css +41 -8
- package/dist/styles/recipes/timeline.css +36 -2
- package/dist/styles/recipes/tool-approval.css +267 -0
- package/dist/styles/recipes/track-highlight.css +19 -6
- package/dist/styles/recipes/tree.css +33 -0
- package/dist/styles/theme.css +17 -6
- package/dist/tool-approval.d.ts +49 -0
- package/dist/tool-approval.js +260 -0
- package/dist/ui/alert-dialog.js +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/calendar.js +9 -4
- package/dist/ui/card.d.ts +3 -1
- package/dist/ui/card.js +2 -1
- package/dist/ui/code.js +13 -3
- package/dist/ui/command.js +1 -0
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dropdown-menu.d.ts +1 -1
- package/dist/ui/dropdown-menu.js +23 -6
- package/dist/ui/dropzone.js +10 -11
- package/dist/ui/field.d.ts +6 -2
- package/dist/ui/field.js +4 -2
- package/dist/ui/infinite-canvas.d.ts +19 -22
- package/dist/ui/infinite-canvas.js +264 -325
- package/dist/ui/morphing-panel.d.ts +5 -1
- package/dist/ui/morphing-panel.js +4 -2
- package/dist/ui/rich-tooltip.d.ts +2 -1
- package/dist/ui/rich-tooltip.js +32 -29
- package/dist/ui/select.js +2 -2
- package/dist/ui/sidebar-mobile.js +1 -1
- package/dist/ui/sidebar-provider.d.ts +3 -1
- package/dist/ui/sidebar-provider.js +3 -2
- package/dist/ui/sidebar-resize-rail.js +1 -1
- package/dist/ui/sidebar.d.ts +6 -5
- package/dist/ui/sidebar.js +10 -9
- package/dist/ui/swap.d.ts +14 -0
- package/dist/ui/swap.js +69 -0
- package/dist/ui/tabs.d.ts +1 -1
- package/dist/ui/tabs.js +2 -13
- package/dist/ui/timeline.d.ts +1 -1
- package/dist/ui/timeline.js +2 -2
- package/dist/ui/typography.d.ts +11 -5
- package/dist/ui/typography.js +18 -6
- package/dist/user-ask.js +1 -1
- package/lint/biome-preset.json +3 -0
- package/lint/class-policy.mjs +17 -0
- package/lint/eslint-plugin.mjs +87 -0
- package/lint/grit-rules.mjs +40 -0
- package/lint/no-component-style-classes.grit +16 -0
- package/lint/no-raw-type-classes.grit +3 -4
- package/lint/write-grit-rules.mjs +19 -0
- package/package.json +12 -3
- package/dist/styles/type-scale.css +0 -72
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { LiveStatus } from "../ui/live-status.js";
|
|
4
|
+
import { Activity, ActivityContent, ActivityDetail, ActivityDetailContent, ActivityDetailLabel, ActivityIcon, ActivityRow, ActivityStatus, ActivityTitle, ActivityTrigger } from "../activity.js";
|
|
5
|
+
import { Heading, Text } from "../ui/typography.js";
|
|
6
|
+
import { Badge } from "../ui/badge.js";
|
|
7
|
+
import { elapsedIsoDuration, formatElapsed, useRunClock } from "./agent-run-clock.js";
|
|
8
|
+
import { SidebarProvider } from "../ui/sidebar-provider.js";
|
|
9
|
+
import { SidebarInset, SidebarTrigger } from "../ui/sidebar.js";
|
|
10
|
+
import { agentRunStatusColors, agentRunStatusLabels, agentRunStepLabels } from "./agent-run-status.js";
|
|
11
|
+
import { AgentRunSidebar } from "./agent-run-sidebar.js";
|
|
12
|
+
import { Card, CardAction, CardContent, CardHeader } from "../ui/card.js";
|
|
13
|
+
import { Timeline, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineMeta, TimelineSeparator, TimelineTitle } from "../ui/timeline.js";
|
|
14
|
+
import { createContext, useContext, useId } from "react";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { Check, Circle, CircleAlert, CircleDashed, CirclePause, LoaderCircle } from "lucide-react";
|
|
17
|
+
//#region src/blocks/agent-run.tsx
|
|
18
|
+
const AgentRunLayoutContext = createContext("viewport");
|
|
19
|
+
function useHeadingLevels() {
|
|
20
|
+
return useContext(AgentRunLayoutContext) === "contained" ? {
|
|
21
|
+
title: 2,
|
|
22
|
+
section: 3
|
|
23
|
+
} : {
|
|
24
|
+
title: 1,
|
|
25
|
+
section: 2
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function AgentRunBlock({ appName = "Agents", brand, runs, activeRunId, onRunSelect, onNewRun, sidebarFooter, children, layout = "viewport", className, style, ...props }) {
|
|
29
|
+
const providerStyle = {
|
|
30
|
+
"--sidebar-width": "16rem",
|
|
31
|
+
...style
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ jsxs(SidebarProvider, {
|
|
34
|
+
layout,
|
|
35
|
+
surface: "background",
|
|
36
|
+
className: cn(layout === "viewport" && "h-svh overflow-hidden", className),
|
|
37
|
+
style: providerStyle,
|
|
38
|
+
...props,
|
|
39
|
+
children: [/* @__PURE__ */ jsx(AgentRunSidebar, {
|
|
40
|
+
appName,
|
|
41
|
+
brand,
|
|
42
|
+
runs,
|
|
43
|
+
activeRunId,
|
|
44
|
+
sidebarFooter,
|
|
45
|
+
onRunSelect,
|
|
46
|
+
onNewRun
|
|
47
|
+
}), /* @__PURE__ */ jsx(SidebarInset, {
|
|
48
|
+
className: "@container/agent-run flex h-full min-h-0 min-w-0 flex-col overflow-hidden",
|
|
49
|
+
children: /* @__PURE__ */ jsx(AgentRunLayoutContext.Provider, {
|
|
50
|
+
value: layout,
|
|
51
|
+
children
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function AgentRunElapsed({ startedAt, endedAt, size = "label", className, ...props }) {
|
|
57
|
+
const now = useRunClock(endedAt === void 0);
|
|
58
|
+
const end = endedAt ?? now;
|
|
59
|
+
const ms = end === null ? null : Math.max(0, end - startedAt);
|
|
60
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
61
|
+
size,
|
|
62
|
+
tone: "muted",
|
|
63
|
+
numeric: true,
|
|
64
|
+
className,
|
|
65
|
+
children: /* @__PURE__ */ jsx("time", {
|
|
66
|
+
dateTime: ms === null ? void 0 : elapsedIsoDuration(ms),
|
|
67
|
+
...props,
|
|
68
|
+
children: ms === null ? "" : formatElapsed(ms)
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function AgentRunHeader({ title, status, startedAt, endedAt, actions, className, ...props }) {
|
|
73
|
+
const levels = useHeadingLevels();
|
|
74
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
75
|
+
className: cn("flex h-12 shrink-0 items-center gap-2 border-b border-border/70 px-3", className),
|
|
76
|
+
...props,
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsx(SidebarTrigger, {
|
|
79
|
+
size: "xs",
|
|
80
|
+
className: "lg:hidden"
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsx(Heading, {
|
|
83
|
+
level: levels.title,
|
|
84
|
+
size: "label",
|
|
85
|
+
weight: "medium",
|
|
86
|
+
className: "min-w-0 truncate",
|
|
87
|
+
title,
|
|
88
|
+
children: title
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
91
|
+
size: "sm",
|
|
92
|
+
color: agentRunStatusColors[status],
|
|
93
|
+
children: agentRunStatusLabels[status]
|
|
94
|
+
}),
|
|
95
|
+
startedAt === void 0 ? null : /* @__PURE__ */ jsx(AgentRunElapsed, {
|
|
96
|
+
startedAt,
|
|
97
|
+
endedAt,
|
|
98
|
+
size: "body"
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx("div", {
|
|
101
|
+
className: "ms-auto flex shrink-0 items-center gap-1",
|
|
102
|
+
children: actions
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ jsx(LiveStatus, { message: `${title}: ${agentRunStatusLabels[status]}` })
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function AgentRunBody({ aside, className, children, ...props }) {
|
|
109
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
110
|
+
className: cn("grid min-h-0 flex-1 content-start overflow-y-auto @3xl/agent-run:grid-cols-[minmax(0,1fr)_minmax(18rem,22rem)] @3xl/agent-run:content-stretch @3xl/agent-run:overflow-hidden", className),
|
|
111
|
+
...props,
|
|
112
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
113
|
+
className: "min-w-0 px-4 py-5 @lg/agent-run:px-6 @3xl/agent-run:overflow-y-auto",
|
|
114
|
+
children
|
|
115
|
+
}), aside]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function AgentRunPlan({ title = "Plan", description, className, children, ...props }) {
|
|
119
|
+
const levels = useHeadingLevels();
|
|
120
|
+
const headingId = useId();
|
|
121
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
122
|
+
"aria-labelledby": headingId,
|
|
123
|
+
className: cn("min-w-0", className),
|
|
124
|
+
...props,
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ jsx(Heading, {
|
|
127
|
+
id: headingId,
|
|
128
|
+
level: levels.section,
|
|
129
|
+
size: "label",
|
|
130
|
+
weight: "medium",
|
|
131
|
+
children: title
|
|
132
|
+
}),
|
|
133
|
+
description ? /* @__PURE__ */ jsx(Text, {
|
|
134
|
+
size: "caption",
|
|
135
|
+
tone: "muted",
|
|
136
|
+
children: description
|
|
137
|
+
}) : null,
|
|
138
|
+
/* @__PURE__ */ jsx(Timeline, {
|
|
139
|
+
className: "mt-3",
|
|
140
|
+
children
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const stepIcons = {
|
|
146
|
+
neutral: /* @__PURE__ */ jsx(Circle, { "aria-hidden": "true" }),
|
|
147
|
+
pending: /* @__PURE__ */ jsx(CircleDashed, { "aria-hidden": "true" }),
|
|
148
|
+
running: /* @__PURE__ */ jsx(LoaderCircle, {
|
|
149
|
+
className: "motion-safe:animate-spin",
|
|
150
|
+
"aria-hidden": "true"
|
|
151
|
+
}),
|
|
152
|
+
waiting: /* @__PURE__ */ jsx(CirclePause, { "aria-hidden": "true" }),
|
|
153
|
+
success: /* @__PURE__ */ jsx(Check, { "aria-hidden": "true" }),
|
|
154
|
+
error: /* @__PURE__ */ jsx(CircleAlert, { "aria-hidden": "true" })
|
|
155
|
+
};
|
|
156
|
+
function AgentRunStep({ title, detail, startedAt, endedAt, actions, state = "pending", children, ...props }) {
|
|
157
|
+
const hasMeta = startedAt !== void 0 || actions !== void 0;
|
|
158
|
+
return /* @__PURE__ */ jsxs(TimelineItem, {
|
|
159
|
+
state,
|
|
160
|
+
...props,
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx(TimelineIndicator, {
|
|
163
|
+
"aria-label": agentRunStepLabels[state],
|
|
164
|
+
children: stepIcons[state]
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ jsx(TimelineSeparator, {}),
|
|
167
|
+
/* @__PURE__ */ jsxs(TimelineContent, { children: [
|
|
168
|
+
/* @__PURE__ */ jsx(TimelineTitle, { children: title }),
|
|
169
|
+
detail ? /* @__PURE__ */ jsx(TimelineDescription, { children: detail }) : null,
|
|
170
|
+
hasMeta ? /* @__PURE__ */ jsxs(TimelineMeta, { children: [startedAt === void 0 ? null : /* @__PURE__ */ jsx(AgentRunElapsed, {
|
|
171
|
+
startedAt,
|
|
172
|
+
endedAt
|
|
173
|
+
}), actions] }) : null,
|
|
174
|
+
children ? /* @__PURE__ */ jsx("div", {
|
|
175
|
+
className: "mt-2 grid gap-2",
|
|
176
|
+
children
|
|
177
|
+
}) : null
|
|
178
|
+
] })
|
|
179
|
+
]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function formatToolValue(value) {
|
|
183
|
+
return typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
184
|
+
}
|
|
185
|
+
function AgentRunToolCall({ name, summary, icon, input, output, errorText, startedAt, endedAt, ...props }) {
|
|
186
|
+
const hasDetails = input !== void 0 || output !== void 0 || errorText !== void 0;
|
|
187
|
+
const Row = hasDetails ? ActivityTrigger : ActivityRow;
|
|
188
|
+
return /* @__PURE__ */ jsxs(Activity, {
|
|
189
|
+
kind: "tool",
|
|
190
|
+
name,
|
|
191
|
+
...props,
|
|
192
|
+
children: [/* @__PURE__ */ jsxs(Row, { children: [
|
|
193
|
+
icon ? /* @__PURE__ */ jsx(ActivityIcon, { children: icon }) : /* @__PURE__ */ jsx(ActivityIcon, {}),
|
|
194
|
+
/* @__PURE__ */ jsxs(ActivityTitle, { children: [name, summary ? /* @__PURE__ */ jsxs("span", {
|
|
195
|
+
className: "text-muted-foreground",
|
|
196
|
+
children: [" · ", summary]
|
|
197
|
+
}) : null] }),
|
|
198
|
+
startedAt === void 0 ? null : /* @__PURE__ */ jsx(AgentRunElapsed, {
|
|
199
|
+
startedAt,
|
|
200
|
+
endedAt,
|
|
201
|
+
className: "ms-2"
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ jsx(ActivityStatus, { className: "sr-only" })
|
|
204
|
+
] }), hasDetails ? /* @__PURE__ */ jsxs(ActivityContent, { children: [
|
|
205
|
+
input === void 0 ? null : /* @__PURE__ */ jsxs(ActivityDetail, { children: [/* @__PURE__ */ jsx(ActivityDetailLabel, { children: "Input" }), /* @__PURE__ */ jsx(ActivityDetailContent, {
|
|
206
|
+
format: "code",
|
|
207
|
+
children: formatToolValue(input)
|
|
208
|
+
})] }),
|
|
209
|
+
output === void 0 ? null : /* @__PURE__ */ jsxs(ActivityDetail, { children: [/* @__PURE__ */ jsx(ActivityDetailLabel, { children: "Output" }), /* @__PURE__ */ jsx(ActivityDetailContent, {
|
|
210
|
+
format: "code",
|
|
211
|
+
children: formatToolValue(output)
|
|
212
|
+
})] }),
|
|
213
|
+
errorText === void 0 ? null : /* @__PURE__ */ jsxs(ActivityDetail, { children: [/* @__PURE__ */ jsx(ActivityDetailLabel, { children: "Error" }), /* @__PURE__ */ jsx(ActivityDetailContent, {
|
|
214
|
+
tone: "destructive",
|
|
215
|
+
children: errorText
|
|
216
|
+
})] })
|
|
217
|
+
] }) : null]
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function AgentRunAside({ className, ...props }) {
|
|
221
|
+
return /* @__PURE__ */ jsx("aside", {
|
|
222
|
+
"aria-label": "Run output",
|
|
223
|
+
className: cn("grid content-start gap-4 border-t border-border/70 px-4 py-5 @lg/agent-run:px-6 @3xl/agent-run:overflow-y-auto @3xl/agent-run:border-t-0 @3xl/agent-run:border-s", className),
|
|
224
|
+
...props
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function AgentRunSection({ title, actions, children, ...props }) {
|
|
228
|
+
const levels = useHeadingLevels();
|
|
229
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
230
|
+
...props,
|
|
231
|
+
children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(Heading, {
|
|
232
|
+
level: levels.section,
|
|
233
|
+
size: "label",
|
|
234
|
+
weight: "medium",
|
|
235
|
+
children: title
|
|
236
|
+
}), actions ? /* @__PURE__ */ jsx(CardAction, { children: actions }) : null] }), /* @__PURE__ */ jsx(CardContent, { children })]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function AgentRunDetails({ title = "Details", items, ...props }) {
|
|
240
|
+
if (items.length === 0) return null;
|
|
241
|
+
return /* @__PURE__ */ jsx(AgentRunSection, {
|
|
242
|
+
title,
|
|
243
|
+
...props,
|
|
244
|
+
children: /* @__PURE__ */ jsx("dl", {
|
|
245
|
+
className: "grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2",
|
|
246
|
+
children: items.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
247
|
+
className: "contents",
|
|
248
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
249
|
+
as: "dt",
|
|
250
|
+
tone: "muted",
|
|
251
|
+
children: item.label
|
|
252
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
253
|
+
as: "dd",
|
|
254
|
+
className: "min-w-0 break-words",
|
|
255
|
+
children: item.value
|
|
256
|
+
})]
|
|
257
|
+
}, item.label))
|
|
258
|
+
})
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
export { AgentRunAside, AgentRunBlock, AgentRunBody, AgentRunDetails, AgentRunElapsed, AgentRunHeader, AgentRunPlan, AgentRunSection, AgentRunStep, AgentRunToolCall };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChatLayout } from "../chat-layout.js";
|
|
2
1
|
import { SidebarProviderProps } from "../ui/sidebar-provider.js";
|
|
3
2
|
import "../ui/sidebar.js";
|
|
3
|
+
import { ChatLayout } from "../chat-layout.js";
|
|
4
4
|
import { ComponentProps, ReactNode } from "react";
|
|
5
5
|
//#region src/blocks/coding-agent.d.ts
|
|
6
6
|
export type CodingAgentNavigationItem = {
|
|
@@ -5,8 +5,9 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/colla
|
|
|
5
5
|
import { Heading, Text } from "../ui/typography.js";
|
|
6
6
|
import { ChatLayout, ChatThread } from "../chat-layout.js";
|
|
7
7
|
import { SidebarProvider, useSidebar } from "../ui/sidebar-provider.js";
|
|
8
|
-
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "../ui/sidebar-menu.js";
|
|
8
|
+
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub } from "../ui/sidebar-menu.js";
|
|
9
9
|
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInset, SidebarRail, SidebarTrigger } from "../ui/sidebar.js";
|
|
10
|
+
import { Item, ItemContent, ItemDescription, ItemMedia, ItemTitle } from "../ui/item.js";
|
|
10
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
12
|
import { BotIcon, ChevronRightIcon, CircleIcon, FolderIcon, PlusIcon, SearchIcon } from "lucide-react";
|
|
12
13
|
//#region src/blocks/coding-agent.tsx
|
|
@@ -17,7 +18,8 @@ function CodingAgentBlock({ appName = "Agent", brand, sidebarTop, navigation = [
|
|
|
17
18
|
};
|
|
18
19
|
return /* @__PURE__ */ jsxs(SidebarProvider, {
|
|
19
20
|
layout,
|
|
20
|
-
|
|
21
|
+
surface: "background",
|
|
22
|
+
className: cn(layout === "viewport" && "h-svh overflow-hidden", className),
|
|
21
23
|
style: providerStyle,
|
|
22
24
|
...props,
|
|
23
25
|
children: [/* @__PURE__ */ jsx(CodingAgentSidebar, {
|
|
@@ -78,7 +80,8 @@ function CodingAgentSidebar({ appName, brand, sidebarTop, navigation, projects,
|
|
|
78
80
|
collapsible: "offcanvas",
|
|
79
81
|
children: [
|
|
80
82
|
/* @__PURE__ */ jsxs(SidebarHeader, {
|
|
81
|
-
|
|
83
|
+
divider: true,
|
|
84
|
+
className: "gap-1.5",
|
|
82
85
|
children: [
|
|
83
86
|
sidebarTop,
|
|
84
87
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -117,25 +120,22 @@ function CodingAgentSidebar({ appName, brand, sidebarTop, navigation, projects,
|
|
|
117
120
|
}) }) })
|
|
118
121
|
]
|
|
119
122
|
}),
|
|
120
|
-
/* @__PURE__ */ jsxs(SidebarContent, { children: [navigation.length > 0 ? /* @__PURE__ */ jsx(SidebarGroup, {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
children:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
item.trailing
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}) }, item.id)) })
|
|
137
|
-
}) : null, /* @__PURE__ */ jsxs(SidebarGroup, {
|
|
138
|
-
className: "gap-1 pt-1",
|
|
123
|
+
/* @__PURE__ */ jsxs(SidebarContent, { children: [navigation.length > 0 ? /* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: navigation.map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
124
|
+
size: "sm",
|
|
125
|
+
onClick: () => {
|
|
126
|
+
onNavigationSelect?.(item);
|
|
127
|
+
finishMobileNavigation();
|
|
128
|
+
},
|
|
129
|
+
children: [
|
|
130
|
+
item.icon,
|
|
131
|
+
/* @__PURE__ */ jsx("span", { children: item.label }),
|
|
132
|
+
item.trailing ? /* @__PURE__ */ jsx("span", {
|
|
133
|
+
className: "ms-auto shrink-0",
|
|
134
|
+
children: item.trailing
|
|
135
|
+
}) : null
|
|
136
|
+
]
|
|
137
|
+
}) }, item.id)) }) }) : null, /* @__PURE__ */ jsxs(SidebarGroup, {
|
|
138
|
+
className: "gap-1",
|
|
139
139
|
children: [/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Projects" }), /* @__PURE__ */ jsx("div", {
|
|
140
140
|
className: "grid gap-1",
|
|
141
141
|
children: projects.map((project) => /* @__PURE__ */ jsxs(Collapsible, {
|
|
@@ -157,28 +157,25 @@ function CodingAgentSidebar({ appName, brand, sidebarTop, navigation, projects,
|
|
|
157
157
|
className: "truncate",
|
|
158
158
|
children: project.name
|
|
159
159
|
})
|
|
160
|
-
] }), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
task.trailing
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
]
|
|
180
|
-
}) }, task.id))
|
|
181
|
-
}) })]
|
|
160
|
+
] }), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: project.tasks.map((task) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
161
|
+
size: "sm",
|
|
162
|
+
isActive: task.id === activeTaskId,
|
|
163
|
+
onClick: () => {
|
|
164
|
+
onTaskSelect?.(task, project);
|
|
165
|
+
finishMobileNavigation();
|
|
166
|
+
},
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsx(CircleIcon, {
|
|
169
|
+
className: "size-1.5 fill-current opacity-35",
|
|
170
|
+
"aria-hidden": "true"
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ jsx("span", { children: task.title }),
|
|
173
|
+
task.trailing ? /* @__PURE__ */ jsx("span", {
|
|
174
|
+
className: "ms-auto shrink-0",
|
|
175
|
+
children: task.trailing
|
|
176
|
+
}) : null
|
|
177
|
+
]
|
|
178
|
+
}) }, task.id)) }) })]
|
|
182
179
|
}, project.id))
|
|
183
180
|
})]
|
|
184
181
|
})] }),
|
|
@@ -228,31 +225,15 @@ function CodingAgentEmptyState({ title = "What should we build?", description, i
|
|
|
228
225
|
}) : null,
|
|
229
226
|
suggestions.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
230
227
|
className: "mt-8 grid w-full grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
231
|
-
children: suggestions.map((suggestion) => /* @__PURE__ */
|
|
232
|
-
variant: "
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
className: "text-primary-text",
|
|
241
|
-
children: suggestion.icon
|
|
242
|
-
}),
|
|
243
|
-
/* @__PURE__ */ jsx(Text, {
|
|
244
|
-
weight: "medium",
|
|
245
|
-
tone: "foreground",
|
|
246
|
-
children: suggestion.title
|
|
247
|
-
}),
|
|
248
|
-
suggestion.description ? /* @__PURE__ */ jsx(Text, {
|
|
249
|
-
size: "caption",
|
|
250
|
-
tone: "muted",
|
|
251
|
-
className: "leading-5",
|
|
252
|
-
children: suggestion.description
|
|
253
|
-
}) : null
|
|
254
|
-
]
|
|
255
|
-
})
|
|
228
|
+
children: suggestions.map((suggestion) => /* @__PURE__ */ jsxs(Item, {
|
|
229
|
+
variant: "outline",
|
|
230
|
+
render: /* @__PURE__ */ jsx("button", {
|
|
231
|
+
type: "button",
|
|
232
|
+
onClick: () => onSuggestionSelect?.(suggestion.prompt ?? suggestion.title, suggestion)
|
|
233
|
+
}),
|
|
234
|
+
className: "min-h-28 w-full flex-col items-start text-start",
|
|
235
|
+
style: { "--cui-item-media-foreground": "var(--primary-text)" },
|
|
236
|
+
children: [/* @__PURE__ */ jsx(ItemMedia, { children: suggestion.icon }), /* @__PURE__ */ jsxs(ItemContent, { children: [/* @__PURE__ */ jsx(ItemTitle, { children: suggestion.title }), suggestion.description ? /* @__PURE__ */ jsx(ItemDescription, { children: suggestion.description }) : null] })]
|
|
256
237
|
}, suggestion.id))
|
|
257
238
|
}) : null
|
|
258
239
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/blocks/design-canvas-data.d.ts
|
|
2
2
|
export type DesignCanvasLayerKind = "frame" | "rectangle" | "ellipse" | "text";
|
|
3
|
-
export type DesignCanvasTool = "move" | DesignCanvasLayerKind;
|
|
3
|
+
export type DesignCanvasTool = "move" | "hand" | DesignCanvasLayerKind;
|
|
4
4
|
export type DesignCanvasFill = {
|
|
5
5
|
color: string;
|
|
6
6
|
opacity: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button } from "../ui/button.js";
|
|
3
3
|
import { Heading } from "../ui/typography.js";
|
|
4
|
+
import { Separator } from "../ui/separator.js";
|
|
4
5
|
import { resizeDesignCanvasLayer } from "./design-canvas-data.js";
|
|
5
6
|
import { ColorPickerArea } from "../ui/color-picker-area.js";
|
|
6
7
|
import { ColorPickerHue } from "../ui/color-picker-sliders.js";
|
|
@@ -9,7 +10,6 @@ import { NumberField, NumberFieldGroup, NumberFieldInput, NumberFieldScrubArea }
|
|
|
9
10
|
import { ColorPickerEyeDropper, ColorPickerInput } from "../ui/color-picker-values.js";
|
|
10
11
|
import { ColorPicker, ColorPickerContent, ColorPickerTrigger } from "../ui/color-picker.js";
|
|
11
12
|
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "../ui/empty.js";
|
|
12
|
-
import { Separator } from "../ui/separator.js";
|
|
13
13
|
import { Toggle } from "../ui/toggle.js";
|
|
14
14
|
import { useState } from "react";
|
|
15
15
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DesignCanvasFill, DesignCanvasLayer, DesignCanvasLayerKind, DesignCanvasTool } from "./design-canvas-data.js";
|
|
2
|
-
import { InfiniteCanvasTransform } from "../
|
|
2
|
+
import { InfiniteCanvasTransform } from "../lib/infinite-canvas-camera.js";
|
|
3
|
+
import "../ui/infinite-canvas.js";
|
|
3
4
|
import { ComponentProps } from "react";
|
|
4
5
|
//#region src/blocks/design-canvas.d.ts
|
|
5
6
|
export type DesignCanvasBlockProps = Omit<ComponentProps<"div">, "children" | "defaultValue" | "onChange"> & {
|