@iloveagents/foundry-web-ui 0.3.1 → 0.5.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 +13 -4
- package/dist/components/ag-ui-runtime-provider.d.ts +64 -0
- package/dist/components/ag-ui-runtime-provider.js +71 -0
- package/dist/components/app-brand.d.ts +6 -0
- package/dist/components/app-brand.js +13 -0
- package/dist/components/assistant-chat.d.ts +26 -0
- package/dist/components/assistant-chat.js +94 -0
- package/dist/components/chat-attachments.d.ts +25 -0
- package/dist/components/chat-attachments.js +20 -0
- package/dist/components/chat-bubble.d.ts +1 -0
- package/dist/components/chat-bubble.js +105 -0
- package/dist/components/chat-header.d.ts +2 -0
- package/dist/components/chat-header.js +16 -0
- package/dist/components/client-tool-executor.d.ts +12 -0
- package/dist/components/client-tool-executor.js +108 -0
- package/dist/components/collection-empty-state.d.ts +9 -0
- package/dist/components/collection-empty-state.js +6 -0
- package/dist/components/collection-filter-bar.d.ts +19 -0
- package/dist/components/collection-filter-bar.js +28 -0
- package/dist/components/collection-search-input.d.ts +6 -0
- package/dist/components/collection-search-input.js +8 -0
- package/dist/components/collection-skeleton.d.ts +6 -0
- package/dist/components/collection-skeleton.js +10 -0
- package/dist/components/collection-sort-menu.d.ts +10 -0
- package/dist/components/collection-sort-menu.js +9 -0
- package/dist/components/collection-surface.d.ts +8 -0
- package/dist/components/collection-surface.js +5 -0
- package/dist/components/collection-toolbar.d.ts +9 -0
- package/dist/components/collection-toolbar.js +5 -0
- package/dist/components/collection-view-toggle.d.ts +7 -0
- package/dist/components/collection-view-toggle.js +17 -0
- package/dist/components/composer-submit-bridge.d.ts +1 -0
- package/dist/components/composer-submit-bridge.js +15 -0
- package/dist/components/confirm-dialog.d.ts +11 -0
- package/dist/components/confirm-dialog.js +6 -0
- package/dist/components/confirmation-card.d.ts +14 -0
- package/dist/components/confirmation-card.js +12 -0
- package/dist/components/context-badges.d.ts +16 -0
- package/dist/components/context-badges.js +56 -0
- package/dist/components/context-bar.d.ts +41 -0
- package/dist/components/context-bar.js +123 -0
- package/dist/components/form-dialog.d.ts +12 -0
- package/dist/components/form-dialog.js +13 -0
- package/dist/components/global-selection-popover.d.ts +7 -0
- package/dist/components/global-selection-popover.js +167 -0
- package/dist/components/infinite-scroll-sentinel.d.ts +6 -0
- package/dist/components/infinite-scroll-sentinel.js +25 -0
- package/dist/components/json-viewer.d.ts +10 -0
- package/dist/components/json-viewer.js +80 -0
- package/dist/components/loading-indicator.d.ts +13 -0
- package/dist/components/loading-indicator.js +35 -0
- package/dist/components/markdown-text.d.ts +13 -0
- package/dist/components/markdown-text.js +221 -0
- package/dist/components/message-error.d.ts +10 -0
- package/dist/components/message-error.js +10 -0
- package/dist/components/message-timestamp.d.ts +10 -0
- package/dist/components/message-timestamp.js +18 -0
- package/dist/components/name-dialog.d.ts +16 -0
- package/dist/components/name-dialog.js +23 -0
- package/dist/components/selection-popover.d.ts +12 -0
- package/dist/components/selection-popover.js +111 -0
- package/dist/components/show-document-tool-ui.d.ts +1 -0
- package/dist/components/show-document-tool-ui.js +53 -0
- package/dist/components/sidebar.d.ts +4 -0
- package/dist/components/sidebar.js +904 -0
- package/dist/components/surface-card.d.ts +9 -0
- package/dist/components/surface-card.js +33 -0
- package/dist/components/theme-runtime-provider.d.ts +15 -0
- package/dist/components/theme-runtime-provider.js +48 -0
- package/dist/components/theme-toggle.d.ts +2 -0
- package/dist/components/theme-toggle.js +19 -0
- package/dist/components/tool-call-card.d.ts +27 -0
- package/dist/components/tool-call-card.js +13 -0
- package/dist/components/tool-fallback.d.ts +26 -0
- package/dist/components/tool-fallback.js +129 -0
- package/dist/components/tool-panel-layout.d.ts +10 -0
- package/dist/components/tool-panel-layout.js +12 -0
- package/dist/components/tool-panel.d.ts +1 -0
- package/dist/components/tool-panel.js +89 -0
- package/dist/components/tooltip-icon-button.d.ts +7 -0
- package/dist/components/tooltip-icon-button.js +9 -0
- package/dist/components/user-menu.d.ts +2 -0
- package/dist/components/user-menu.js +14 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +83 -0
- package/dist/lib/ag-ui-adapter.d.ts +29 -0
- package/dist/lib/ag-ui-adapter.js +382 -0
- package/dist/lib/app-store.d.ts +115 -0
- package/dist/lib/app-store.js +199 -0
- package/dist/lib/attachment-adapter.d.ts +20 -0
- package/dist/lib/attachment-adapter.js +99 -0
- package/dist/lib/auth-provider.d.ts +16 -0
- package/dist/lib/auth-provider.js +88 -0
- package/dist/lib/chat-bubble-store.d.ts +30 -0
- package/dist/lib/chat-bubble-store.js +23 -0
- package/dist/lib/chat-lifecycle-store.d.ts +10 -0
- package/{src/lib/chat-lifecycle-store.ts → dist/lib/chat-lifecycle-store.js} +3 -13
- package/dist/lib/client-tools.d.ts +11 -0
- package/dist/lib/client-tools.js +274 -0
- package/dist/lib/composer-submit-store.d.ts +12 -0
- package/dist/lib/composer-submit-store.js +17 -0
- package/dist/lib/dev-store.d.ts +38 -0
- package/dist/lib/dev-store.js +32 -0
- package/dist/lib/nav-config.d.ts +159 -0
- package/dist/lib/nav-config.js +162 -0
- package/dist/lib/nav-dnd.d.ts +8 -0
- package/dist/lib/nav-dnd.js +9 -0
- package/dist/lib/nav-store.d.ts +45 -0
- package/dist/lib/nav-store.js +49 -0
- package/dist/lib/selection-context.d.ts +21 -0
- package/dist/lib/selection-context.js +34 -0
- package/dist/lib/sidebar-store.d.ts +23 -0
- package/dist/lib/sidebar-store.js +98 -0
- package/dist/lib/theme-runtime.d.ts +130 -0
- package/dist/lib/theme-runtime.js +479 -0
- package/dist/lib/theme-store.d.ts +15 -0
- package/dist/lib/theme-store.js +53 -0
- package/dist/lib/tool-panel-store.d.ts +48 -0
- package/dist/lib/tool-panel-store.js +69 -0
- package/dist/lib/use-new-conversation.d.ts +8 -0
- package/dist/lib/use-new-conversation.js +62 -0
- package/dist/lib/use-page-tools.d.ts +27 -0
- package/{src/lib/use-page-tools.ts → dist/lib/use-page-tools.js} +11 -13
- package/dist/styles.css +142 -0
- package/dist/ui/collapsible.d.ts +5 -0
- package/{src/ui/collapsible.tsx → dist/ui/collapsible.js} +0 -2
- package/dist/ui/dialog.d.ts +15 -0
- package/dist/ui/dialog.js +25 -0
- package/dist/ui/dropdown-menu.d.ts +7 -0
- package/dist/ui/dropdown-menu.js +19 -0
- package/dist/ui/popover.d.ts +7 -0
- package/dist/ui/popover.js +10 -0
- package/dist/ui/select.d.ts +4 -0
- package/dist/ui/select.js +9 -0
- package/dist/ui/tooltip.d.ts +7 -0
- package/dist/ui/tooltip.js +10 -0
- package/package.json +31 -12
- package/AGENTS.md +0 -59
- package/CHANGELOG.md +0 -211
- package/CLAUDE.md +0 -1
- package/src/__tests__/no-spaces-imports.test.ts +0 -59
- package/src/__tests__/open-core-guards.test.ts +0 -307
- package/src/__tests__/theme-runtime.test.ts +0 -81
- package/src/__tests__/tool-fallback.test.tsx +0 -109
- package/src/components/__tests__/context-bar.test.ts +0 -112
- package/src/components/ag-ui-runtime-provider.tsx +0 -170
- package/src/components/app-brand.tsx +0 -38
- package/src/components/assistant-chat.tsx +0 -461
- package/src/components/chat-attachments.tsx +0 -68
- package/src/components/chat-bubble.tsx +0 -373
- package/src/components/chat-header.tsx +0 -44
- package/src/components/client-tool-executor.tsx +0 -230
- package/src/components/collection-empty-state.tsx +0 -37
- package/src/components/collection-filter-bar.tsx +0 -168
- package/src/components/collection-search-input.tsx +0 -41
- package/src/components/collection-skeleton.tsx +0 -55
- package/src/components/collection-sort-menu.tsx +0 -62
- package/src/components/collection-surface.tsx +0 -46
- package/src/components/collection-toolbar.tsx +0 -33
- package/src/components/collection-view-toggle.tsx +0 -61
- package/src/components/composer-submit-bridge.tsx +0 -19
- package/src/components/confirm-dialog.tsx +0 -49
- package/src/components/confirmation-card.tsx +0 -32
- package/src/components/context-badges.tsx +0 -136
- package/src/components/context-bar.tsx +0 -238
- package/src/components/form-dialog.tsx +0 -56
- package/src/components/global-selection-popover.tsx +0 -266
- package/src/components/infinite-scroll-sentinel.tsx +0 -48
- package/src/components/json-viewer.tsx +0 -232
- package/src/components/loading-indicator.tsx +0 -40
- package/src/components/markdown-text-citations.test.tsx +0 -108
- package/src/components/markdown-text.tsx +0 -508
- package/src/components/name-dialog.tsx +0 -87
- package/src/components/selection-popover.tsx +0 -156
- package/src/components/show-document-tool-ui.tsx +0 -90
- package/src/components/sidebar.test.tsx +0 -611
- package/src/components/sidebar.tsx +0 -1689
- package/src/components/surface-card.tsx +0 -45
- package/src/components/theme-runtime-provider.tsx +0 -93
- package/src/components/theme-toggle.tsx +0 -27
- package/src/components/tool-call-card.tsx +0 -126
- package/src/components/tool-fallback.tsx +0 -169
- package/src/components/tool-panel-layout.tsx +0 -36
- package/src/components/tool-panel.tsx +0 -233
- package/src/components/tooltip-icon-button.tsx +0 -28
- package/src/components/user-menu.tsx +0 -60
- package/src/index.ts +0 -185
- package/src/lib/__tests__/ag-ui-adapter.test.ts +0 -279
- package/src/lib/__tests__/app-store.test.ts +0 -405
- package/src/lib/__tests__/attachment-adapter.test.ts +0 -48
- package/src/lib/__tests__/chat-bubble-store.test.ts +0 -67
- package/src/lib/__tests__/client-tools.test.ts +0 -124
- package/src/lib/__tests__/dev-store.test.ts +0 -78
- package/src/lib/__tests__/nav-config.test.ts +0 -135
- package/src/lib/__tests__/nav-dnd.test.ts +0 -24
- package/src/lib/__tests__/nav-store.test.ts +0 -59
- package/src/lib/__tests__/selection-context.test.ts +0 -114
- package/src/lib/__tests__/sidebar-store.test.ts +0 -144
- package/src/lib/__tests__/theme-store.test.ts +0 -83
- package/src/lib/__tests__/tool-panel-store.test.ts +0 -61
- package/src/lib/__tests__/use-page-context.test.ts +0 -58
- package/src/lib/ag-ui-adapter.ts +0 -426
- package/src/lib/app-store.ts +0 -361
- package/src/lib/attachment-adapter.ts +0 -92
- package/src/lib/auth-provider.tsx +0 -144
- package/src/lib/chat-bubble-store.ts +0 -46
- package/src/lib/client-tools.ts +0 -293
- package/src/lib/composer-submit-store.ts +0 -32
- package/src/lib/dev-store.ts +0 -69
- package/src/lib/nav-config.ts +0 -329
- package/src/lib/nav-dnd.ts +0 -14
- package/src/lib/nav-store.ts +0 -89
- package/src/lib/selection-context.ts +0 -65
- package/src/lib/sidebar-store.ts +0 -113
- package/src/lib/theme-runtime.ts +0 -660
- package/src/lib/theme-store.ts +0 -67
- package/src/lib/tool-panel-store.ts +0 -121
- package/src/lib/use-new-conversation.test.tsx +0 -168
- package/src/lib/use-new-conversation.ts +0 -64
- package/src/ui/dialog.tsx +0 -109
- package/src/ui/dropdown-menu.tsx +0 -75
- package/src/ui/popover.tsx +0 -34
- package/src/ui/select.tsx +0 -15
- package/src/ui/tooltip.tsx +0 -30
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -16
- package/vitest.config.ts +0 -8
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useState, Suspense } from "react";
|
|
2
|
-
import { X, Maximize2, Minimize2, Copy, Check, Pin, PinOff, FolderOpen } from "lucide-react";
|
|
3
|
-
import { useNavigate } from "react-router";
|
|
4
|
-
import { cn } from "@iloveagents/foundry-web-primitives";
|
|
5
|
-
import { useToolPanelStore, type ToolPanelContent } from "../lib/tool-panel-store.ts";
|
|
6
|
-
import { useAppStore } from "../lib/app-store.ts";
|
|
7
|
-
import ReactMarkdown from "react-markdown";
|
|
8
|
-
import remarkGfm from "remark-gfm";
|
|
9
|
-
import { markdownComponents } from "./markdown-text.tsx";
|
|
10
|
-
import { SelectionPopover } from "./selection-popover.tsx";
|
|
11
|
-
|
|
12
|
-
/** Renders panel content using the renderer registry, then built-in markdown/text. */
|
|
13
|
-
function PanelContentRenderer({ content }: { content: ToolPanelContent }) {
|
|
14
|
-
const renderers = useToolPanelStore((s) => s.renderers);
|
|
15
|
-
|
|
16
|
-
// Check registered renderers first (e.g., PDF viewer, entity pages, demo pages)
|
|
17
|
-
const customRenderer = renderers.find((r) => r.match(content));
|
|
18
|
-
if (customRenderer) {
|
|
19
|
-
const Component = customRenderer.component;
|
|
20
|
-
return (
|
|
21
|
-
<Suspense fallback={null}>
|
|
22
|
-
<Component content={content} />
|
|
23
|
-
</Suspense>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Built-in markdown / text rendering
|
|
28
|
-
return (
|
|
29
|
-
<div className="px-6 py-4">
|
|
30
|
-
{content.type === "markdown" ? (
|
|
31
|
-
<div className="max-w-2xl mx-auto">
|
|
32
|
-
<ReactMarkdown remarkPlugins={[remarkGfm]} components={markdownComponents}>
|
|
33
|
-
{content.content}
|
|
34
|
-
</ReactMarkdown>
|
|
35
|
-
</div>
|
|
36
|
-
) : (
|
|
37
|
-
<div className="whitespace-pre-wrap text-sm text-foreground max-w-2xl mx-auto">
|
|
38
|
-
{content.content}
|
|
39
|
-
</div>
|
|
40
|
-
)}
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function ToolPanel() {
|
|
46
|
-
const isOpen = useToolPanelStore((state) => state.isOpen);
|
|
47
|
-
const content = useToolPanelStore((state) => state.content);
|
|
48
|
-
const closePanel = useToolPanelStore((state) => state.closePanel);
|
|
49
|
-
const panelWidth = useToolPanelStore((state) => state.panelWidth);
|
|
50
|
-
const isFullscreen = useToolPanelStore((state) => state.isFullscreen);
|
|
51
|
-
const toggleFullscreen = useToolPanelStore((state) => state.toggleFullscreen);
|
|
52
|
-
const navigate = useNavigate();
|
|
53
|
-
const contentRef = useRef<HTMLDivElement>(null);
|
|
54
|
-
const [copied, setCopied] = useState(false);
|
|
55
|
-
|
|
56
|
-
// Pin state for SPACES entities
|
|
57
|
-
const entityId = content?.entityId;
|
|
58
|
-
const contextItems = useAppStore((s) => s.contextItems);
|
|
59
|
-
const addContextItem = useAppStore((s) => s.addContextItem);
|
|
60
|
-
const removeContextItem = useAppStore((s) => s.removeContextItem);
|
|
61
|
-
|
|
62
|
-
const entityPin = entityId
|
|
63
|
-
? contextItems.find(
|
|
64
|
-
(i) =>
|
|
65
|
-
i.persistence === "persistent" &&
|
|
66
|
-
i.type === "page" &&
|
|
67
|
-
i.payload.kind === "page" &&
|
|
68
|
-
(i.payload as { path: string }).path === `/spaces/${entityId}`,
|
|
69
|
-
)
|
|
70
|
-
: null;
|
|
71
|
-
const isEntityPinned = !!entityPin;
|
|
72
|
-
|
|
73
|
-
const handleToggleEntityPin = useCallback(() => {
|
|
74
|
-
if (!entityId || !content) return;
|
|
75
|
-
if (entityPin) {
|
|
76
|
-
removeContextItem(entityPin.id);
|
|
77
|
-
} else {
|
|
78
|
-
addContextItem({
|
|
79
|
-
type: "page",
|
|
80
|
-
label: content.title,
|
|
81
|
-
payload: { kind: "page", path: `/spaces/${entityId}`, label: content.title, meta: {} },
|
|
82
|
-
sourcePage: `/spaces/${entityId}`,
|
|
83
|
-
persistence: "persistent",
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}, [entityId, entityPin, content, addContextItem, removeContextItem]);
|
|
87
|
-
|
|
88
|
-
const handleNavigateToEntity = useCallback(() => {
|
|
89
|
-
if (!entityId || !content) return;
|
|
90
|
-
navigate(content.type === "page" ? content.content : `/spaces/${entityId}`);
|
|
91
|
-
closePanel();
|
|
92
|
-
}, [entityId, content, navigate, closePanel]);
|
|
93
|
-
|
|
94
|
-
const handleCopyAll = useCallback(() => {
|
|
95
|
-
if (!content) return;
|
|
96
|
-
navigator.clipboard.writeText(content.content).then(() => {
|
|
97
|
-
setCopied(true);
|
|
98
|
-
setTimeout(() => setCopied(false), 2000);
|
|
99
|
-
});
|
|
100
|
-
}, [content]);
|
|
101
|
-
|
|
102
|
-
// Close on Escape key
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
const handleEscape = (e: KeyboardEvent) => {
|
|
105
|
-
if (e.key === "Escape" && isOpen) {
|
|
106
|
-
closePanel();
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
window.addEventListener("keydown", handleEscape);
|
|
111
|
-
return () => window.removeEventListener("keydown", handleEscape);
|
|
112
|
-
}, [isOpen, closePanel]);
|
|
113
|
-
|
|
114
|
-
if (!content) return null;
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<div
|
|
118
|
-
data-tool-panel
|
|
119
|
-
className={cn(
|
|
120
|
-
"fixed top-0 right-0 z-40",
|
|
121
|
-
"h-dvh",
|
|
122
|
-
"bg-background border-l border-border shadow-2xl",
|
|
123
|
-
"transition-transform duration-300 ease-in-out",
|
|
124
|
-
"flex flex-col",
|
|
125
|
-
isOpen ? "translate-x-0" : "translate-x-full",
|
|
126
|
-
)}
|
|
127
|
-
style={{ width: panelWidth }}
|
|
128
|
-
>
|
|
129
|
-
{/* Header */}
|
|
130
|
-
<div className="flex-shrink-0 border-b border-border px-6 py-4">
|
|
131
|
-
<div className="flex items-center justify-between">
|
|
132
|
-
<h2 className="text-lg font-semibold text-foreground truncate pr-4">{content.title}</h2>
|
|
133
|
-
<div className="flex items-center gap-1">
|
|
134
|
-
{entityId && (
|
|
135
|
-
<>
|
|
136
|
-
<button
|
|
137
|
-
type="button"
|
|
138
|
-
onClick={handleToggleEntityPin}
|
|
139
|
-
className={cn(
|
|
140
|
-
"flex items-center justify-center",
|
|
141
|
-
"size-8 rounded-md shrink-0",
|
|
142
|
-
"hover:bg-muted transition-colors",
|
|
143
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
144
|
-
isEntityPinned && "text-primary",
|
|
145
|
-
)}
|
|
146
|
-
aria-label={isEntityPinned ? "Unpin document" : "Pin document"}
|
|
147
|
-
title={isEntityPinned ? "Unpin document" : "Pin document"}
|
|
148
|
-
>
|
|
149
|
-
{isEntityPinned ? (
|
|
150
|
-
<PinOff className="size-4" />
|
|
151
|
-
) : (
|
|
152
|
-
<Pin className="size-4 text-muted-foreground" />
|
|
153
|
-
)}
|
|
154
|
-
</button>
|
|
155
|
-
<button
|
|
156
|
-
type="button"
|
|
157
|
-
onClick={handleNavigateToEntity}
|
|
158
|
-
className={cn(
|
|
159
|
-
"flex items-center justify-center",
|
|
160
|
-
"size-8 rounded-md shrink-0",
|
|
161
|
-
"hover:bg-muted transition-colors",
|
|
162
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
163
|
-
)}
|
|
164
|
-
aria-label="Open in navigation"
|
|
165
|
-
title="Open in navigation"
|
|
166
|
-
>
|
|
167
|
-
<FolderOpen className="size-4 text-muted-foreground" />
|
|
168
|
-
</button>
|
|
169
|
-
</>
|
|
170
|
-
)}
|
|
171
|
-
<button
|
|
172
|
-
type="button"
|
|
173
|
-
onClick={handleCopyAll}
|
|
174
|
-
className={cn(
|
|
175
|
-
"flex items-center justify-center",
|
|
176
|
-
"size-8 rounded-md flex-shrink-0",
|
|
177
|
-
"hover:bg-muted transition-colors",
|
|
178
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
179
|
-
)}
|
|
180
|
-
aria-label="Copy content"
|
|
181
|
-
>
|
|
182
|
-
{copied ? (
|
|
183
|
-
<Check className="size-4 text-success" />
|
|
184
|
-
) : (
|
|
185
|
-
<Copy className="size-4 text-muted-foreground" />
|
|
186
|
-
)}
|
|
187
|
-
</button>
|
|
188
|
-
<button
|
|
189
|
-
type="button"
|
|
190
|
-
onClick={toggleFullscreen}
|
|
191
|
-
className={cn(
|
|
192
|
-
"flex items-center justify-center",
|
|
193
|
-
"size-8 rounded-md flex-shrink-0",
|
|
194
|
-
"hover:bg-muted transition-colors",
|
|
195
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
196
|
-
)}
|
|
197
|
-
aria-label={isFullscreen ? "Exit fullscreen" : "Fullscreen"}
|
|
198
|
-
>
|
|
199
|
-
{isFullscreen ? (
|
|
200
|
-
<Minimize2 className="size-4 text-muted-foreground" />
|
|
201
|
-
) : (
|
|
202
|
-
<Maximize2 className="size-4 text-muted-foreground" />
|
|
203
|
-
)}
|
|
204
|
-
</button>
|
|
205
|
-
<button
|
|
206
|
-
type="button"
|
|
207
|
-
onClick={closePanel}
|
|
208
|
-
className={cn(
|
|
209
|
-
"flex items-center justify-center",
|
|
210
|
-
"size-8 rounded-md flex-shrink-0",
|
|
211
|
-
"hover:bg-muted transition-colors",
|
|
212
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
213
|
-
)}
|
|
214
|
-
aria-label="Close panel"
|
|
215
|
-
>
|
|
216
|
-
<X className="size-5 text-muted-foreground" />
|
|
217
|
-
</button>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
{/* Content */}
|
|
223
|
-
<div
|
|
224
|
-
className="relative flex-1 overflow-y-auto"
|
|
225
|
-
ref={contentRef}
|
|
226
|
-
data-testid="tool-panel-content"
|
|
227
|
-
>
|
|
228
|
-
<PanelContentRenderer content={content} />
|
|
229
|
-
<SelectionPopover containerRef={contentRef} />
|
|
230
|
-
</div>
|
|
231
|
-
</div>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type ComponentPropsWithRef, forwardRef } from "react";
|
|
2
|
-
import { Slottable } from "@radix-ui/react-slot";
|
|
3
|
-
|
|
4
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.tsx";
|
|
5
|
-
import { Button } from "@iloveagents/foundry-web-primitives";
|
|
6
|
-
|
|
7
|
-
export type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
|
|
8
|
-
tooltip: string;
|
|
9
|
-
side?: "top" | "bottom" | "left" | "right";
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const TooltipIconButton = forwardRef<HTMLButtonElement, TooltipIconButtonProps>(
|
|
13
|
-
({ children, tooltip, side = "bottom", ...rest }, ref) => {
|
|
14
|
-
return (
|
|
15
|
-
<Tooltip>
|
|
16
|
-
<TooltipTrigger asChild>
|
|
17
|
-
<Button variant="ghost" size="icon" {...rest} ref={ref}>
|
|
18
|
-
<Slottable>{children}</Slottable>
|
|
19
|
-
<span className="sr-only">{tooltip}</span>
|
|
20
|
-
</Button>
|
|
21
|
-
</TooltipTrigger>
|
|
22
|
-
<TooltipContent side={side}>{tooltip}</TooltipContent>
|
|
23
|
-
</Tooltip>
|
|
24
|
-
);
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
TooltipIconButton.displayName = "TooltipIconButton";
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { type FC } from "react";
|
|
2
|
-
import { LogOut, User } from "lucide-react";
|
|
3
|
-
import { useStore } from "zustand";
|
|
4
|
-
import { useShallow } from "zustand/react/shallow";
|
|
5
|
-
import { cn } from "@iloveagents/foundry-web-primitives";
|
|
6
|
-
import { authStore } from "@iloveagents/foundry-agent/msal";
|
|
7
|
-
import {
|
|
8
|
-
DropdownMenu,
|
|
9
|
-
DropdownMenuContent,
|
|
10
|
-
DropdownMenuItem,
|
|
11
|
-
DropdownMenuLabel,
|
|
12
|
-
DropdownMenuSeparator,
|
|
13
|
-
DropdownMenuTrigger,
|
|
14
|
-
} from "../ui/dropdown-menu.tsx";
|
|
15
|
-
import { Button } from "@iloveagents/foundry-web-primitives";
|
|
16
|
-
|
|
17
|
-
export const UserMenu: FC = () => {
|
|
18
|
-
const { user, signOut } = useStore(
|
|
19
|
-
authStore,
|
|
20
|
-
useShallow((s) => ({ user: s.user, signOut: s.signOut })),
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
if (!user) return null;
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<DropdownMenu>
|
|
27
|
-
<DropdownMenuTrigger asChild>
|
|
28
|
-
<Button variant="ghost" size="sm" className="gap-2 rounded-full px-2">
|
|
29
|
-
{user.avatar ? (
|
|
30
|
-
<img src={user.avatar} alt={user.name} className="size-6 rounded-full" />
|
|
31
|
-
) : (
|
|
32
|
-
<div
|
|
33
|
-
className={cn(
|
|
34
|
-
"size-6 rounded-full",
|
|
35
|
-
"bg-primary/10 text-primary",
|
|
36
|
-
"flex items-center justify-center",
|
|
37
|
-
)}
|
|
38
|
-
>
|
|
39
|
-
<User className="size-3.5" />
|
|
40
|
-
</div>
|
|
41
|
-
)}
|
|
42
|
-
<span className="text-xs text-muted-foreground hidden sm:inline">{user.name}</span>
|
|
43
|
-
</Button>
|
|
44
|
-
</DropdownMenuTrigger>
|
|
45
|
-
<DropdownMenuContent align="end" className="w-56">
|
|
46
|
-
<DropdownMenuLabel className="font-normal">
|
|
47
|
-
<div className="flex flex-col gap-0.5">
|
|
48
|
-
<p className="text-sm font-medium">{user.name}</p>
|
|
49
|
-
<p className="text-xs text-muted-foreground">{user.email}</p>
|
|
50
|
-
</div>
|
|
51
|
-
</DropdownMenuLabel>
|
|
52
|
-
<DropdownMenuSeparator />
|
|
53
|
-
<DropdownMenuItem onClick={signOut} className="text-destructive cursor-pointer">
|
|
54
|
-
<LogOut className="size-4" />
|
|
55
|
-
Sign out
|
|
56
|
-
</DropdownMenuItem>
|
|
57
|
-
</DropdownMenuContent>
|
|
58
|
-
</DropdownMenu>
|
|
59
|
-
);
|
|
60
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
// --- Components ---
|
|
2
|
-
export { Sidebar } from "./components/sidebar.tsx";
|
|
3
|
-
export { ToolPanel } from "./components/tool-panel.tsx";
|
|
4
|
-
export { ToolPanelLayout } from "./components/tool-panel-layout.tsx";
|
|
5
|
-
export { MarkdownText, markdownComponents } from "./components/markdown-text.tsx";
|
|
6
|
-
export { ClientToolExecutor } from "./components/client-tool-executor.tsx";
|
|
7
|
-
export { AGUIRuntimeProvider, useAGUIAdapter } from "./components/ag-ui-runtime-provider.tsx";
|
|
8
|
-
export type {
|
|
9
|
-
AGUIChatConversationFactoryArgs,
|
|
10
|
-
AGUIHistoryAdapterFactory,
|
|
11
|
-
} from "./components/ag-ui-runtime-provider.tsx";
|
|
12
|
-
export { ChatContent, DEFAULT_STARTER_SUGGESTIONS } from "./components/assistant-chat.tsx";
|
|
13
|
-
export type { ChatContentProps } from "./components/assistant-chat.tsx";
|
|
14
|
-
export { ChatBubble } from "./components/chat-bubble.tsx";
|
|
15
|
-
export { ChatHeader } from "./components/chat-header.tsx";
|
|
16
|
-
export {
|
|
17
|
-
ComposerAttachment,
|
|
18
|
-
UserMessageAttachment,
|
|
19
|
-
userAttachmentComponents,
|
|
20
|
-
composerAttachmentComponents,
|
|
21
|
-
} from "./components/chat-attachments.tsx";
|
|
22
|
-
export { ShowDocumentToolUI } from "./components/show-document-tool-ui.tsx";
|
|
23
|
-
export { ToolCallCard } from "./components/tool-call-card.tsx";
|
|
24
|
-
export type { ToolCallStatus } from "./components/tool-call-card.tsx";
|
|
25
|
-
export { ToolFallback } from "./components/tool-fallback.tsx";
|
|
26
|
-
export { ConfirmationCard } from "./components/confirmation-card.tsx";
|
|
27
|
-
export { TooltipIconButton } from "./components/tooltip-icon-button.tsx";
|
|
28
|
-
export { ComposerContextBadges, SentContextBadges } from "./components/context-badges.tsx";
|
|
29
|
-
export { ContextPins } from "./components/context-bar.tsx";
|
|
30
|
-
export { SelectionPopover } from "./components/selection-popover.tsx";
|
|
31
|
-
export { GlobalSelectionPopover } from "./components/global-selection-popover.tsx";
|
|
32
|
-
export { LoadingIndicator } from "./components/loading-indicator.tsx";
|
|
33
|
-
export { ThemeToggle } from "./components/theme-toggle.tsx";
|
|
34
|
-
export { AppBrand } from "./components/app-brand.tsx";
|
|
35
|
-
export { CollectionToolbar } from "./components/collection-toolbar.tsx";
|
|
36
|
-
export { CollectionSearchInput } from "./components/collection-search-input.tsx";
|
|
37
|
-
export {
|
|
38
|
-
CollectionFilterBar,
|
|
39
|
-
type CollectionFilterDefinition,
|
|
40
|
-
type CollectionFilterOption,
|
|
41
|
-
type CollectionFilterValue,
|
|
42
|
-
} from "./components/collection-filter-bar.tsx";
|
|
43
|
-
export {
|
|
44
|
-
CollectionSortMenu,
|
|
45
|
-
type CollectionSortOption,
|
|
46
|
-
} from "./components/collection-sort-menu.tsx";
|
|
47
|
-
export {
|
|
48
|
-
CollectionViewToggle,
|
|
49
|
-
type CollectionViewMode,
|
|
50
|
-
} from "./components/collection-view-toggle.tsx";
|
|
51
|
-
export { CollectionEmptyState } from "./components/collection-empty-state.tsx";
|
|
52
|
-
export { CollectionSkeleton } from "./components/collection-skeleton.tsx";
|
|
53
|
-
export { InfiniteScrollSentinel } from "./components/infinite-scroll-sentinel.tsx";
|
|
54
|
-
export { CollectionSurface } from "./components/collection-surface.tsx";
|
|
55
|
-
export {
|
|
56
|
-
ThemeRuntimeProvider,
|
|
57
|
-
ThemeScope,
|
|
58
|
-
ThemeDocumentMetadata,
|
|
59
|
-
useThemeRuntime,
|
|
60
|
-
} from "./components/theme-runtime-provider.tsx";
|
|
61
|
-
export { JsonViewer } from "./components/json-viewer.tsx";
|
|
62
|
-
export { UserMenu } from "./components/user-menu.tsx";
|
|
63
|
-
export { FormDialog } from "./components/form-dialog.tsx";
|
|
64
|
-
export { ConfirmDialog } from "./components/confirm-dialog.tsx";
|
|
65
|
-
export { NameDialog } from "./components/name-dialog.tsx";
|
|
66
|
-
export { SurfaceCard, surfaceCardVariants } from "./components/surface-card.tsx";
|
|
67
|
-
|
|
68
|
-
// --- Composite UI primitives (theme-runtime-coupled — stay here for now) ---
|
|
69
|
-
// Button, Checkbox, Input, Textarea, Field, FieldSet have moved to
|
|
70
|
-
// @iloveagents/foundry-web-primitives (#94). The primitives below have a runtime
|
|
71
|
-
// coupling to ThemeScope (theme-runtime-provider.tsx) — they need a
|
|
72
|
-
// theme-system refactor before they can move to the leaf primitives
|
|
73
|
-
// package. Tracked for a follow-up under #95/#96.
|
|
74
|
-
export {
|
|
75
|
-
Tooltip,
|
|
76
|
-
TooltipTrigger,
|
|
77
|
-
TooltipContent,
|
|
78
|
-
TooltipProvider,
|
|
79
|
-
} from "./ui/tooltip.tsx";
|
|
80
|
-
export {
|
|
81
|
-
Collapsible,
|
|
82
|
-
CollapsibleTrigger,
|
|
83
|
-
CollapsibleContent,
|
|
84
|
-
} from "./ui/collapsible.tsx";
|
|
85
|
-
export {
|
|
86
|
-
DropdownMenu,
|
|
87
|
-
DropdownMenuTrigger,
|
|
88
|
-
DropdownMenuContent,
|
|
89
|
-
DropdownMenuItem,
|
|
90
|
-
DropdownMenuSeparator,
|
|
91
|
-
DropdownMenuLabel,
|
|
92
|
-
} from "./ui/dropdown-menu.tsx";
|
|
93
|
-
export {
|
|
94
|
-
Dialog,
|
|
95
|
-
DialogPortal,
|
|
96
|
-
DialogOverlay,
|
|
97
|
-
DialogTrigger,
|
|
98
|
-
DialogClose,
|
|
99
|
-
DialogContent,
|
|
100
|
-
DialogHeader,
|
|
101
|
-
DialogFooter,
|
|
102
|
-
DialogTitle,
|
|
103
|
-
DialogDescription,
|
|
104
|
-
} from "./ui/dialog.tsx";
|
|
105
|
-
export { Popover, PopoverTrigger, PopoverAnchor, PopoverContent } from "./ui/popover.tsx";
|
|
106
|
-
export { Select, selectClassName } from "./ui/select.tsx";
|
|
107
|
-
|
|
108
|
-
// --- Stores ---
|
|
109
|
-
export { useAppStore } from "./lib/app-store.ts";
|
|
110
|
-
export { useNavStore, type NavFooterAction } from "./lib/nav-store.ts";
|
|
111
|
-
export { useToolPanelStore } from "./lib/tool-panel-store.ts";
|
|
112
|
-
export type {
|
|
113
|
-
ToolPanelContent,
|
|
114
|
-
PdfHighlightRef,
|
|
115
|
-
PanelRendererEntry,
|
|
116
|
-
} from "./lib/tool-panel-store.ts";
|
|
117
|
-
export { useSidebarStore, SIDEBAR_WIDTH, RAIL_WIDTH } from "./lib/sidebar-store.ts";
|
|
118
|
-
export { useChatBubbleStore } from "./lib/chat-bubble-store.ts";
|
|
119
|
-
export { useChatLifecycleStore } from "./lib/chat-lifecycle-store.ts";
|
|
120
|
-
export { submitComposerText } from "./lib/composer-submit-store.ts";
|
|
121
|
-
export {
|
|
122
|
-
registerSelectionContextResolver,
|
|
123
|
-
resolveSelectionContext,
|
|
124
|
-
type SelectionContextInput,
|
|
125
|
-
type SelectionContextItem,
|
|
126
|
-
type SelectionContextResolver,
|
|
127
|
-
type SelectionContextResult,
|
|
128
|
-
} from "./lib/selection-context.ts";
|
|
129
|
-
export { useThemeStore } from "./lib/theme-store.ts";
|
|
130
|
-
export type { ThemeMode } from "./lib/theme-store.ts";
|
|
131
|
-
export {
|
|
132
|
-
mergeThemeDefinitions,
|
|
133
|
-
resolveThemeRuntime,
|
|
134
|
-
getEffectiveThemeMode,
|
|
135
|
-
getThemePreset,
|
|
136
|
-
} from "./lib/theme-runtime.ts";
|
|
137
|
-
export type {
|
|
138
|
-
ThemeDefinition,
|
|
139
|
-
ThemeLayer,
|
|
140
|
-
ResolvedThemeRuntime,
|
|
141
|
-
ThemeColorSlots,
|
|
142
|
-
ThemeSidebarSlots,
|
|
143
|
-
ThemeStatusSlots,
|
|
144
|
-
ThemeChartSlots,
|
|
145
|
-
ThemeTypographySlots,
|
|
146
|
-
ThemeRadiusSlots,
|
|
147
|
-
ThemeAppSlots,
|
|
148
|
-
ThemeBranding,
|
|
149
|
-
} from "./lib/theme-runtime.ts";
|
|
150
|
-
// Stores moved to @iloveagents/foundry-agent (#95): authStore, citationStore,
|
|
151
|
-
// streamingStatusStore, clientToolRegistry. Consumers import directly from
|
|
152
|
-
// `@iloveagents/foundry-agent` / `@iloveagents/foundry-agent/msal` — no re-exports here per
|
|
153
|
-
// the no-shim rule.
|
|
154
|
-
export { useDevStore } from "./lib/dev-store.ts";
|
|
155
|
-
|
|
156
|
-
// --- Nav types ---
|
|
157
|
-
export { DEFAULT_NAV_CONFIG, findNavItem } from "./lib/nav-config.ts";
|
|
158
|
-
export type {
|
|
159
|
-
NavItem,
|
|
160
|
-
NavItemAction,
|
|
161
|
-
NavItemDnd,
|
|
162
|
-
NavGroup,
|
|
163
|
-
NavGroupCreateAction,
|
|
164
|
-
NavMatch,
|
|
165
|
-
CollapsedRailItem,
|
|
166
|
-
CollapsedRailContext,
|
|
167
|
-
} from "./lib/nav-config.ts";
|
|
168
|
-
|
|
169
|
-
// --- Hooks ---
|
|
170
|
-
export { usePageTools } from "./lib/use-page-tools.ts";
|
|
171
|
-
export { useNewConversation } from "./lib/use-new-conversation.ts";
|
|
172
|
-
|
|
173
|
-
// --- Adapters ---
|
|
174
|
-
export { AGUIAdapterSDK } from "./lib/ag-ui-adapter.ts";
|
|
175
|
-
export { FileAttachmentAdapter } from "./lib/attachment-adapter.ts";
|
|
176
|
-
|
|
177
|
-
// --- Auth ---
|
|
178
|
-
// `AuthProvider` is the React MSAL bootstrap (uses `@azure/msal-react`).
|
|
179
|
-
// Token store, config, fetch wrapper all live in `@iloveagents/foundry-agent/msal`.
|
|
180
|
-
export { AuthProvider } from "./lib/auth-provider.tsx";
|
|
181
|
-
|
|
182
|
-
// --- Utils ---
|
|
183
|
-
// `cn` is sourced from @iloveagents/foundry-web-primitives (the leaf primitives package).
|
|
184
|
-
// Re-exporting here would create two canonical sources for the same
|
|
185
|
-
// utility — banned per the "no shims" pre-1.0 rule (#90).
|