@datalayer/agent-runtimes 0.0.9 → 0.0.10
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 +2 -1
- package/lib/{examples/components → components}/AgentConfiguration.d.ts +27 -12
- package/lib/{examples/components → components}/AgentConfiguration.js +170 -22
- package/lib/{examples/components → components}/FooterMetrics.d.ts +1 -2
- package/lib/{examples/components → components}/Header.d.ts +1 -6
- package/lib/{examples/components → components}/Header.js +5 -39
- package/lib/{examples/components → components}/HeaderControls.d.ts +1 -2
- package/lib/{examples/components → components}/HeaderControls.js +1 -1
- package/lib/{examples/components → components}/LexicalEditor.d.ts +2 -3
- package/lib/{examples/components → components}/LexicalEditor.js +2 -2
- package/lib/components/MainContent.d.ts +34 -0
- package/lib/{examples/components → components}/MainContent.js +18 -9
- package/lib/components/McpServerManager.d.ts +30 -0
- package/lib/components/McpServerManager.js +331 -0
- package/lib/{examples/components → components}/MockFileBrowser.d.ts +1 -2
- package/lib/{examples/components → components}/SessionTabs.d.ts +2 -3
- package/lib/{examples/components → components}/TimeTravel.d.ts +1 -2
- package/lib/components/chat/components/AgentDetails.d.ts +3 -1
- package/lib/components/chat/components/AgentDetails.js +323 -31
- package/lib/components/chat/components/Chat.d.ts +37 -3
- package/lib/components/chat/components/Chat.js +29 -10
- package/lib/components/chat/components/ChatFloating.d.ts +27 -2
- package/lib/components/chat/components/ChatFloating.js +17 -10
- package/lib/components/chat/components/ChatPopupStandalone.js +1 -1
- package/lib/components/chat/components/ChatSidebar.d.ts +1 -1
- package/lib/components/chat/components/ChatStandalone.d.ts +1 -1
- package/lib/components/chat/components/ChatStandalone.js +1 -1
- package/lib/components/chat/components/ContextDistribution.d.ts +70 -6
- package/lib/components/chat/components/ContextDistribution.js +11 -4
- package/lib/components/chat/components/ContextInspector.d.ts +81 -0
- package/lib/components/chat/components/ContextInspector.js +261 -0
- package/lib/components/chat/components/ContextPanel.d.ts +112 -0
- package/lib/components/chat/components/ContextPanel.js +373 -0
- package/lib/components/chat/components/base/ChatBase.d.ts +74 -19
- package/lib/components/chat/components/base/ChatBase.js +296 -37
- package/lib/components/chat/components/index.d.ts +3 -1
- package/lib/components/chat/components/index.js +2 -0
- package/lib/components/chat/extensions/ExtensionRegistry.d.ts +1 -1
- package/lib/components/chat/extensions/index.d.ts +1 -0
- package/lib/components/chat/index.d.ts +3 -3
- package/lib/components/chat/protocols/AGUIAdapter.js +24 -4
- package/lib/components/chat/protocols/VercelAIAdapter.js +35 -1
- package/lib/components/chat/store/chatStore.d.ts +2 -3
- package/lib/components/chat/store/conversationStore.d.ts +83 -0
- package/lib/components/chat/store/conversationStore.js +174 -0
- package/lib/components/chat/store/index.d.ts +2 -1
- package/lib/components/chat/store/index.js +1 -0
- package/lib/components/chat/types/inference.d.ts +17 -0
- package/lib/components/chat/types/protocol.d.ts +10 -0
- package/lib/components/index.d.ts +23 -0
- package/lib/components/index.js +11 -0
- package/lib/config/agents.d.ts +33 -0
- package/lib/config/agents.js +424 -0
- package/lib/config/index.d.ts +4 -0
- package/lib/config/index.js +8 -0
- package/lib/config/mcpServers.d.ts +18 -0
- package/lib/config/mcpServers.js +129 -0
- package/lib/config/skills.d.ts +25 -0
- package/lib/config/skills.js +54 -0
- package/lib/{lib → config}/utils.d.ts +1 -1
- package/lib/{lib → config}/utils.js +2 -2
- package/lib/examples/AgentRuntimeLexical2Example.d.ts +1 -0
- package/lib/examples/AgentRuntimeLexical2Example.js +3 -2
- package/lib/examples/AgentRuntimeLexicalExample.d.ts +1 -0
- package/lib/examples/AgentRuntimeLexicalExample.js +5 -3
- package/lib/examples/AgentRuntimeLexicalSidebarExample.d.ts +1 -0
- package/lib/examples/AgentRuntimeLexicalSidebarExample.js +3 -3
- package/lib/examples/AgentRuntimeNotebookExample.js +1 -1
- package/lib/examples/AgentSpaceFormExample.d.ts +2 -2
- package/lib/examples/AgentSpaceFormExample.js +167 -29
- package/lib/examples/CopilotKitLexicalExample.d.ts +1 -0
- package/lib/examples/CopilotKitLexicalExample.js +3 -2
- package/lib/examples/index.d.ts +1 -0
- package/lib/examples/stores/notebooks/NotebookExample2.ipynb.json +43 -43
- package/lib/hooks/useAGUI.d.ts +1 -1
- package/lib/hooks/useAGUI.js +1 -1
- package/lib/identity/types.d.ts +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/runtime/index.d.ts +3 -0
- package/lib/runtime/runtimeStore.d.ts +3 -4
- package/lib/runtime/useAgentConnection.d.ts +2 -3
- package/lib/runtime/useAgentRuntime.d.ts +2 -3
- package/lib/stories/Cell.stories.js +1 -1
- package/lib/tools/adapters/agent-runtimes/notebookHooks.js +1 -0
- package/lib/tools/adapters/copilotkit/notebookHooks.js +1 -0
- package/lib/types.d.ts +150 -0
- package/package.json +4 -5
- package/scripts/apply-patches.sh +1 -1
- package/scripts/codegen/generate_agents.py +452 -0
- package/scripts/codegen/generate_mcp_servers.py +424 -0
- package/scripts/codegen/generate_skills.py +321 -0
- package/scripts/download-ai-elements.py +35 -20
- package/scripts/sync-jupyter.sh +6 -0
- package/lib/components/ui/accordion.d.ts +0 -7
- package/lib/components/ui/accordion.js +0 -22
- package/lib/components/ui/alert-dialog.d.ts +0 -14
- package/lib/components/ui/alert-dialog.js +0 -43
- package/lib/components/ui/alert.d.ts +0 -9
- package/lib/components/ui/alert.js +0 -24
- package/lib/components/ui/aspect-ratio.d.ts +0 -3
- package/lib/components/ui/aspect-ratio.js +0 -11
- package/lib/components/ui/avatar.d.ts +0 -6
- package/lib/components/ui/avatar.js +0 -18
- package/lib/components/ui/badge.d.ts +0 -9
- package/lib/components/ui/badge.js +0 -22
- package/lib/components/ui/breadcrumb.d.ts +0 -11
- package/lib/components/ui/breadcrumb.js +0 -27
- package/lib/components/ui/button-group.d.ts +0 -11
- package/lib/components/ui/button-group.js +0 -31
- package/lib/components/ui/button.d.ts +0 -13
- package/lib/components/ui/button.js +0 -39
- package/lib/components/ui/calendar.d.ts +0 -8
- package/lib/components/ui/calendar.js +0 -80
- package/lib/components/ui/card.d.ts +0 -9
- package/lib/components/ui/card.js +0 -24
- package/lib/components/ui/carousel.d.ts +0 -19
- package/lib/components/ui/carousel.js +0 -95
- package/lib/components/ui/chart.d.ts +0 -53
- package/lib/components/ui/chart.js +0 -136
- package/lib/components/ui/checkbox.d.ts +0 -4
- package/lib/components/ui/checkbox.js +0 -13
- package/lib/components/ui/collapsible.d.ts +0 -5
- package/lib/components/ui/collapsible.js +0 -17
- package/lib/components/ui/command.d.ts +0 -18
- package/lib/components/ui/command.js +0 -38
- package/lib/components/ui/context-menu.d.ts +0 -25
- package/lib/components/ui/context-menu.js +0 -55
- package/lib/components/ui/dialog.d.ts +0 -15
- package/lib/components/ui/dialog.js +0 -40
- package/lib/components/ui/drawer.d.ts +0 -13
- package/lib/components/ui/drawer.js +0 -39
- package/lib/components/ui/dropdown-menu.d.ts +0 -25
- package/lib/components/ui/dropdown-menu.js +0 -55
- package/lib/components/ui/empty.d.ts +0 -11
- package/lib/components/ui/empty.js +0 -37
- package/lib/components/ui/field.d.ts +0 -24
- package/lib/components/ui/field.js +0 -80
- package/lib/components/ui/form.d.ts +0 -24
- package/lib/components/ui/form.js +0 -63
- package/lib/components/ui/hover-card.d.ts +0 -6
- package/lib/components/ui/hover-card.js +0 -18
- package/lib/components/ui/input-group.d.ts +0 -19
- package/lib/components/ui/input-group.js +0 -69
- package/lib/components/ui/input-otp.d.ts +0 -11
- package/lib/components/ui/input-otp.js +0 -25
- package/lib/components/ui/input.d.ts +0 -3
- package/lib/components/ui/input.js +0 -6
- package/lib/components/ui/item.d.ts +0 -23
- package/lib/components/ui/item.js +0 -66
- package/lib/components/ui/kbd.d.ts +0 -3
- package/lib/components/ui/kbd.js +0 -13
- package/lib/components/ui/label.d.ts +0 -4
- package/lib/components/ui/label.js +0 -12
- package/lib/components/ui/menubar.d.ts +0 -26
- package/lib/components/ui/menubar.js +0 -58
- package/lib/components/ui/navigation-menu.d.ts +0 -14
- package/lib/components/ui/navigation-menu.js +0 -31
- package/lib/components/ui/pagination.d.ts +0 -13
- package/lib/components/ui/pagination.js +0 -29
- package/lib/components/ui/popover.d.ts +0 -7
- package/lib/components/ui/popover.js +0 -21
- package/lib/components/ui/progress.d.ts +0 -4
- package/lib/components/ui/progress.js +0 -12
- package/lib/components/ui/radio-group.d.ts +0 -5
- package/lib/components/ui/radio-group.js +0 -16
- package/lib/components/ui/resizable.d.ts +0 -8
- package/lib/components/ui/resizable.js +0 -19
- package/lib/components/ui/scroll-area.d.ts +0 -5
- package/lib/components/ui/scroll-area.js +0 -17
- package/lib/components/ui/select.d.ts +0 -15
- package/lib/components/ui/select.js +0 -42
- package/lib/components/ui/separator.d.ts +0 -4
- package/lib/components/ui/separator.js +0 -12
- package/lib/components/ui/sheet.d.ts +0 -13
- package/lib/components/ui/sheet.js +0 -44
- package/lib/components/ui/sidebar.d.ts +0 -69
- package/lib/components/ui/sidebar.js +0 -216
- package/lib/components/ui/skeleton.d.ts +0 -2
- package/lib/components/ui/skeleton.js +0 -10
- package/lib/components/ui/slider.d.ts +0 -4
- package/lib/components/ui/slider.js +0 -18
- package/lib/components/ui/sonner.d.ts +0 -3
- package/lib/components/ui/sonner.js +0 -25
- package/lib/components/ui/spinner.d.ts +0 -2
- package/lib/components/ui/spinner.js +0 -11
- package/lib/components/ui/switch.d.ts +0 -4
- package/lib/components/ui/switch.js +0 -12
- package/lib/components/ui/table.d.ts +0 -10
- package/lib/components/ui/table.js +0 -32
- package/lib/components/ui/tabs.d.ts +0 -7
- package/lib/components/ui/tabs.js +0 -21
- package/lib/components/ui/textarea.d.ts +0 -3
- package/lib/components/ui/textarea.js +0 -6
- package/lib/components/ui/toast.d.ts +0 -15
- package/lib/components/ui/toast.js +0 -38
- package/lib/components/ui/toaster.d.ts +0 -1
- package/lib/components/ui/toaster.js +0 -14
- package/lib/components/ui/toggle-group.d.ts +0 -9
- package/lib/components/ui/toggle-group.js +0 -26
- package/lib/components/ui/toggle.d.ts +0 -9
- package/lib/components/ui/toggle.js +0 -30
- package/lib/components/ui/tooltip.d.ts +0 -7
- package/lib/components/ui/tooltip.js +0 -21
- package/lib/components/vercel-ai-elements/artifact.d.ts +0 -23
- package/lib/components/vercel-ai-elements/artifact.js +0 -24
- package/lib/components/vercel-ai-elements/code-block.d.ts +0 -17
- package/lib/components/vercel-ai-elements/code-block.js +0 -94
- package/lib/components/vercel-ai-elements/conversation.d.ts +0 -15
- package/lib/components/vercel-ai-elements/conversation.js +0 -21
- package/lib/components/vercel-ai-elements/loader.d.ts +0 -5
- package/lib/components/vercel-ai-elements/loader.js +0 -8
- package/lib/components/vercel-ai-elements/message.d.ts +0 -46
- package/lib/components/vercel-ai-elements/message.js +0 -109
- package/lib/components/vercel-ai-elements/model-selector.d.ts +0 -35
- package/lib/components/vercel-ai-elements/model-selector.js +0 -22
- package/lib/components/vercel-ai-elements/prompt-input.d.ts +0 -195
- package/lib/components/vercel-ai-elements/prompt-input.js +0 -589
- package/lib/components/vercel-ai-elements/reasoning.d.ts +0 -26
- package/lib/components/vercel-ai-elements/reasoning.js +0 -80
- package/lib/components/vercel-ai-elements/shimmer.d.ts +0 -9
- package/lib/components/vercel-ai-elements/shimmer.js +0 -22
- package/lib/components/vercel-ai-elements/sources.d.ts +0 -12
- package/lib/components/vercel-ai-elements/sources.js +0 -13
- package/lib/components/vercel-ai-elements/suggestion.d.ts +0 -10
- package/lib/components/vercel-ai-elements/suggestion.js +0 -16
- package/lib/components/vercel-ai-elements/tool.d.ts +0 -23
- package/lib/components/vercel-ai-elements/tool.js +0 -52
- package/lib/examples/components/MainContent.d.ts +0 -19
- package/lib/examples/components/index.d.ts +0 -10
- package/lib/examples/components/index.js +0 -13
- package/lib/examples/vercel-ai-elements/VercelAiElementsShowcase.d.ts +0 -12
- package/lib/examples/vercel-ai-elements/VercelAiElementsShowcase.js +0 -69
- package/lib/examples/vercel-ai-elements/components/ArtifactShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ArtifactShowcase.js +0 -85
- package/lib/examples/vercel-ai-elements/components/CodeBlockShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/CodeBlockShowcase.js +0 -62
- package/lib/examples/vercel-ai-elements/components/ConversationShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ConversationShowcase.js +0 -51
- package/lib/examples/vercel-ai-elements/components/LoaderShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/LoaderShowcase.js +0 -9
- package/lib/examples/vercel-ai-elements/components/MessageShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/MessageShowcase.js +0 -56
- package/lib/examples/vercel-ai-elements/components/ModelSelectorShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ModelSelectorShowcase.js +0 -50
- package/lib/examples/vercel-ai-elements/components/PromptInputShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/PromptInputShowcase.js +0 -16
- package/lib/examples/vercel-ai-elements/components/ReasoningShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ReasoningShowcase.js +0 -72
- package/lib/examples/vercel-ai-elements/components/ShimmerShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ShimmerShowcase.js +0 -9
- package/lib/examples/vercel-ai-elements/components/SourcesShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/SourcesShowcase.js +0 -43
- package/lib/examples/vercel-ai-elements/components/SuggestionShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/SuggestionShowcase.js +0 -31
- package/lib/examples/vercel-ai-elements/components/ToolShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ToolShowcase.js +0 -54
- package/lib/examples/vercel-ai-elements/index.d.ts +0 -13
- package/lib/examples/vercel-ai-elements/index.js +0 -17
- package/lib/examples/vercel-ai-elements/main.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/main.js +0 -9
- package/lib/examples/vercel-ai-elements/showcase.css +0 -128
- package/lib/hooks/useToast.d.ts +0 -44
- package/lib/hooks/useToast.js +0 -128
- package/patches/@datalayer+jupyter-lexical+1.0.8.patch +0 -11628
- package/patches/@datalayer+jupyter-react+2.0.2.patch +0 -5338
- package/style/showcase-vercel-ai.css +0 -137
- /package/lib/{examples/components → components}/FooterMetrics.js +0 -0
- /package/lib/{examples/components → components}/MockFileBrowser.js +0 -0
- /package/lib/{examples/components → components}/SessionTabs.js +0 -0
- /package/lib/{examples/components → components}/TimeTravel.js +0 -0
- /package/lib/{models → types}/AIAgent.d.ts +0 -0
- /package/lib/{models → types}/AIAgent.js +0 -0
- /package/lib/{models → types}/index.d.ts +0 -0
- /package/lib/{models → types}/index.js +0 -0
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
'use client';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
8
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible';
|
|
9
|
-
import { cn } from '@/lib/utils';
|
|
10
|
-
import { BrainIcon, ChevronDownIcon } from 'lucide-react';
|
|
11
|
-
import { createContext, memo, useContext, useEffect, useState } from 'react';
|
|
12
|
-
import { Streamdown } from 'streamdown';
|
|
13
|
-
import { Shimmer } from './shimmer';
|
|
14
|
-
const ReasoningContext = createContext(null);
|
|
15
|
-
export const useReasoning = () => {
|
|
16
|
-
const context = useContext(ReasoningContext);
|
|
17
|
-
if (!context) {
|
|
18
|
-
throw new Error('Reasoning components must be used within Reasoning');
|
|
19
|
-
}
|
|
20
|
-
return context;
|
|
21
|
-
};
|
|
22
|
-
const AUTO_CLOSE_DELAY = 1000;
|
|
23
|
-
const MS_IN_S = 1000;
|
|
24
|
-
export const Reasoning = memo(({ className, isStreaming = false, open, defaultOpen = true, onOpenChange, duration: durationProp, children, ...props }) => {
|
|
25
|
-
const [isOpen, setIsOpen] = useControllableState({
|
|
26
|
-
prop: open,
|
|
27
|
-
defaultProp: defaultOpen,
|
|
28
|
-
onChange: onOpenChange,
|
|
29
|
-
});
|
|
30
|
-
const [duration, setDuration] = useControllableState({
|
|
31
|
-
prop: durationProp,
|
|
32
|
-
defaultProp: undefined,
|
|
33
|
-
});
|
|
34
|
-
const [hasAutoClosed, setHasAutoClosed] = useState(false);
|
|
35
|
-
const [startTime, setStartTime] = useState(null);
|
|
36
|
-
// Track duration when streaming starts and ends
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (isStreaming) {
|
|
39
|
-
if (startTime === null) {
|
|
40
|
-
setStartTime(Date.now());
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else if (startTime !== null) {
|
|
44
|
-
setDuration(Math.ceil((Date.now() - startTime) / MS_IN_S));
|
|
45
|
-
setStartTime(null);
|
|
46
|
-
}
|
|
47
|
-
}, [isStreaming, startTime, setDuration]);
|
|
48
|
-
// Auto-open when streaming starts, auto-close when streaming ends (once only)
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (defaultOpen && !isStreaming && isOpen && !hasAutoClosed) {
|
|
51
|
-
// Add a small delay before closing to allow user to see the content
|
|
52
|
-
const timer = setTimeout(() => {
|
|
53
|
-
setIsOpen(false);
|
|
54
|
-
setHasAutoClosed(true);
|
|
55
|
-
}, AUTO_CLOSE_DELAY);
|
|
56
|
-
return () => clearTimeout(timer);
|
|
57
|
-
}
|
|
58
|
-
}, [isStreaming, isOpen, defaultOpen, setIsOpen, hasAutoClosed]);
|
|
59
|
-
const handleOpenChange = (newOpen) => {
|
|
60
|
-
setIsOpen(newOpen);
|
|
61
|
-
};
|
|
62
|
-
return (_jsx(ReasoningContext.Provider, { value: { isStreaming, isOpen, setIsOpen, duration }, children: _jsx(Collapsible, { className: cn('not-prose mb-4', className), onOpenChange: handleOpenChange, open: isOpen, ...props, children: children }) }));
|
|
63
|
-
});
|
|
64
|
-
const defaultGetThinkingMessage = (isStreaming, duration) => {
|
|
65
|
-
if (isStreaming || duration === 0) {
|
|
66
|
-
return _jsx(Shimmer, { duration: 1, children: "Thinking..." });
|
|
67
|
-
}
|
|
68
|
-
if (duration === undefined) {
|
|
69
|
-
return _jsx("p", { children: "Thought for a few seconds" });
|
|
70
|
-
}
|
|
71
|
-
return _jsxs("p", { children: ["Thought for ", duration, " seconds"] });
|
|
72
|
-
};
|
|
73
|
-
export const ReasoningTrigger = memo(({ className, children, getThinkingMessage = defaultGetThinkingMessage, ...props }) => {
|
|
74
|
-
const { isStreaming, isOpen, duration } = useReasoning();
|
|
75
|
-
return (_jsx(CollapsibleTrigger, { className: cn('flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground', className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(BrainIcon, { className: "size-4" }), getThinkingMessage(isStreaming, duration), _jsx(ChevronDownIcon, { className: cn('size-4 transition-transform', isOpen ? 'rotate-180' : 'rotate-0') })] })) }));
|
|
76
|
-
});
|
|
77
|
-
export const ReasoningContent = memo(({ className, children, ...props }) => (_jsx(CollapsibleContent, { className: cn('mt-4 text-sm', 'data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in', className), ...props, children: _jsx(Streamdown, { ...props, children: children }) })));
|
|
78
|
-
Reasoning.displayName = 'Reasoning';
|
|
79
|
-
ReasoningTrigger.displayName = 'ReasoningTrigger';
|
|
80
|
-
ReasoningContent.displayName = 'ReasoningContent';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ElementType } from 'react';
|
|
2
|
-
export type TextShimmerProps = {
|
|
3
|
-
children: string;
|
|
4
|
-
as?: ElementType;
|
|
5
|
-
className?: string;
|
|
6
|
-
duration?: number;
|
|
7
|
-
spread?: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const Shimmer: import("react").MemoExoticComponent<({ children, as: Component, className, duration, spread, }: TextShimmerProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
'use client';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
import { motion } from 'motion/react';
|
|
9
|
-
import { memo, useMemo, } from 'react';
|
|
10
|
-
const ShimmerComponent = ({ children, as: Component = 'p', className, duration = 2, spread = 2, }) => {
|
|
11
|
-
const MotionComponent = motion.create(Component);
|
|
12
|
-
const dynamicSpread = useMemo(() => (children?.length ?? 0) * spread, [children, spread]);
|
|
13
|
-
return (_jsx(MotionComponent, { animate: { backgroundPosition: '0% center' }, className: cn('relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent', '[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]', className), initial: { backgroundPosition: '100% center' }, style: {
|
|
14
|
-
'--spread': `${dynamicSpread}px`,
|
|
15
|
-
backgroundImage: 'var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))',
|
|
16
|
-
}, transition: {
|
|
17
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
18
|
-
duration,
|
|
19
|
-
ease: 'linear',
|
|
20
|
-
}, children: children }));
|
|
21
|
-
};
|
|
22
|
-
export const Shimmer = memo(ShimmerComponent);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
|
|
2
|
-
import type { ComponentProps } from 'react';
|
|
3
|
-
export type SourcesProps = ComponentProps<'div'>;
|
|
4
|
-
export declare const Sources: ({ className, ...props }: SourcesProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export type SourcesTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {
|
|
6
|
-
count: number;
|
|
7
|
-
};
|
|
8
|
-
export declare const SourcesTrigger: ({ className, count, children, ...props }: SourcesTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export type SourcesContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
10
|
-
export declare const SourcesContent: ({ className, ...props }: SourcesContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export type SourceProps = ComponentProps<'a'>;
|
|
12
|
-
export declare const Source: ({ href, title, children, ...props }: SourceProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
'use client';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible';
|
|
8
|
-
import { cn } from '@/lib/utils';
|
|
9
|
-
import { BookIcon, ChevronDownIcon } from 'lucide-react';
|
|
10
|
-
export const Sources = ({ className, ...props }) => (_jsx(Collapsible, { className: cn('not-prose mb-4 text-primary text-xs', className), ...props }));
|
|
11
|
-
export const SourcesTrigger = ({ className, count, children, ...props }) => (_jsx(CollapsibleTrigger, { className: cn('flex items-center gap-2', className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsxs("p", { className: "font-medium", children: ["Used ", count, " sources"] }), _jsx(ChevronDownIcon, { className: "h-4 w-4" })] })) }));
|
|
12
|
-
export const SourcesContent = ({ className, ...props }) => (_jsx(CollapsibleContent, { className: cn('mt-3 flex w-fit flex-col gap-2', 'data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in', className), ...props }));
|
|
13
|
-
export const Source = ({ href, title, children, ...props }) => (_jsx("a", { className: "flex items-center gap-2", href: href, rel: "noreferrer", target: "_blank", ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(BookIcon, { className: "h-4 w-4" }), _jsx("span", { className: "block font-medium", children: title })] })) }));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Button } from '@/components/ui/button';
|
|
2
|
-
import { ScrollArea } from '@/components/ui/scroll-area';
|
|
3
|
-
import type { ComponentProps } from 'react';
|
|
4
|
-
export type SuggestionsProps = ComponentProps<typeof ScrollArea>;
|
|
5
|
-
export declare const Suggestions: ({ className, children, ...props }: SuggestionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export type SuggestionProps = Omit<ComponentProps<typeof Button>, 'onClick'> & {
|
|
7
|
-
suggestion: string;
|
|
8
|
-
onClick?: (suggestion: string) => void;
|
|
9
|
-
};
|
|
10
|
-
export declare const Suggestion: ({ suggestion, onClick, className, variant, size, children, ...props }: SuggestionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
'use client';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Button } from '@/components/ui/button';
|
|
8
|
-
import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area';
|
|
9
|
-
import { cn } from '@/lib/utils';
|
|
10
|
-
export const Suggestions = ({ className, children, ...props }) => (_jsxs(ScrollArea, { className: "w-full overflow-x-auto whitespace-nowrap", ...props, children: [_jsx("div", { className: cn('flex w-max flex-nowrap items-center gap-2', className), children: children }), _jsx(ScrollBar, { className: "hidden", orientation: "horizontal" })] }));
|
|
11
|
-
export const Suggestion = ({ suggestion, onClick, className, variant = 'outline', size = 'sm', children, ...props }) => {
|
|
12
|
-
const handleClick = () => {
|
|
13
|
-
onClick?.(suggestion);
|
|
14
|
-
};
|
|
15
|
-
return (_jsx(Button, { className: cn('cursor-pointer rounded-full px-4', className), onClick: handleClick, size: size, type: "button", variant: variant, ...props, children: children || suggestion }));
|
|
16
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Collapsible, CollapsibleContent } from '@/components/ui/collapsible';
|
|
2
|
-
import type { ToolUIPart } from 'ai';
|
|
3
|
-
import type { ComponentProps } from 'react';
|
|
4
|
-
export type ToolProps = ComponentProps<typeof Collapsible>;
|
|
5
|
-
export declare const Tool: ({ className, ...props }: ToolProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export type ToolHeaderProps = {
|
|
7
|
-
title?: string;
|
|
8
|
-
type: ToolUIPart['type'];
|
|
9
|
-
state: ToolUIPart['state'];
|
|
10
|
-
className?: string;
|
|
11
|
-
};
|
|
12
|
-
export declare const ToolHeader: ({ className, title, type, state, ...props }: ToolHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export type ToolContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
14
|
-
export declare const ToolContent: ({ className, ...props }: ToolContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export type ToolInputProps = ComponentProps<'div'> & {
|
|
16
|
-
input: ToolUIPart['input'];
|
|
17
|
-
};
|
|
18
|
-
export declare const ToolInput: ({ className, input, ...props }: ToolInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export type ToolOutputProps = ComponentProps<'div'> & {
|
|
20
|
-
output: ToolUIPart['output'];
|
|
21
|
-
errorText: ToolUIPart['errorText'];
|
|
22
|
-
};
|
|
23
|
-
export declare const ToolOutput: ({ className, output, errorText, ...props }: ToolOutputProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
'use client';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Badge } from '@/components/ui/badge';
|
|
8
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible';
|
|
9
|
-
import { cn } from '@/lib/utils';
|
|
10
|
-
import { CheckCircleIcon, ChevronDownIcon, CircleIcon, ClockIcon, WrenchIcon, XCircleIcon, } from 'lucide-react';
|
|
11
|
-
import { isValidElement } from 'react';
|
|
12
|
-
import { CodeBlock } from './code-block';
|
|
13
|
-
export const Tool = ({ className, ...props }) => (_jsx(Collapsible, { className: cn('not-prose mb-4 w-full rounded-md border', className), ...props }));
|
|
14
|
-
const getStatusBadge = (status) => {
|
|
15
|
-
const labels = {
|
|
16
|
-
'input-streaming': 'Pending',
|
|
17
|
-
'input-available': 'Running',
|
|
18
|
-
'approval-requested': 'Awaiting Approval',
|
|
19
|
-
'approval-responded': 'Responded',
|
|
20
|
-
'output-available': 'Completed',
|
|
21
|
-
'output-error': 'Error',
|
|
22
|
-
'output-denied': 'Denied',
|
|
23
|
-
};
|
|
24
|
-
const icons = {
|
|
25
|
-
'input-streaming': _jsx(CircleIcon, { className: "size-4" }),
|
|
26
|
-
'input-available': _jsx(ClockIcon, { className: "size-4 animate-pulse" }),
|
|
27
|
-
'approval-requested': _jsx(ClockIcon, { className: "size-4 text-yellow-600" }),
|
|
28
|
-
'approval-responded': _jsx(CheckCircleIcon, { className: "size-4 text-blue-600" }),
|
|
29
|
-
'output-available': _jsx(CheckCircleIcon, { className: "size-4 text-green-600" }),
|
|
30
|
-
'output-error': _jsx(XCircleIcon, { className: "size-4 text-red-600" }),
|
|
31
|
-
'output-denied': _jsx(XCircleIcon, { className: "size-4 text-orange-600" }),
|
|
32
|
-
};
|
|
33
|
-
return (_jsxs(Badge, { className: "gap-1.5 rounded-full text-xs", variant: "secondary", children: [icons[status], labels[status]] }));
|
|
34
|
-
};
|
|
35
|
-
export const ToolHeader = ({ className, title, type, state, ...props }) => (_jsxs(CollapsibleTrigger, { className: cn('flex w-full items-center justify-between gap-4 p-3', className), ...props, children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WrenchIcon, { className: "size-4 text-muted-foreground" }), _jsx("span", { className: "font-medium text-sm", children: title ?? type.split('-').slice(1).join('-') }), getStatusBadge(state)] }), _jsx(ChevronDownIcon, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })] }));
|
|
36
|
-
export const ToolContent = ({ className, ...props }) => (_jsx(CollapsibleContent, { className: cn('data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in', className), ...props }));
|
|
37
|
-
export const ToolInput = ({ className, input, ...props }) => (_jsxs("div", { className: cn('space-y-2 overflow-hidden p-4', className), ...props, children: [_jsx("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: "Parameters" }), _jsx("div", { className: "rounded-md bg-muted/50", children: _jsx(CodeBlock, { code: JSON.stringify(input, null, 2), language: "json" }) })] }));
|
|
38
|
-
export const ToolOutput = ({ className, output, errorText, ...props }) => {
|
|
39
|
-
if (!(output || errorText)) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
let Output = _jsx("div", { children: output });
|
|
43
|
-
if (typeof output === 'object' && !isValidElement(output)) {
|
|
44
|
-
Output = (_jsx(CodeBlock, { code: JSON.stringify(output, null, 2), language: "json" }));
|
|
45
|
-
}
|
|
46
|
-
else if (typeof output === 'string') {
|
|
47
|
-
Output = _jsx(CodeBlock, { code: output, language: "json" });
|
|
48
|
-
}
|
|
49
|
-
return (_jsxs("div", { className: cn('space-y-2 p-4', className), ...props, children: [_jsx("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: errorText ? 'Error' : 'Result' }), _jsxs("div", { className: cn('overflow-x-auto rounded-md text-xs [&_table]:w-full', errorText
|
|
50
|
-
? 'bg-destructive/10 text-destructive'
|
|
51
|
-
: 'bg-muted/50 text-foreground'), children: [errorText && _jsx("div", { children: errorText }), Output] })] }));
|
|
52
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ServiceManager } from '@jupyterlab/services';
|
|
3
|
-
interface MainContentProps {
|
|
4
|
-
showNotebook: boolean;
|
|
5
|
-
timeTravel: number;
|
|
6
|
-
onTimeTravelChange: (value: number) => void;
|
|
7
|
-
richEditor: boolean;
|
|
8
|
-
notebookFile?: string;
|
|
9
|
-
lexicalFile?: string;
|
|
10
|
-
isNewAgent?: boolean;
|
|
11
|
-
serviceManager?: ServiceManager.IManager;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Main Content Component
|
|
15
|
-
*
|
|
16
|
-
* Displays the main content area with Simple notebook viewer or Lexical editor and time travel.
|
|
17
|
-
*/
|
|
18
|
-
export declare const MainContent: React.FC<MainContentProps>;
|
|
19
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { MockFileBrowser } from './MockFileBrowser';
|
|
2
|
-
export { MainContent } from './MainContent';
|
|
3
|
-
export { SessionTabs } from './SessionTabs';
|
|
4
|
-
export { Header } from './Header';
|
|
5
|
-
export { HeaderControls } from './HeaderControls';
|
|
6
|
-
export { FooterMetrics } from './FooterMetrics';
|
|
7
|
-
export { TimeTravel } from './TimeTravel';
|
|
8
|
-
export { LexicalEditor } from './LexicalEditor';
|
|
9
|
-
export { AgentConfiguration, AGENT_LIBRARIES, TRANSPORTS, EXTENSIONS, } from './AgentConfiguration';
|
|
10
|
-
export type { AgentLibrary, Transport, Extension, MCPServerConfig, MCPServerTool, } from './AgentConfiguration';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the Modified BSD License.
|
|
4
|
-
*/
|
|
5
|
-
export { MockFileBrowser } from './MockFileBrowser';
|
|
6
|
-
export { MainContent } from './MainContent';
|
|
7
|
-
export { SessionTabs } from './SessionTabs';
|
|
8
|
-
export { Header } from './Header';
|
|
9
|
-
export { HeaderControls } from './HeaderControls';
|
|
10
|
-
export { FooterMetrics } from './FooterMetrics';
|
|
11
|
-
export { TimeTravel } from './TimeTravel';
|
|
12
|
-
export { LexicalEditor } from './LexicalEditor';
|
|
13
|
-
export { AgentConfiguration, AGENT_LIBRARIES, TRANSPORTS, EXTENSIONS, } from './AgentConfiguration';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import './showcase.css';
|
|
2
|
-
import '../../../style/base.css';
|
|
3
|
-
import '../../../style/showcase-vercel-ai.css';
|
|
4
|
-
/**
|
|
5
|
-
* Vercel AI Elements Showcase
|
|
6
|
-
*
|
|
7
|
-
* A comprehensive showcase of all available Vercel AI Elements components.
|
|
8
|
-
* This page displays static examples of each component to demonstrate their
|
|
9
|
-
* visual appearance and basic functionality.
|
|
10
|
-
*/
|
|
11
|
-
export declare const VercelAiElementsShowcase: React.FC;
|
|
12
|
-
export default VercelAiElementsShowcase;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
|
-
import { useState } from 'react';
|
|
7
|
-
import { MessageShowcase } from './components/MessageShowcase';
|
|
8
|
-
import { LoaderShowcase } from './components/LoaderShowcase';
|
|
9
|
-
import { CodeBlockShowcase } from './components/CodeBlockShowcase';
|
|
10
|
-
import { SuggestionShowcase } from './components/SuggestionShowcase';
|
|
11
|
-
import { ShimmerShowcase } from './components/ShimmerShowcase';
|
|
12
|
-
import { ArtifactShowcase } from './components/ArtifactShowcase';
|
|
13
|
-
import { SourcesShowcase } from './components/SourcesShowcase';
|
|
14
|
-
import { PromptInputShowcase } from './components/PromptInputShowcase';
|
|
15
|
-
import { ConversationShowcase } from './components/ConversationShowcase';
|
|
16
|
-
import { ModelSelectorShowcase } from './components/ModelSelectorShowcase';
|
|
17
|
-
import { ReasoningShowcase } from './components/ReasoningShowcase';
|
|
18
|
-
import { ToolShowcase } from './components/ToolShowcase';
|
|
19
|
-
import './showcase.css';
|
|
20
|
-
import '../../../style/base.css';
|
|
21
|
-
import '../../../style/showcase-vercel-ai.css';
|
|
22
|
-
/**
|
|
23
|
-
* Vercel AI Elements Showcase
|
|
24
|
-
*
|
|
25
|
-
* A comprehensive showcase of all available Vercel AI Elements components.
|
|
26
|
-
* This page displays static examples of each component to demonstrate their
|
|
27
|
-
* visual appearance and basic functionality.
|
|
28
|
-
*/
|
|
29
|
-
export const VercelAiElementsShowcase = () => {
|
|
30
|
-
const [activeTab, setActiveTab] = useState('message');
|
|
31
|
-
const components = [
|
|
32
|
-
{ id: 'message', label: 'Message', component: _jsx(MessageShowcase, {}) },
|
|
33
|
-
{
|
|
34
|
-
id: 'conversation',
|
|
35
|
-
label: 'Conversation',
|
|
36
|
-
component: _jsx(ConversationShowcase, {}),
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 'prompt-input',
|
|
40
|
-
label: 'Prompt Input',
|
|
41
|
-
component: _jsx(PromptInputShowcase, {}),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: 'model-selector',
|
|
45
|
-
label: 'Model Selector',
|
|
46
|
-
component: _jsx(ModelSelectorShowcase, {}),
|
|
47
|
-
},
|
|
48
|
-
{ id: 'artifact', label: 'Artifact', component: _jsx(ArtifactShowcase, {}) },
|
|
49
|
-
{ id: 'code-block', label: 'Code Block', component: _jsx(CodeBlockShowcase, {}) },
|
|
50
|
-
{
|
|
51
|
-
id: 'suggestion',
|
|
52
|
-
label: 'Suggestions',
|
|
53
|
-
component: _jsx(SuggestionShowcase, {}),
|
|
54
|
-
},
|
|
55
|
-
{ id: 'sources', label: 'Sources', component: _jsx(SourcesShowcase, {}) },
|
|
56
|
-
{ id: 'reasoning', label: 'Reasoning', component: _jsx(ReasoningShowcase, {}) },
|
|
57
|
-
{ id: 'tool', label: 'Tool', component: _jsx(ToolShowcase, {}) },
|
|
58
|
-
{ id: 'loader', label: 'Loader', component: _jsx(LoaderShowcase, {}) },
|
|
59
|
-
{ id: 'shimmer', label: 'Shimmer', component: _jsx(ShimmerShowcase, {}) },
|
|
60
|
-
];
|
|
61
|
-
return (_jsxs("div", { className: "min-h-screen bg-background", children: [_jsx("header", { className: "border-b bg-card", children: _jsxs("div", { className: "container mx-auto py-6 px-4 md:px-6 lg:px-8", children: [_jsx("h1", { className: "text-3xl font-bold text-foreground", children: "Vercel AI Elements Showcase" }), _jsx("p", { className: "text-muted-foreground mt-2", children: "A comprehensive collection of all available Vercel AI Elements components" })] }) }), _jsx("main", { className: "container mx-auto py-8 px-4 md:px-6 lg:px-8", children: _jsxs("div", { className: "w-full", children: [_jsx("div", { className: "border-b border-border", children: _jsx("nav", { className: "flex gap-1 overflow-x-auto", "aria-label": "Component tabs", children: components.map(component => (_jsx("button", { onClick: () => setActiveTab(component.id), className: `
|
|
62
|
-
px-4 py-2 text-sm font-medium whitespace-nowrap
|
|
63
|
-
border-b-2 transition-colors
|
|
64
|
-
${activeTab === component.id
|
|
65
|
-
? 'border-primary text-primary'
|
|
66
|
-
: 'border-transparent text-muted-foreground hover:text-foreground hover:border-border'}
|
|
67
|
-
`, "aria-current": activeTab === component.id ? 'page' : undefined, children: component.label }, component.id))) }) }), _jsx("div", { className: "mt-6", children: components.map(component => (_jsx("div", { className: activeTab === component.id ? 'block' : 'hidden', role: "tabpanel", children: _jsxs("div", { className: "border rounded-lg bg-card", children: [_jsxs("div", { className: "border-b px-6 py-4", children: [_jsx("h2", { className: "text-2xl font-semibold text-foreground", children: component.label }), _jsxs("p", { className: "text-muted-foreground mt-1", children: ["Example implementations of the ", component.label, " component"] })] }), _jsx("div", { className: "p-6", children: _jsx("div", { className: "max-h-[calc(100vh-350px)] overflow-y-auto", children: component.component }) })] }) }, component.id))) })] }) })] }));
|
|
68
|
-
};
|
|
69
|
-
export default VercelAiElementsShowcase;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ArtifactShowcase: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
|
-
import { Artifact, ArtifactAction, ArtifactActions, ArtifactContent, ArtifactDescription, ArtifactHeader, ArtifactTitle, } from '@/components/vercel-ai-elements/artifact';
|
|
7
|
-
import { CodeBlock } from '@/components/vercel-ai-elements/code-block';
|
|
8
|
-
import { CopyIcon, DownloadIcon, PlayIcon, RefreshCwIcon, ShareIcon, } from 'lucide-react';
|
|
9
|
-
const pythonCode = `# Dijkstra's Algorithm implementation
|
|
10
|
-
import heapq
|
|
11
|
-
|
|
12
|
-
def dijkstra(graph, start):
|
|
13
|
-
distances = {node: float('inf') for node in graph}
|
|
14
|
-
distances[start] = 0
|
|
15
|
-
heap = [(0, start)]
|
|
16
|
-
visited = set()
|
|
17
|
-
|
|
18
|
-
while heap:
|
|
19
|
-
current_distance, current_node = heapq.heappop(heap)
|
|
20
|
-
if current_node in visited:
|
|
21
|
-
continue
|
|
22
|
-
visited.add(current_node)
|
|
23
|
-
|
|
24
|
-
for neighbor, weight in graph[current_node].items():
|
|
25
|
-
distance = current_distance + weight
|
|
26
|
-
if distance < distances[neighbor]:
|
|
27
|
-
distances[neighbor] = distance
|
|
28
|
-
heapq.heappush(heap, (distance, neighbor))
|
|
29
|
-
|
|
30
|
-
return distances
|
|
31
|
-
|
|
32
|
-
# Example graph
|
|
33
|
-
graph = {
|
|
34
|
-
'A': {'B': 1, 'C': 4},
|
|
35
|
-
'B': {'A': 1, 'C': 2, 'D': 5},
|
|
36
|
-
'C': {'A': 4, 'B': 2, 'D': 1},
|
|
37
|
-
'D': {'B': 5, 'C': 1}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
print(dijkstra(graph, 'A'))`;
|
|
41
|
-
const reactCode = `import React, { useState } from 'react';
|
|
42
|
-
|
|
43
|
-
function TodoApp() {
|
|
44
|
-
const [todos, setTodos] = useState([]);
|
|
45
|
-
const [input, setInput] = useState('');
|
|
46
|
-
|
|
47
|
-
const addTodo = () => {
|
|
48
|
-
if (input.trim()) {
|
|
49
|
-
setTodos([...todos, { id: Date.now(), text: input, done: false }]);
|
|
50
|
-
setInput('');
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const toggleTodo = (id) => {
|
|
55
|
-
setTodos(todos.map(todo =>
|
|
56
|
-
todo.id === id ? { ...todo, done: !todo.done } : todo
|
|
57
|
-
));
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div>
|
|
62
|
-
<h1>Todo List</h1>
|
|
63
|
-
<input
|
|
64
|
-
value={input}
|
|
65
|
-
onChange={(e) => setInput(e.target.value)}
|
|
66
|
-
onKeyPress={(e) => e.key === 'Enter' && addTodo()}
|
|
67
|
-
/>
|
|
68
|
-
<button onClick={addTodo}>Add</button>
|
|
69
|
-
<ul>
|
|
70
|
-
{todos.map(todo => (
|
|
71
|
-
<li
|
|
72
|
-
key={todo.id}
|
|
73
|
-
onClick={() => toggleTodo(todo.id)}
|
|
74
|
-
style={{ textDecoration: todo.done ? 'line-through' : 'none' }}
|
|
75
|
-
>
|
|
76
|
-
{todo.text}
|
|
77
|
-
</li>
|
|
78
|
-
))}
|
|
79
|
-
</ul>
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
}`;
|
|
83
|
-
export const ArtifactShowcase = () => {
|
|
84
|
-
return (_jsxs("div", { className: "space-y-8", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Code Artifact" }), _jsxs(Artifact, { children: [_jsxs(ArtifactHeader, { children: [_jsxs("div", { children: [_jsx(ArtifactTitle, { children: "Dijkstra's Algorithm Implementation" }), _jsx(ArtifactDescription, { children: "Updated 1 minute ago" })] }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs(ArtifactActions, { children: [_jsx(ArtifactAction, { icon: PlayIcon, label: "Run", onClick: () => console.log('Run'), tooltip: "Run code" }), _jsx(ArtifactAction, { icon: CopyIcon, label: "Copy", onClick: () => console.log('Copy'), tooltip: "Copy to clipboard" }), _jsx(ArtifactAction, { icon: RefreshCwIcon, label: "Regenerate", onClick: () => console.log('Regenerate'), tooltip: "Regenerate content" }), _jsx(ArtifactAction, { icon: DownloadIcon, label: "Download", onClick: () => console.log('Download'), tooltip: "Download file" }), _jsx(ArtifactAction, { icon: ShareIcon, label: "Share", onClick: () => console.log('Share'), tooltip: "Share artifact" })] }) })] }), _jsx(ArtifactContent, { className: "p-0", children: _jsx(CodeBlock, { className: "border-none", code: pythonCode, language: "python", showLineNumbers: true }) })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "React Component Artifact" }), _jsxs(Artifact, { children: [_jsxs(ArtifactHeader, { children: [_jsxs("div", { children: [_jsx(ArtifactTitle, { children: "Todo App Component" }), _jsx(ArtifactDescription, { children: "React component with hooks" })] }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs(ArtifactActions, { children: [_jsx(ArtifactAction, { icon: CopyIcon, label: "Copy", onClick: () => console.log('Copy'), tooltip: "Copy to clipboard" }), _jsx(ArtifactAction, { icon: DownloadIcon, label: "Download", onClick: () => console.log('Download'), tooltip: "Download file" })] }) })] }), _jsx(ArtifactContent, { className: "p-0", children: _jsx(CodeBlock, { className: "border-none", code: reactCode, language: "tsx", showLineNumbers: true }) })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Document Artifact" }), _jsxs(Artifact, { children: [_jsxs(ArtifactHeader, { children: [_jsxs("div", { children: [_jsx(ArtifactTitle, { children: "Project Documentation" }), _jsx(ArtifactDescription, { children: "Generated documentation" })] }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs(ArtifactActions, { children: [_jsx(ArtifactAction, { icon: CopyIcon, label: "Copy", onClick: () => console.log('Copy'), tooltip: "Copy to clipboard" }), _jsx(ArtifactAction, { icon: ShareIcon, label: "Share", onClick: () => console.log('Share'), tooltip: "Share artifact" })] }) })] }), _jsx(ArtifactContent, { children: _jsxs("div", { className: "prose prose-sm max-w-none", children: [_jsx("h1", { children: "Getting Started" }), _jsx("p", { children: "This guide will help you get started with the project." }), _jsx("h2", { children: "Installation" }), _jsx("p", { children: "Install the dependencies using npm:" }), _jsx("pre", { children: _jsx("code", { children: "npm install" }) }), _jsx("h2", { children: "Usage" }), _jsx("p", { children: "Run the development server:" }), _jsx("pre", { children: _jsx("code", { children: "npm run dev" }) })] }) })] })] })] }));
|
|
85
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const CodeBlockShowcase: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
|
-
import { CodeBlock, CodeBlockCopyButton, } from '@/components/vercel-ai-elements/code-block';
|
|
7
|
-
const jsCode = `function fibonacci(n) {
|
|
8
|
-
if (n <= 1) return n;
|
|
9
|
-
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
console.log(fibonacci(10)); // 55`;
|
|
13
|
-
const pythonCode = `def dijkstra(graph, start):
|
|
14
|
-
distances = {node: float('inf') for node in graph}
|
|
15
|
-
distances[start] = 0
|
|
16
|
-
heap = [(0, start)]
|
|
17
|
-
visited = set()
|
|
18
|
-
|
|
19
|
-
while heap:
|
|
20
|
-
current_distance, current_node = heapq.heappop(heap)
|
|
21
|
-
if current_node in visited:
|
|
22
|
-
continue
|
|
23
|
-
visited.add(current_node)
|
|
24
|
-
|
|
25
|
-
for neighbor, weight in graph[current_node].items():
|
|
26
|
-
distance = current_distance + weight
|
|
27
|
-
if distance < distances[neighbor]:
|
|
28
|
-
distances[neighbor] = distance
|
|
29
|
-
heapq.heappush(heap, (distance, neighbor))
|
|
30
|
-
|
|
31
|
-
return distances`;
|
|
32
|
-
const tsxCode = `import React, { useState } from 'react';
|
|
33
|
-
|
|
34
|
-
const Counter: React.FC = () => {
|
|
35
|
-
const [count, setCount] = useState(0);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div>
|
|
39
|
-
<h1>Count: {count}</h1>
|
|
40
|
-
<button onClick={() => setCount(count + 1)}>
|
|
41
|
-
Increment
|
|
42
|
-
</button>
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default Counter;`;
|
|
48
|
-
const sqlCode = `SELECT
|
|
49
|
-
u.id,
|
|
50
|
-
u.name,
|
|
51
|
-
COUNT(o.id) as order_count,
|
|
52
|
-
SUM(o.total) as total_spent
|
|
53
|
-
FROM users u
|
|
54
|
-
LEFT JOIN orders o ON u.id = o.user_id
|
|
55
|
-
WHERE u.active = true
|
|
56
|
-
GROUP BY u.id, u.name
|
|
57
|
-
HAVING COUNT(o.id) > 5
|
|
58
|
-
ORDER BY total_spent DESC
|
|
59
|
-
LIMIT 10;`;
|
|
60
|
-
export const CodeBlockShowcase = () => {
|
|
61
|
-
return (_jsxs("div", { className: "space-y-8", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "JavaScript Code Block" }), _jsx(CodeBlock, { code: jsCode, language: "javascript", children: _jsx(CodeBlockCopyButton, { onCopy: () => console.log('Copied JavaScript code'), onError: () => console.error('Failed to copy') }) })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Python Code Block" }), _jsx(CodeBlock, { code: pythonCode, language: "python", children: _jsx(CodeBlockCopyButton, { onCopy: () => console.log('Copied Python code'), onError: () => console.error('Failed to copy') }) })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "TypeScript/React Code Block" }), _jsx(CodeBlock, { code: tsxCode, language: "tsx", showLineNumbers: true, children: _jsx(CodeBlockCopyButton, { onCopy: () => console.log('Copied TSX code'), onError: () => console.error('Failed to copy') }) })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "SQL Code Block with Line Numbers" }), _jsx(CodeBlock, { code: sqlCode, language: "sql", showLineNumbers: true, children: _jsx(CodeBlockCopyButton, { onCopy: () => console.log('Copied SQL code'), onError: () => console.error('Failed to copy') }) })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Inline Code" }), _jsx("div", { className: "p-4 border rounded-md", children: _jsxs("p", { className: "text-sm", children: ["Use the", ' ', _jsx("code", { className: "px-2 py-1 bg-muted rounded text-sm font-mono", children: "useState" }), ' ', "hook to manage state in React. For side effects, use", ' ', _jsx("code", { className: "px-2 py-1 bg-muted rounded text-sm font-mono", children: "useEffect" }), "."] }) })] })] }));
|
|
62
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ConversationShowcase: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
|
-
import { Conversation, ConversationContent, ConversationScrollButton, } from '@/components/vercel-ai-elements/conversation';
|
|
7
|
-
import { Message, MessageContent, MessageResponse, } from '@/components/vercel-ai-elements/message';
|
|
8
|
-
import { nanoid } from 'nanoid';
|
|
9
|
-
const messages = [
|
|
10
|
-
{
|
|
11
|
-
id: nanoid(),
|
|
12
|
-
role: 'user',
|
|
13
|
-
content: 'What is React and why should I use it?',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: nanoid(),
|
|
17
|
-
role: 'assistant',
|
|
18
|
-
content: `React is a JavaScript library for building user interfaces, particularly single-page applications. Here's why you should consider using it:
|
|
19
|
-
|
|
20
|
-
## Key Benefits
|
|
21
|
-
|
|
22
|
-
1. **Component-Based Architecture** - Build encapsulated components that manage their own state
|
|
23
|
-
2. **Virtual DOM** - Efficient updates and rendering
|
|
24
|
-
3. **Rich Ecosystem** - Large community and many third-party libraries
|
|
25
|
-
4. **Learn Once, Write Anywhere** - Can be used for web, mobile (React Native), and more`,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: nanoid(),
|
|
29
|
-
role: 'user',
|
|
30
|
-
content: 'Can you show me a simple example?',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: nanoid(),
|
|
34
|
-
role: 'assistant',
|
|
35
|
-
content: `Here's a simple React component example:
|
|
36
|
-
|
|
37
|
-
\`\`\`jsx
|
|
38
|
-
function Welcome({ name }) {
|
|
39
|
-
return <h1>Hello, {name}!</h1>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Usage
|
|
43
|
-
<Welcome name="Alice" />
|
|
44
|
-
\`\`\`
|
|
45
|
-
|
|
46
|
-
This component accepts a \`name\` prop and displays a greeting.`,
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
export const ConversationShowcase = () => {
|
|
50
|
-
return (_jsxs("div", { className: "space-y-8", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Conversation Container" }), _jsx("div", { className: "border rounded-lg", children: _jsxs(Conversation, { children: [_jsx(ConversationContent, { children: messages.map(message => (_jsx(Message, { from: message.role, children: _jsx(MessageContent, { children: _jsx(MessageResponse, { children: message.content }) }) }, message.id))) }), _jsx(ConversationScrollButton, {})] }) })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Limited Height Conversation" }), _jsx("div", { className: "border rounded-lg", style: { height: '400px' }, children: _jsxs(Conversation, { children: [_jsx(ConversationContent, { children: [...messages, ...messages].map((message, index) => (_jsx(Message, { from: message.role, children: _jsx(MessageContent, { children: _jsx(MessageResponse, { children: message.content }) }) }, `${message.id}-${index}`))) }), _jsx(ConversationScrollButton, {})] }) })] })] }));
|
|
51
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const LoaderShowcase: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the Modified BSD License.
|
|
5
|
-
*/
|
|
6
|
-
import { Loader } from '@/components/vercel-ai-elements/loader';
|
|
7
|
-
export const LoaderShowcase = () => {
|
|
8
|
-
return (_jsxs("div", { className: "space-y-8", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Default Loader" }), _jsx("div", { className: "flex items-center justify-center p-8 border rounded-md bg-muted/50", children: _jsx(Loader, {}) })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Loader Sizes" }), _jsxs("div", { className: "flex items-center justify-around p-8 border rounded-md gap-4 bg-muted/50", children: [_jsxs("div", { className: "text-center", children: [_jsx(Loader, { className: "h-4 w-4" }), _jsx("p", { className: "text-sm text-muted-foreground mt-2", children: "Small" })] }), _jsxs("div", { className: "text-center", children: [_jsx(Loader, { className: "h-6 w-6" }), _jsx("p", { className: "text-sm text-muted-foreground mt-2", children: "Medium" })] }), _jsxs("div", { className: "text-center", children: [_jsx(Loader, { className: "h-8 w-8" }), _jsx("p", { className: "text-sm text-muted-foreground mt-2", children: "Large" })] }), _jsxs("div", { className: "text-center", children: [_jsx(Loader, { className: "h-12 w-12" }), _jsx("p", { className: "text-sm text-muted-foreground mt-2", children: "Extra Large" })] })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Loader in Context" }), _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "p-4 border rounded-md bg-muted/50", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader, { className: "h-4 w-4" }), _jsx("span", { className: "text-sm", children: "Loading your data..." })] }) }), _jsx("div", { className: "p-4 border rounded-md bg-muted/50", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader, { className: "h-4 w-4" }), _jsx("span", { className: "text-sm", children: "Generating response..." })] }) }), _jsx("div", { className: "p-4 border rounded-md bg-muted/50", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader, { className: "h-4 w-4" }), _jsx("span", { className: "text-sm", children: "Processing request..." })] }) })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Centered Loader" }), _jsx("div", { className: "h-64 flex items-center justify-center border rounded-md bg-muted/50", children: _jsxs("div", { className: "text-center", children: [_jsx(Loader, { className: "h-8 w-8 mx-auto mb-4" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Loading content..." })] }) })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Inline Loaders" }), _jsxs("div", { className: "p-4 border rounded-md space-y-2 bg-muted/50", children: [_jsxs("div", { className: "text-sm flex items-center gap-2", children: [_jsx(Loader, { className: "h-3 w-3" }), _jsx("span", { children: "Analyzing data" })] }), _jsxs("div", { className: "text-sm flex items-center gap-2", children: [_jsx(Loader, { className: "h-3 w-3" }), _jsx("span", { children: "Running calculations" })] }), _jsxs("div", { className: "text-sm flex items-center gap-2", children: [_jsx(Loader, { className: "h-3 w-3" }), _jsx("span", { children: "Preparing results" })] })] })] })] }));
|
|
9
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const MessageShowcase: () => import("react/jsx-runtime").JSX.Element;
|