@svadmin/ai-elements 0.1.0 → 0.3.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 +45 -9
- package/dist/ai.css +35 -1
- package/dist/components/ChatDialog.svelte +93 -35
- package/dist/components/ChatDialog.svelte.d.ts +6 -0
- package/dist/components/Conversation.svelte +37 -17
- package/dist/components/Conversation.svelte.d.ts +3 -2
- package/dist/components/ConversationContent.svelte +29 -4
- package/dist/components/ConversationContent.svelte.d.ts +3 -2
- package/dist/components/ConversationEmptyState.svelte +33 -7
- package/dist/components/ConversationEmptyState.svelte.d.ts +4 -2
- package/dist/components/ConversationScrollButton.svelte +47 -2
- package/dist/components/ConversationScrollButton.svelte.d.ts +8 -2
- package/dist/components/Message.svelte +30 -16
- package/dist/components/Message.svelte.d.ts +5 -5
- package/dist/components/MessageContent.svelte +23 -4
- package/dist/components/MessageContent.svelte.d.ts +3 -2
- package/dist/components/Reasoning.svelte +51 -9
- package/dist/components/Reasoning.svelte.d.ts +4 -3
- package/dist/components/action/Action.svelte +48 -0
- package/dist/components/action/Action.svelte.d.ts +13 -0
- package/dist/components/action/Actions.svelte +12 -0
- package/dist/components/action/Actions.svelte.d.ts +9 -0
- package/dist/components/action/index.d.ts +4 -0
- package/dist/components/action/index.js +2 -0
- package/dist/components/artifact/ArtifactAction.svelte +43 -7
- package/dist/components/artifact/ArtifactAction.svelte.d.ts +5 -0
- package/dist/components/artifact/ArtifactClose.svelte +26 -6
- package/dist/components/artifact/ArtifactClose.svelte.d.ts +5 -2
- package/dist/components/artifact/index.d.ts +1 -0
- package/dist/components/audio-player/AudioPlayerControlBar.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerDurationDisplay.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerElement.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerMuteButton.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerPlayButton.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerSeekBackwardButton.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerSeekForwardButton.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerTimeDisplay.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerTimeRange.svelte +0 -1
- package/dist/components/audio-player/AudioPlayerVolumeRange.svelte +0 -1
- package/dist/components/checkpoint/index.d.ts +2 -2
- package/dist/components/code/Code.svelte +16 -0
- package/dist/components/code/Code.svelte.d.ts +10 -0
- package/dist/components/code/index.d.ts +23 -0
- package/dist/components/code/index.js +14 -0
- package/dist/components/code-block/CodeBlock.svelte +23 -4
- package/dist/components/code-block/CodeBlock.svelte.d.ts +8 -4
- package/dist/components/code-block/CodeBlockContent.svelte +7 -1
- package/dist/components/code-block/CodeBlockContent.svelte.d.ts +1 -0
- package/dist/components/code-block/CodeBlockLine.svelte +3 -1
- package/dist/components/code-block/CodeBlockLine.svelte.d.ts +1 -0
- package/dist/components/code-block/CodeBlockOverflow.svelte +32 -0
- package/dist/components/code-block/CodeBlockOverflow.svelte.d.ts +13 -0
- package/dist/components/code-block/index.d.ts +3 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/context/Context.svelte +46 -5
- package/dist/components/context/Context.svelte.d.ts +5 -1
- package/dist/components/conversation/index.d.ts +4 -0
- package/dist/components/file-tree/FileTree.svelte +35 -16
- package/dist/components/file-tree/FileTree.svelte.d.ts +7 -1
- package/dist/components/file-tree/FileTreeFile.svelte +3 -3
- package/dist/components/file-tree/FileTreeFile.svelte.d.ts +1 -0
- package/dist/components/file-tree/context.svelte.d.ts +2 -0
- package/dist/components/inline-citation/InlineCitation.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCardBody.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCarouselHeader.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCarouselIndex.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCarouselNext.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationCarouselPrev.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationQuote.svelte +0 -1
- package/dist/components/inline-citation/InlineCitationText.svelte +0 -1
- package/dist/components/jsx-preview/JSXPreviewContent.svelte +43 -31
- package/dist/components/jsx-preview/index.d.ts +1 -1
- package/dist/components/jsx-preview/parser.d.ts +18 -8
- package/dist/components/jsx-preview/parser.js +1 -1
- package/dist/components/message/MessageAction.svelte +45 -9
- package/dist/components/message/MessageAction.svelte.d.ts +2 -2
- package/dist/components/message/MessageAttachment.svelte +64 -0
- package/dist/components/message/MessageAttachment.svelte.d.ts +18 -0
- package/dist/components/message/MessageAttachmentPreview.svelte +51 -0
- package/dist/components/message/MessageAttachmentPreview.svelte.d.ts +9 -0
- package/dist/components/message/MessageAttachments.svelte +25 -0
- package/dist/components/message/MessageAttachments.svelte.d.ts +9 -0
- package/dist/components/message/MessageResponse.svelte +26 -8
- package/dist/components/message/MessageResponse.svelte.d.ts +5 -5
- package/dist/components/message/index.d.ts +8 -0
- package/dist/components/message/index.js +3 -0
- package/dist/components/prompt-input/PromptInput.svelte +17 -4
- package/dist/components/prompt-input/PromptInput.svelte.d.ts +3 -1
- package/dist/components/prompt-input/PromptInputActionAddAttachments.svelte +0 -1
- package/dist/components/prompt-input/PromptInputActionMenuContent.svelte +0 -1
- package/dist/components/prompt-input/PromptInputActionMenuTrigger.svelte +0 -1
- package/dist/components/prompt-input/PromptInputAttachment.svelte +31 -0
- package/dist/components/prompt-input/PromptInputAttachment.svelte.d.ts +9 -0
- package/dist/components/prompt-input/PromptInputAttachmentImagePreview.svelte +34 -0
- package/dist/components/prompt-input/PromptInputAttachmentImagePreview.svelte.d.ts +9 -0
- package/dist/components/prompt-input/PromptInputAttachments.svelte +22 -0
- package/dist/components/prompt-input/PromptInputAttachments.svelte.d.ts +10 -0
- package/dist/components/prompt-input/PromptInputBody.svelte +0 -1
- package/dist/components/prompt-input/PromptInputButton.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommand.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandEmpty.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandGroup.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandInput.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandList.svelte +0 -1
- package/dist/components/prompt-input/PromptInputCommandSeparator.svelte +0 -1
- package/dist/components/prompt-input/PromptInputFooter.svelte +0 -1
- package/dist/components/prompt-input/PromptInputHeader.svelte +0 -1
- package/dist/components/prompt-input/PromptInputHoverCardContent.svelte +0 -1
- package/dist/components/prompt-input/PromptInputHoverCardTrigger.svelte +0 -1
- package/dist/components/prompt-input/PromptInputSelectContent.svelte +0 -1
- package/dist/components/prompt-input/PromptInputSelectItem.svelte +0 -1
- package/dist/components/prompt-input/PromptInputSelectTrigger.svelte +0 -1
- package/dist/components/prompt-input/PromptInputSubmit.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTab.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTabBody.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTabItem.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTabLabel.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTabsList.svelte +0 -1
- package/dist/components/prompt-input/PromptInputTextarea.svelte +3 -3
- package/dist/components/prompt-input/PromptInputToolbar.svelte +14 -0
- package/dist/components/prompt-input/PromptInputToolbar.svelte.d.ts +9 -0
- package/dist/components/prompt-input/PromptInputTools.svelte +0 -1
- package/dist/components/prompt-input/context.svelte.d.ts +1 -0
- package/dist/components/prompt-input/index.d.ts +8 -0
- package/dist/components/prompt-input/index.js +4 -0
- package/dist/components/reasoning/index.d.ts +1 -0
- package/dist/components/response/index.d.ts +2 -0
- package/dist/components/response/index.js +1 -0
- package/dist/components/sandbox/SandboxHeader.svelte +13 -4
- package/dist/components/sandbox/SandboxHeader.svelte.d.ts +6 -5
- package/dist/components/sandbox/SandboxTabContent.svelte +1 -1
- package/dist/components/sandbox/SandboxTabs.svelte +2 -2
- package/dist/components/sandbox/SandboxTabs.svelte.d.ts +1 -0
- package/dist/components/sandbox/SandboxTabsTrigger.svelte +12 -2
- package/dist/components/sandbox/SandboxTabsTrigger.svelte.d.ts +4 -5
- package/dist/components/sandbox/context.svelte.d.ts +2 -0
- package/dist/components/snippet/index.d.ts +2 -2
- package/dist/components/stack-trace/StackTrace.svelte +6 -4
- package/dist/components/stack-trace/StackTrace.svelte.d.ts +2 -1
- package/dist/components/stack-trace/StackTraceCopyButton.svelte +48 -2
- package/dist/components/stack-trace/StackTraceHeader.svelte +37 -2
- package/dist/components/stack-trace/StackTraceHeader.svelte.d.ts +2 -2
- package/dist/components/suggestion/index.d.ts +1 -1
- package/dist/components/terminal/AnsiText.svelte +42 -0
- package/dist/components/terminal/AnsiText.svelte.d.ts +6 -0
- package/dist/components/terminal/Terminal.svelte +20 -10
- package/dist/components/terminal/Terminal.svelte.d.ts +2 -1
- package/dist/components/terminal/TerminalContent.svelte +2 -2
- package/dist/components/terminal/ansi.d.ts +12 -0
- package/dist/components/terminal/ansi.js +76 -0
- package/dist/components/tool/ToolHeader.svelte +4 -16
- package/dist/components/tool/ToolStatusBadge.svelte +4 -3
- package/dist/components/tool/index.d.ts +1 -1
- package/dist/components/tool/status.d.ts +4 -1
- package/dist/components/tool/status.js +7 -7
- package/dist/components/transcription/Transcription.svelte +22 -14
- package/dist/components/transcription/Transcription.svelte.d.ts +2 -1
- package/dist/components/transcription/TranscriptionSegment.svelte +1 -1
- package/dist/components/transcription/context.svelte.d.ts +1 -0
- package/dist/components/voice-selector/VoiceSelectorAccent.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorAge.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorAttributes.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorBullet.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorContent.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorDescription.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorDialog.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorEmpty.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorGender.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorGroup.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorInput.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorList.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorName.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorPreview.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorRoot.svelte.d.ts +1 -1
- package/dist/components/voice-selector/VoiceSelectorSeparator.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorShortcut.svelte +0 -1
- package/dist/components/voice-selector/VoiceSelectorTrigger.svelte +0 -1
- package/dist/components/workflow/index.d.ts +6 -0
- package/dist/components/workflow/index.js +3 -0
- package/dist/components/workflow/node/index.d.ts +1 -0
- package/dist/components/workflow/node/index.js +1 -0
- package/dist/components/workflow/panel/index.d.ts +1 -0
- package/dist/components/workflow/panel/index.js +1 -0
- package/dist/components/workflow/toolbar/index.d.ts +1 -0
- package/dist/components/workflow/toolbar/index.js +1 -0
- package/dist/context.svelte.d.ts +1 -0
- package/dist/contracts.d.ts +1 -1
- package/dist/generated-components.d.ts +2 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.js +8 -4
- package/dist/internal/Tooltip.svelte +124 -0
- package/dist/internal/Tooltip.svelte.d.ts +12 -0
- package/dist/parity-manifest.js +1 -0
- package/package.json +4 -3
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
<script lang="ts">
|
|
15
15
|
import type { Snippet } from 'svelte';
|
|
16
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
16
17
|
import { Check, Copy, Search } from '@lucide/svelte';
|
|
17
18
|
import { cn } from '../../utils.js';
|
|
18
19
|
|
|
19
|
-
interface Props {
|
|
20
|
+
interface Props extends Omit<HTMLAttributes<HTMLElement>, 'children' | 'class' | 'title'> {
|
|
20
21
|
segments?: TranscriptSegment[];
|
|
21
22
|
text?: string;
|
|
22
23
|
title?: string;
|
|
@@ -30,6 +31,8 @@
|
|
|
30
31
|
onsegmentclick?: (segment: TranscriptSegment) => void;
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
interface IndexedSegment { segment: TranscriptSegment; index: number; key: string; }
|
|
35
|
+
|
|
33
36
|
let {
|
|
34
37
|
segments = [],
|
|
35
38
|
text,
|
|
@@ -42,17 +45,20 @@
|
|
|
42
45
|
onseek,
|
|
43
46
|
onSeek,
|
|
44
47
|
onsegmentclick,
|
|
48
|
+
...rest
|
|
45
49
|
}: Props = $props();
|
|
46
50
|
|
|
47
51
|
import { provideTranscriptionContext, segmentEnd, segmentStart } from './context.svelte.js';
|
|
48
52
|
|
|
49
53
|
let copied = $state(false);
|
|
50
54
|
const transcriptText = $derived(text ?? segments.map((segment) => segment.text).join(' '));
|
|
51
|
-
const
|
|
52
|
-
const
|
|
55
|
+
const indexedSegments = $derived(segments.map((segment, index): IndexedSegment => ({ segment, index, key: `${segment.id ?? 'segment'}-${segmentStart(segment)}-${segmentEnd(segment)}-${index}` })));
|
|
56
|
+
const activeIndex = $derived(activeSegmentId === undefined
|
|
57
|
+
? segments.findIndex((segment) => segmentStart(segment) <= currentTime && currentTime < segmentEnd(segment))
|
|
58
|
+
: segments.findIndex((segment) => segment.id === activeSegmentId));
|
|
53
59
|
const visibleSegments = $derived(search.trim()
|
|
54
|
-
?
|
|
55
|
-
:
|
|
60
|
+
? indexedSegments.filter(({ segment }) => segment.text.toLowerCase().includes(search.trim().toLowerCase()) || segment.speaker?.toLowerCase().includes(search.trim().toLowerCase()))
|
|
61
|
+
: indexedSegments);
|
|
56
62
|
|
|
57
63
|
function formatTime(value?: number): string {
|
|
58
64
|
if (value === undefined || !Number.isFinite(value)) return '';
|
|
@@ -72,6 +78,7 @@
|
|
|
72
78
|
|
|
73
79
|
function selectSegment(segment: TranscriptSegment): void {
|
|
74
80
|
activeSegmentId = segment.id;
|
|
81
|
+
currentTime = segmentStart(segment);
|
|
75
82
|
onseek?.(segmentStart(segment));
|
|
76
83
|
if (onSeek !== onseek) onSeek?.(segmentStart(segment));
|
|
77
84
|
onsegmentclick?.(segment);
|
|
@@ -80,15 +87,16 @@
|
|
|
80
87
|
provideTranscriptionContext({
|
|
81
88
|
get segments() { return segments; },
|
|
82
89
|
get currentTime() { return currentTime; },
|
|
90
|
+
get activeIndex() { return activeIndex; },
|
|
83
91
|
seek(time) { currentTime = time; onseek?.(time); if (onSeek !== onseek) onSeek?.(time); },
|
|
84
92
|
get canSeek() { return Boolean(onseek || onSeek); },
|
|
85
93
|
});
|
|
86
94
|
</script>
|
|
87
95
|
|
|
88
|
-
<section class={cn('svadmin-ai-transcription', children && 'svadmin-ai-transcription--compound', className)}
|
|
96
|
+
<section aria-label={title} {...rest} class={cn('svadmin-ai-transcription', children && 'svadmin-ai-transcription--compound', className)} data-slot="transcription">
|
|
89
97
|
{#if children}
|
|
90
|
-
{#each
|
|
91
|
-
{@render children(segment, index)}
|
|
98
|
+
{#each indexedSegments.filter(({ segment }) => segment.text.trim()) as entry (entry.key)}
|
|
99
|
+
{@render children(entry.segment, entry.index)}
|
|
92
100
|
{/each}
|
|
93
101
|
{:else}
|
|
94
102
|
<header class="svadmin-ai-transcription__header">
|
|
@@ -102,12 +110,12 @@
|
|
|
102
110
|
</div>
|
|
103
111
|
{#if segments.length}
|
|
104
112
|
<ol class="svadmin-ai-transcription__segments" aria-label="Transcript segments">
|
|
105
|
-
{#each visibleSegments as
|
|
106
|
-
<li class={cn('svadmin-ai-transcription__segment',
|
|
107
|
-
<button type="button" onclick={() => selectSegment(segment)} aria-current={
|
|
108
|
-
<span class="svadmin-ai-transcription__time">{formatTime(segment
|
|
109
|
-
<span class="svadmin-ai-transcription__segment-copy">{#if segment.speaker}<strong>{segment.speaker}</strong>{/if}<span>{segment.text}</span></span>
|
|
110
|
-
{#if segment.confidence !== undefined}<span class="svadmin-ai-transcription__confidence" aria-label={`${Math.round(segment.confidence * 100)} percent confidence`}>{Math.round(segment.confidence * 100)}%</span>{/if}
|
|
113
|
+
{#each visibleSegments as entry (entry.key)}
|
|
114
|
+
<li class={cn('svadmin-ai-transcription__segment', activeIndex === entry.index && 'svadmin-ai-transcription__segment--active')}>
|
|
115
|
+
<button type="button" onclick={() => selectSegment(entry.segment)} aria-current={activeIndex === entry.index ? 'true' : undefined}>
|
|
116
|
+
<span class="svadmin-ai-transcription__time">{formatTime(segmentStart(entry.segment))}</span>
|
|
117
|
+
<span class="svadmin-ai-transcription__segment-copy">{#if entry.segment.speaker}<strong>{entry.segment.speaker}</strong>{/if}<span>{entry.segment.text}</span></span>
|
|
118
|
+
{#if entry.segment.confidence !== undefined}<span class="svadmin-ai-transcription__confidence" aria-label={`${Math.round(entry.segment.confidence * 100)} percent confidence`}>{Math.round(entry.segment.confidence * 100)}%</span>{/if}
|
|
111
119
|
</button>
|
|
112
120
|
</li>
|
|
113
121
|
{:else}
|
|
@@ -9,7 +9,8 @@ export interface TranscriptSegment {
|
|
|
9
9
|
confidence?: number;
|
|
10
10
|
}
|
|
11
11
|
import type { Snippet } from 'svelte';
|
|
12
|
-
|
|
12
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
13
|
+
interface Props extends Omit<HTMLAttributes<HTMLElement>, 'children' | 'class' | 'title'> {
|
|
13
14
|
segments?: TranscriptSegment[];
|
|
14
15
|
text?: string;
|
|
15
16
|
title?: string;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
interface Props extends Omit<HTMLButtonAttributes, 'children' | 'class'> { segment: TranscriptSegment; index: number; class?: string; children?: Snippet<[TranscriptSegment, boolean, boolean]>; }
|
|
8
8
|
let { segment, index, class: className = '', children, onclick, type = 'button', ...rest }: Props = $props();
|
|
9
9
|
const transcription = useTranscriptionContext('TranscriptionSegment');
|
|
10
|
-
const active = $derived(transcription.
|
|
10
|
+
const active = $derived(transcription.activeIndex === index);
|
|
11
11
|
const past = $derived(transcription.currentTime >= segmentEnd(segment));
|
|
12
12
|
function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }): void { onclick?.(event); if (!event.defaultPrevented && transcription.canSeek) transcription.seek(segmentStart(segment)); }
|
|
13
13
|
</script>
|
|
@@ -2,6 +2,7 @@ import type { TranscriptSegment } from './Transcription.svelte';
|
|
|
2
2
|
export interface TranscriptionContextValue {
|
|
3
3
|
readonly segments: TranscriptSegment[];
|
|
4
4
|
readonly currentTime: number;
|
|
5
|
+
readonly activeIndex: number;
|
|
5
6
|
seek(time: number): void;
|
|
6
7
|
readonly canSeek: boolean;
|
|
7
8
|
}
|
|
@@ -5,4 +5,3 @@
|
|
|
5
5
|
const labels: Record<string, string> = { american: 'US', british: 'UK', australian: 'AU', canadian: 'CA', irish: 'IE', scottish: 'SC', indian: 'IN', 'south-african': 'ZA', 'new-zealand': 'NZ', spanish: 'ES', french: 'FR', german: 'DE', italian: 'IT', portuguese: 'PT', brazilian: 'BR', mexican: 'MX', argentinian: 'AR', japanese: 'JP', chinese: 'CN', korean: 'KR', russian: 'RU', arabic: 'AR', dutch: 'NL', swedish: 'SE', norwegian: 'NO', danish: 'DK', finnish: 'FI', polish: 'PL', turkish: 'TR', greek: 'GR' };
|
|
6
6
|
</script>
|
|
7
7
|
<span {...rest} class={cn('inline-flex items-center text-xs text-muted-foreground', className)} data-slot="voice-selector-accent" aria-label={value ? `Accent: ${value}` : 'Accent'}>{#if children}{@render children()}{:else}{labels[value ?? ''] ?? value ?? ''}{/if}</span>
|
|
8
|
-
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
<script lang="ts">import type { Snippet } from 'svelte'; import type { HTMLAttributes } from 'svelte/elements'; import { cn } from '../../utils.js'; interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class'> { class?: string; children?: Snippet; } let { class: className = '', children, ...rest }: Props = $props();</script>
|
|
2
2
|
<span {...rest} class={cn('text-xs tabular-nums text-muted-foreground', className)} data-slot="voice-selector-age">{@render children?.()}</span>
|
|
3
|
-
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
<script lang="ts">import type { Snippet } from 'svelte'; import type { HTMLAttributes } from 'svelte/elements'; import { cn } from '../../utils.js'; interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> { class?: string; children?: Snippet; } let { class: className = '', children, ...rest }: Props = $props();</script>
|
|
2
2
|
<div {...rest} class={cn('flex items-center gap-1 text-xs', className)} data-slot="voice-selector-attributes">{@render children?.()}</div>
|
|
3
|
-
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
<script lang="ts">import type { Snippet } from 'svelte'; import type { HTMLAttributes } from 'svelte/elements'; import { cn } from '../../utils.js'; interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class'> { class?: string; children?: Snippet; } let { class: className = '', children, ...rest }: Props = $props();</script>
|
|
2
2
|
<span {...rest} class={cn('select-none text-border', className)} aria-hidden="true" data-slot="voice-selector-bullet">{#if children}{@render children()}{:else}•{/if}</span>
|
|
3
|
-
|
|
@@ -4,4 +4,3 @@
|
|
|
4
4
|
let { class: className = '', children, title = 'Voice Selector', ...rest }: Props = $props(); const selector = useVoiceSelector(); const titleId = $props.id();
|
|
5
5
|
</script>
|
|
6
6
|
{#if selector.open}<div {...rest} class={cn('absolute left-0 top-full z-40 mt-1 grid w-[min(28rem,calc(100vw-2rem))] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md', className)} role="dialog" aria-modal="false" aria-labelledby={`${titleId}-title`} data-slot="voice-selector-content"><h2 id={`${titleId}-title`} class="svadmin-ai__sr-only">{title}</h2>{@render children?.()}</div>{/if}
|
|
7
|
-
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
<script lang="ts">import type { Snippet } from 'svelte'; import type { HTMLAttributes } from 'svelte/elements'; import { cn } from '../../utils.js'; interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class'> { class?: string; children?: Snippet; } let { class: className = '', children, ...rest }: Props = $props();</script>
|
|
2
2
|
<span {...rest} class={cn('text-xs text-muted-foreground', className)} data-slot="voice-selector-description">{@render children?.()}</span>
|
|
3
|
-
|
|
@@ -4,4 +4,3 @@
|
|
|
4
4
|
let { class: className = '', children, title = 'Voice Selector', ...rest }: Props = $props(); const selector = useVoiceSelector(); const titleId = $props.id();
|
|
5
5
|
</script>
|
|
6
6
|
{#if selector.open}<div class="fixed inset-0 z-50 grid place-items-center bg-background/70 p-4" role="presentation" onclick={(event) => { if (event.target === event.currentTarget) selector.setOpen(false); }}><div {...rest} class={cn('grid max-h-[min(32rem,calc(100dvh-2rem))] w-[min(32rem,100%)] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md', className)} role="dialog" aria-modal="true" aria-labelledby={`${titleId}-title`} data-slot="voice-selector-dialog"><h2 id={`${titleId}-title`} class="svadmin-ai__sr-only">{title}</h2>{@render children?.()}</div></div>{/if}
|
|
7
|
-
|
|
@@ -2,4 +2,3 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte'; import { cn } from '../../utils.js'; import { useVoiceSelector } from './context.svelte.js'; let { class: className = '', children }: { class?: string; children?: Snippet } = $props(); const selector = useVoiceSelector();
|
|
3
3
|
</script>
|
|
4
4
|
{#if selector.visibleCount === 0}<p class={cn('px-3 py-8 text-center text-sm text-muted-foreground', className)} data-slot="voice-selector-empty">{#if children}{@render children()}{:else}No voices found.{/if}</p>{/if}
|
|
5
|
-
|
|
@@ -5,4 +5,3 @@
|
|
|
5
5
|
let { class: className = '', children, value, ...rest }: Props = $props();
|
|
6
6
|
</script>
|
|
7
7
|
<span {...rest} class={cn('inline-flex items-center text-xs text-muted-foreground', className)} data-slot="voice-selector-gender" aria-label={value ? `Gender: ${value}` : 'Gender'}>{#if children}{@render children()}{:else if value === 'male'}<Mars size={14} aria-hidden="true" />{:else if value === 'female'}<Venus size={14} aria-hidden="true" />{:else if value === 'transgender'}<Transgender size={14} aria-hidden="true" />{:else if value === 'androgyne'}<MarsStroke size={14} aria-hidden="true" />{:else if value === 'non-binary'}<NonBinary size={14} aria-hidden="true" />{:else if value === 'intersex'}<VenusAndMars size={14} aria-hidden="true" />{:else}<CircleSmall size={14} aria-hidden="true" />{/if}</span>
|
|
8
|
-
|
|
@@ -4,4 +4,3 @@
|
|
|
4
4
|
let { class: className = '', children, heading, ...rest }: Props = $props();
|
|
5
5
|
</script>
|
|
6
6
|
<div {...rest} class={cn('grid gap-0.5 p-1', className)} role="group" aria-label={heading} data-slot="voice-selector-group">{#if heading}<h3 class="px-3 py-1 text-xs font-medium text-muted-foreground">{heading}</h3>{/if}{@render children?.()}</div>
|
|
7
|
-
|
|
@@ -5,4 +5,3 @@
|
|
|
5
5
|
function input(event: Event & { currentTarget: EventTarget & HTMLInputElement }): void { selector.setQuery(event.currentTarget.value); oninput?.(event); }
|
|
6
6
|
</script>
|
|
7
7
|
<label class={cn('flex min-h-11 items-center gap-2 border-b border-border px-3', className)} data-slot="voice-selector-input"><Search size={15} aria-hidden="true" /><input {...rest} class="min-w-0 flex-1 border-0 bg-transparent text-sm outline-none" value={resolved} {placeholder} aria-label={rest['aria-label'] ?? 'Search voices'} oninput={input} /></label>
|
|
8
|
-
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
<script lang="ts">import type { Snippet } from 'svelte'; import type { HTMLAttributes } from 'svelte/elements'; import { cn } from '../../utils.js'; interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class'> { class?: string; children?: Snippet; } let { class: className = '', children, ...rest }: Props = $props();</script>
|
|
2
2
|
<span {...rest} class={cn('min-w-0 flex-1 truncate text-left font-medium', className)} data-slot="voice-selector-name">{@render children?.()}</span>
|
|
3
|
-
|
|
@@ -5,4 +5,3 @@
|
|
|
5
5
|
function click(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }): void { event.stopPropagation(); onclick?.(event); if (!event.defaultPrevented) { onPlay?.(); onplay?.(); } }
|
|
6
6
|
</script>
|
|
7
7
|
<button {...rest} type="button" class={cn('svadmin-ai__button svadmin-ai__button--ghost size-7 min-h-7 p-0', className)} aria-label={playing ? 'Pause preview' : 'Play preview'} disabled={loading || rest.disabled} data-slot="voice-selector-preview" onclick={click}>{#if children}{@render children(playing, loading)}{:else if loading}<LoaderCircle class="animate-spin" size={13} aria-hidden="true" />{:else if playing}<Pause size={13} aria-hidden="true" />{:else}<Play size={13} aria-hidden="true" />{/if}</button>
|
|
8
|
-
|
|
@@ -23,6 +23,6 @@ interface Props {
|
|
|
23
23
|
onchange?: (voice: VoiceOption | undefined) => void;
|
|
24
24
|
onpreview?: (voice: VoiceOption) => void;
|
|
25
25
|
}
|
|
26
|
-
declare const VoiceSelectorRoot: import("svelte").Component<Props, {}, "
|
|
26
|
+
declare const VoiceSelectorRoot: import("svelte").Component<Props, {}, "search" | "value">;
|
|
27
27
|
type VoiceSelectorRoot = ReturnType<typeof VoiceSelectorRoot>;
|
|
28
28
|
export default VoiceSelectorRoot;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
<script lang="ts">import type { HTMLAttributes } from 'svelte/elements'; import { cn } from '../../utils.js'; let { class: className = '', ...rest }: Omit<HTMLAttributes<HTMLDivElement>, 'class'> & { class?: string } = $props();</script>
|
|
2
2
|
<div {...rest} class={cn('my-1 h-px bg-border', className)} role="separator" data-slot="voice-selector-separator"></div>
|
|
3
|
-
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
<script lang="ts">import type { Snippet } from 'svelte'; import type { HTMLAttributes } from 'svelte/elements'; import { cn } from '../../utils.js'; interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'class'> { class?: string; children?: Snippet; } let { class: className = '', children, ...rest }: Props = $props();</script>
|
|
2
2
|
<span {...rest} class={cn('ml-auto text-xs text-muted-foreground', className)} data-slot="voice-selector-shortcut">{@render children?.()}</span>
|
|
3
|
-
|
|
@@ -5,4 +5,3 @@
|
|
|
5
5
|
function click(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }): void { onclick?.(event); if (!event.defaultPrevented) selector.setOpen(!selector.open); }
|
|
6
6
|
</script>
|
|
7
7
|
<button {...rest} type="button" class={cn('svadmin-ai__button svadmin-ai__button--ghost min-h-9 justify-between gap-2 px-3', className)} aria-haspopup="dialog" aria-expanded={selector.open} data-slot="voice-selector-trigger" onclick={click}>{#if children}{@render children(selector.value)}{:else}<span>{selector.value ?? 'Select voice'}</span>{/if}<ChevronsUpDown size={14} aria-hidden="true" /></button>
|
|
8
|
-
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Node, NodeAction, NodeContent, NodeDescription, NodeFooter, NodeHeader, NodeTitle, } from './node/index.js';
|
|
2
|
+
export type { NodeComponentProps, NodeHandles, NodeProps, NodeTypes } from './node/index.js';
|
|
3
|
+
export { Panel } from './panel/index.js';
|
|
4
|
+
export type { PanelPosition, PanelProps } from './panel/index.js';
|
|
5
|
+
export { Toolbar, Position } from './toolbar/index.js';
|
|
6
|
+
export type { NodeToolbarProps } from './toolbar/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../node/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../node/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../panel/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../panel/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../toolbar/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../toolbar/index.js';
|
package/dist/context.svelte.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { ChatMessage } from './contracts.js';
|
|
|
3
3
|
export interface ConversationContext {
|
|
4
4
|
readonly messages: ChatMessage[];
|
|
5
5
|
readonly isStreaming: boolean;
|
|
6
|
+
readonly isAtBottom: boolean;
|
|
6
7
|
scrollToBottom(): void;
|
|
7
8
|
registerContent(element: HTMLElement | null): void;
|
|
8
9
|
}
|
package/dist/contracts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AdminTool,
|
|
1
|
+
export type { AdminTool, AgentEvent, AgentProvider, ApprovalResponseOptions, ChatAttachment, ChatContext, ChatMessage, ChatMessagePart, ChatProvider, ChatSource, MessageStatus, ToolResult, ToolState, } from '@svadmin/core';
|
|
2
2
|
import type { ChatMessage, ChatMessagePart, ChatProvider } from '@svadmin/core';
|
|
3
3
|
export type ChatProviderResponse = ReturnType<ChatProvider['sendMessage']>;
|
|
4
4
|
export type ChatProviderStream = AsyncGenerator<ChatMessagePart | string, void, unknown>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { StaticDecode, TObject } from '@sinclair/typebox';
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
export type GeneratedComponentProps = Record<string, unknown>;
|
|
4
|
+
export type GeneratedComponentSchemaProps<Schema extends TObject> = StaticDecode<Schema> extends infer Props extends Record<string, unknown> ? Props : never;
|
|
4
5
|
export interface GeneratedComponentDefinition<Schema extends TObject = TObject> {
|
|
5
|
-
readonly component: Component<
|
|
6
|
+
readonly component: Component<GeneratedComponentSchemaProps<Schema>>;
|
|
6
7
|
readonly schema: Schema;
|
|
7
8
|
}
|
|
8
9
|
export interface RuntimeGeneratedComponentDefinition {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./context.svelte.js";
|
|
|
3
3
|
export * from "./generated-components.js";
|
|
4
4
|
export * from "./parity-manifest.js";
|
|
5
5
|
export { default as ChatDialog } from "./components/ChatDialog.svelte";
|
|
6
|
+
export type { ChatPersistenceErrorDetail, ChatPersistenceOperation, } from "./components/ChatDialog.svelte";
|
|
6
7
|
export { default as CopilotPanel } from "./components/CopilotPanel.svelte";
|
|
7
8
|
export { default as AICommandBar } from "./components/AICommandBar.svelte";
|
|
8
9
|
export { default as InsightCard } from "./components/InsightCard.svelte";
|
|
@@ -10,6 +11,8 @@ export { default as SmartSuggest } from "./components/SmartSuggest.svelte";
|
|
|
10
11
|
export { default as VoiceInput } from "./components/VoiceInput.svelte";
|
|
11
12
|
export { default as Response } from "./components/Response.svelte";
|
|
12
13
|
export { default as AIButton } from "./components/Primitive.svelte";
|
|
14
|
+
export { Action, Actions } from './components/action/index.js';
|
|
15
|
+
export { Code, CodeOverflow, CodeCopyButton, codeVariants } from './components/code/index.js';
|
|
13
16
|
export { Agent, AgentHeader, AgentContent, AgentInstructions, AgentTools, AgentTool, AgentOutput, } from "./components/agent/index.js";
|
|
14
17
|
export { Artifact, ArtifactHeader, ArtifactClose, ArtifactTitle, ArtifactDescription, ArtifactActions, ArtifactAction, ArtifactContent, } from "./components/artifact/index.js";
|
|
15
18
|
export { getMediaCategory, getAttachmentLabel, useAttachmentsContext, useAttachmentContext, Attachments, Attachment, AttachmentPreview, AttachmentInfo, AttachmentRemove, AttachmentHoverCard, AttachmentHoverCardTrigger, AttachmentHoverCardContent, AttachmentEmpty, } from "./components/attachments/index.js";
|
|
@@ -17,7 +20,7 @@ export { AudioPlayer, AudioPlayerElement, AudioPlayerControlBar, AudioPlayerPlay
|
|
|
17
20
|
export { Canvas } from "./components/canvas/index.js";
|
|
18
21
|
export { ChainOfThought, ChainOfThoughtHeader, ChainOfThoughtStep, ChainOfThoughtSearchResults, ChainOfThoughtSearchResult, ChainOfThoughtContent, ChainOfThoughtImage, } from "./components/chain-of-thought/index.js";
|
|
19
22
|
export { Checkpoint, CheckpointIcon, CheckpointTrigger, } from "./components/checkpoint/index.js";
|
|
20
|
-
export { highlightCode, CodeBlockContainer, CodeBlockHeader, CodeBlockTitle, CodeBlockFilename, CodeBlockActions, CodeBlockContent, CodeBlock, CodeBlockCopyButton, CodeBlockLanguageSelector, CodeBlockLanguageSelectorTrigger, CodeBlockLanguageSelectorValue, CodeBlockLanguageSelectorContent, CodeBlockLanguageSelectorItem, } from "./components/code-block/index.js";
|
|
23
|
+
export { highlightCode, CodeBlockContainer, CodeBlockHeader, CodeBlockTitle, CodeBlockFilename, CodeBlockActions, CodeBlockContent, CodeBlock, CodeBlockCopyButton, CodeBlockOverflow, CodeBlockLanguageSelector, CodeBlockLanguageSelectorTrigger, CodeBlockLanguageSelectorValue, CodeBlockLanguageSelectorContent, CodeBlockLanguageSelectorItem, } from "./components/code-block/index.js";
|
|
21
24
|
export { Commit, CommitHeader, CommitHash, CommitMessage, CommitMetadata, CommitSeparator, CommitInfo, CommitAuthor, CommitAuthorAvatar, CommitTimestamp, CommitActions, CommitCopyButton, CommitContent, CommitFiles, CommitFile, CommitFileInfo, CommitFileStatus, CommitFileIcon, CommitFilePath, CommitFileChanges, CommitFileAdditions, CommitFileDeletions, } from "./components/commit/index.js";
|
|
22
25
|
export { Confirmation, ConfirmationTitle, ConfirmationRequest, ConfirmationAccepted, ConfirmationRejected, ConfirmationActions, ConfirmationAction, } from "./components/confirmation/index.js";
|
|
23
26
|
export { Connection } from "./components/connection/index.js";
|
|
@@ -30,8 +33,8 @@ export { EnvironmentVariables, EnvironmentVariablesHeader, EnvironmentVariablesT
|
|
|
30
33
|
export { FileTree, FileTreeIcon, FileTreeName, FileTreeFolder, FileTreeFile, FileTreeActions, } from "./components/file-tree/index.js";
|
|
31
34
|
export { Image } from "./components/image/index.js";
|
|
32
35
|
export { InlineCitation, InlineCitationText, InlineCitationCard, InlineCitationCardTrigger, InlineCitationCardBody, InlineCitationCarousel, InlineCitationCarouselContent, InlineCitationCarouselItem, InlineCitationCarouselHeader, InlineCitationCarouselIndex, InlineCitationCarouselPrev, InlineCitationCarouselNext, InlineCitationSource, InlineCitationQuote, } from "./components/inline-citation/index.js";
|
|
33
|
-
export { useJSXPreview, JSXPreview, JSXPreviewContent, JSXPreviewError, } from "./components/jsx-preview/index.js";
|
|
34
|
-
export { Message, MessageContent, MessageAvatar, MessageActions, MessageAction, MessageBranch, MessageBranchContent, MessageBranchSelector, MessageBranchPrevious, MessageBranchNext, MessageBranchPage, MessageResponse, MessageToolbar, } from "./components/message/index.js";
|
|
36
|
+
export { completeJsxTags, defineJSXPreviewComponent, defineJSXPreviewSnippet, parseJSXPreview, useJSXPreview, validateJsx, JSXPreview, JSXPreviewContent, JSXPreviewError, } from "./components/jsx-preview/index.js";
|
|
37
|
+
export { Message, MessageContent, MessageAvatar, MessageActions, MessageAction, MessageBranch, MessageBranchContent, MessageBranchSelector, MessageBranchPrevious, MessageBranchNext, MessageBranchPage, MessageResponse, MessageToolbar, MessageAttachments, MessageAttachment, MessageAttachmentPreview, } from "./components/message/index.js";
|
|
35
38
|
export { useAudioDevices, MicSelector, MicSelectorTrigger, MicSelectorContent, MicSelectorInput, MicSelectorList, MicSelectorEmpty, MicSelectorItem, MicSelectorLabel, MicSelectorValue, } from "./components/mic-selector/index.js";
|
|
36
39
|
export { ModelSelector, ModelSelectorTrigger, ModelSelectorContent, ModelSelectorDialog, ModelSelectorInput, ModelSelectorList, ModelSelectorEmpty, ModelSelectorGroup, ModelSelectorItem, ModelSelectorShortcut, ModelSelectorSeparator, ModelSelectorLogo, ModelSelectorLogoGroup, ModelSelectorName, } from "./components/model-selector/index.js";
|
|
37
40
|
export { Node, NodeHeader, NodeTitle, NodeDescription, NodeAction, NodeContent, NodeFooter, } from "./components/node/index.js";
|
|
@@ -40,7 +43,7 @@ export { PackageInfoHeader, PackageInfoName, PackageInfoChangeType, PackageInfoV
|
|
|
40
43
|
export { Panel } from "./components/panel/index.js";
|
|
41
44
|
export { Persona } from "./components/persona/index.js";
|
|
42
45
|
export { Plan, PlanHeader, PlanTitle, PlanDescription, PlanAction, PlanContent, PlanFooter, PlanTrigger, } from "./components/plan/index.js";
|
|
43
|
-
export { usePromptInputController, useProviderAttachments, PromptInputProvider, usePromptInputAttachments, LocalReferencedSourcesContext, usePromptInputReferencedSources, PromptInputActionAddAttachments, PromptInputActionAddScreenshot, PromptInput, PromptInputBody, PromptInputTextarea, PromptInputHeader, PromptInputFooter, PromptInputTools, PromptInputButton, PromptInputActionMenu, PromptInputActionMenuTrigger, PromptInputActionMenuContent, PromptInputActionMenuItem, PromptInputSubmit, PromptInputSelect, PromptInputSelectTrigger, PromptInputSelectContent, PromptInputSelectItem, PromptInputSelectValue, PromptInputHoverCard, PromptInputHoverCardTrigger, PromptInputHoverCardContent, PromptInputTabsList, PromptInputTab, PromptInputTabLabel, PromptInputTabBody, PromptInputTabItem, PromptInputCommand, PromptInputCommandInput, PromptInputCommandList, PromptInputCommandEmpty, PromptInputCommandGroup, PromptInputCommandItem, PromptInputCommandSeparator, PromptInputSpeechButton, } from "./components/prompt-input/index.js";
|
|
46
|
+
export { usePromptInputController, useProviderAttachments, PromptInputProvider, usePromptInputAttachments, LocalReferencedSourcesContext, usePromptInputReferencedSources, PromptInputActionAddAttachments, PromptInputActionAddScreenshot, PromptInput, PromptInputBody, PromptInputTextarea, PromptInputHeader, PromptInputFooter, PromptInputTools, PromptInputToolbar, PromptInputAttachment, PromptInputAttachmentImagePreview, PromptInputAttachments, PromptInputButton, PromptInputActionMenu, PromptInputActionMenuTrigger, PromptInputActionMenuContent, PromptInputActionMenuItem, PromptInputSubmit, PromptInputSelect, PromptInputSelectTrigger, PromptInputSelectContent, PromptInputSelectItem, PromptInputSelectValue, PromptInputHoverCard, PromptInputHoverCardTrigger, PromptInputHoverCardContent, PromptInputTabsList, PromptInputTab, PromptInputTabLabel, PromptInputTabBody, PromptInputTabItem, PromptInputCommand, PromptInputCommandInput, PromptInputCommandList, PromptInputCommandEmpty, PromptInputCommandGroup, PromptInputCommandItem, PromptInputCommandSeparator, PromptInputSpeechButton, } from "./components/prompt-input/index.js";
|
|
44
47
|
export { Question, QuestionPrompt, QuestionDescription, QuestionOptions, QuestionOption, QuestionInput, QuestionActions, QuestionSubmit, } from "./components/question/index.js";
|
|
45
48
|
export { QueueItem, QueueItemIndicator, QueueItemContent, QueueItemDescription, QueueItemActions, QueueItemAction, QueueItemAttachment, QueueItemImage, QueueItemFile, QueueList, QueueSection, QueueSectionTrigger, QueueSectionLabel, QueueSectionContent, Queue, } from "./components/queue/index.js";
|
|
46
49
|
export { useReasoning, Reasoning, ReasoningTrigger, ReasoningContent, } from "./components/reasoning/index.js";
|
|
@@ -74,7 +77,7 @@ export type { ContextIconProps, TokensWithCostProps } from "./components/context
|
|
|
74
77
|
export type { ConnectionLineProps } from "./components/connection/index.js";
|
|
75
78
|
export type { FileTreeNode, FileTreeNodeType, FileTreeRenderContext, } from "./components/file-tree/index.js";
|
|
76
79
|
export type { GeneratedImageData, ImageProps, } from "./components/image/index.js";
|
|
77
|
-
export type { JSXPreviewContextValue } from "./components/jsx-preview/index.js";
|
|
80
|
+
export type { JSXPreviewBindings, JSXPreviewComponentDefinition, JSXPreviewComponentProps, JSXPreviewComponents, JSXPreviewContextValue, JSXPreviewElementNode, JSXPreviewElementTarget, JSXPreviewNode, JSXPreviewParseResult, JSXPreviewParserOptions, JSXPreviewSchemaProps, JSXPreviewSnippetDefinition, JSXPreviewSvelteComponentDefinition, JSXPreviewTextNode, } from "./components/jsx-preview/index.js";
|
|
78
81
|
export type { MicSelectorContextValue, MicSelectorProps, } from "./components/mic-selector/index.js";
|
|
79
82
|
export type { ModelOption } from "./components/model-selector/index.js";
|
|
80
83
|
export type { NodeComponentProps, NodeHandles, } from "./components/node/index.js";
|
|
@@ -100,6 +103,8 @@ export type { TranscriptSegment } from "./components/transcription/index.js";
|
|
|
100
103
|
export type { VoiceOption } from "./components/voice-selector/index.js";
|
|
101
104
|
export type { WebPreviewDevice } from "./components/web-preview/index.js";
|
|
102
105
|
export * as AgentParts from "./components/agent/index.js";
|
|
106
|
+
export * as ActionParts from './components/action/index.js';
|
|
107
|
+
export * as CodeParts from './components/code/index.js';
|
|
103
108
|
export * as ArtifactParts from "./components/artifact/index.js";
|
|
104
109
|
export * as AttachmentsParts from "./components/attachments/index.js";
|
|
105
110
|
export * as AudioPlayerParts from "./components/audio-player/index.js";
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export { default as SmartSuggest } from "./components/SmartSuggest.svelte";
|
|
|
11
11
|
export { default as VoiceInput } from "./components/VoiceInput.svelte";
|
|
12
12
|
export { default as Response } from "./components/Response.svelte";
|
|
13
13
|
export { default as AIButton } from "./components/Primitive.svelte";
|
|
14
|
+
export { Action, Actions } from './components/action/index.js';
|
|
15
|
+
export { Code, CodeOverflow, CodeCopyButton, codeVariants } from './components/code/index.js';
|
|
14
16
|
// Vercel AI Elements parity surface (49 component families).
|
|
15
17
|
export { Agent, AgentHeader, AgentContent, AgentInstructions, AgentTools, AgentTool, AgentOutput, } from "./components/agent/index.js";
|
|
16
18
|
export { Artifact, ArtifactHeader, ArtifactClose, ArtifactTitle, ArtifactDescription, ArtifactActions, ArtifactAction, ArtifactContent, } from "./components/artifact/index.js";
|
|
@@ -19,7 +21,7 @@ export { AudioPlayer, AudioPlayerElement, AudioPlayerControlBar, AudioPlayerPlay
|
|
|
19
21
|
export { Canvas } from "./components/canvas/index.js";
|
|
20
22
|
export { ChainOfThought, ChainOfThoughtHeader, ChainOfThoughtStep, ChainOfThoughtSearchResults, ChainOfThoughtSearchResult, ChainOfThoughtContent, ChainOfThoughtImage, } from "./components/chain-of-thought/index.js";
|
|
21
23
|
export { Checkpoint, CheckpointIcon, CheckpointTrigger, } from "./components/checkpoint/index.js";
|
|
22
|
-
export { highlightCode, CodeBlockContainer, CodeBlockHeader, CodeBlockTitle, CodeBlockFilename, CodeBlockActions, CodeBlockContent, CodeBlock, CodeBlockCopyButton, CodeBlockLanguageSelector, CodeBlockLanguageSelectorTrigger, CodeBlockLanguageSelectorValue, CodeBlockLanguageSelectorContent, CodeBlockLanguageSelectorItem, } from "./components/code-block/index.js";
|
|
24
|
+
export { highlightCode, CodeBlockContainer, CodeBlockHeader, CodeBlockTitle, CodeBlockFilename, CodeBlockActions, CodeBlockContent, CodeBlock, CodeBlockCopyButton, CodeBlockOverflow, CodeBlockLanguageSelector, CodeBlockLanguageSelectorTrigger, CodeBlockLanguageSelectorValue, CodeBlockLanguageSelectorContent, CodeBlockLanguageSelectorItem, } from "./components/code-block/index.js";
|
|
23
25
|
export { Commit, CommitHeader, CommitHash, CommitMessage, CommitMetadata, CommitSeparator, CommitInfo, CommitAuthor, CommitAuthorAvatar, CommitTimestamp, CommitActions, CommitCopyButton, CommitContent, CommitFiles, CommitFile, CommitFileInfo, CommitFileStatus, CommitFileIcon, CommitFilePath, CommitFileChanges, CommitFileAdditions, CommitFileDeletions, } from "./components/commit/index.js";
|
|
24
26
|
export { Confirmation, ConfirmationTitle, ConfirmationRequest, ConfirmationAccepted, ConfirmationRejected, ConfirmationActions, ConfirmationAction, } from "./components/confirmation/index.js";
|
|
25
27
|
export { Connection } from "./components/connection/index.js";
|
|
@@ -32,8 +34,8 @@ export { EnvironmentVariables, EnvironmentVariablesHeader, EnvironmentVariablesT
|
|
|
32
34
|
export { FileTree, FileTreeIcon, FileTreeName, FileTreeFolder, FileTreeFile, FileTreeActions, } from "./components/file-tree/index.js";
|
|
33
35
|
export { Image } from "./components/image/index.js";
|
|
34
36
|
export { InlineCitation, InlineCitationText, InlineCitationCard, InlineCitationCardTrigger, InlineCitationCardBody, InlineCitationCarousel, InlineCitationCarouselContent, InlineCitationCarouselItem, InlineCitationCarouselHeader, InlineCitationCarouselIndex, InlineCitationCarouselPrev, InlineCitationCarouselNext, InlineCitationSource, InlineCitationQuote, } from "./components/inline-citation/index.js";
|
|
35
|
-
export { useJSXPreview, JSXPreview, JSXPreviewContent, JSXPreviewError, } from "./components/jsx-preview/index.js";
|
|
36
|
-
export { Message, MessageContent, MessageAvatar, MessageActions, MessageAction, MessageBranch, MessageBranchContent, MessageBranchSelector, MessageBranchPrevious, MessageBranchNext, MessageBranchPage, MessageResponse, MessageToolbar, } from "./components/message/index.js";
|
|
37
|
+
export { completeJsxTags, defineJSXPreviewComponent, defineJSXPreviewSnippet, parseJSXPreview, useJSXPreview, validateJsx, JSXPreview, JSXPreviewContent, JSXPreviewError, } from "./components/jsx-preview/index.js";
|
|
38
|
+
export { Message, MessageContent, MessageAvatar, MessageActions, MessageAction, MessageBranch, MessageBranchContent, MessageBranchSelector, MessageBranchPrevious, MessageBranchNext, MessageBranchPage, MessageResponse, MessageToolbar, MessageAttachments, MessageAttachment, MessageAttachmentPreview, } from "./components/message/index.js";
|
|
37
39
|
export { useAudioDevices, MicSelector, MicSelectorTrigger, MicSelectorContent, MicSelectorInput, MicSelectorList, MicSelectorEmpty, MicSelectorItem, MicSelectorLabel, MicSelectorValue, } from "./components/mic-selector/index.js";
|
|
38
40
|
export { ModelSelector, ModelSelectorTrigger, ModelSelectorContent, ModelSelectorDialog, ModelSelectorInput, ModelSelectorList, ModelSelectorEmpty, ModelSelectorGroup, ModelSelectorItem, ModelSelectorShortcut, ModelSelectorSeparator, ModelSelectorLogo, ModelSelectorLogoGroup, ModelSelectorName, } from "./components/model-selector/index.js";
|
|
39
41
|
export { Node, NodeHeader, NodeTitle, NodeDescription, NodeAction, NodeContent, NodeFooter, } from "./components/node/index.js";
|
|
@@ -42,7 +44,7 @@ export { PackageInfoHeader, PackageInfoName, PackageInfoChangeType, PackageInfoV
|
|
|
42
44
|
export { Panel } from "./components/panel/index.js";
|
|
43
45
|
export { Persona } from "./components/persona/index.js";
|
|
44
46
|
export { Plan, PlanHeader, PlanTitle, PlanDescription, PlanAction, PlanContent, PlanFooter, PlanTrigger, } from "./components/plan/index.js";
|
|
45
|
-
export { usePromptInputController, useProviderAttachments, PromptInputProvider, usePromptInputAttachments, LocalReferencedSourcesContext, usePromptInputReferencedSources, PromptInputActionAddAttachments, PromptInputActionAddScreenshot, PromptInput, PromptInputBody, PromptInputTextarea, PromptInputHeader, PromptInputFooter, PromptInputTools, PromptInputButton, PromptInputActionMenu, PromptInputActionMenuTrigger, PromptInputActionMenuContent, PromptInputActionMenuItem, PromptInputSubmit, PromptInputSelect, PromptInputSelectTrigger, PromptInputSelectContent, PromptInputSelectItem, PromptInputSelectValue, PromptInputHoverCard, PromptInputHoverCardTrigger, PromptInputHoverCardContent, PromptInputTabsList, PromptInputTab, PromptInputTabLabel, PromptInputTabBody, PromptInputTabItem, PromptInputCommand, PromptInputCommandInput, PromptInputCommandList, PromptInputCommandEmpty, PromptInputCommandGroup, PromptInputCommandItem, PromptInputCommandSeparator, PromptInputSpeechButton, } from "./components/prompt-input/index.js";
|
|
47
|
+
export { usePromptInputController, useProviderAttachments, PromptInputProvider, usePromptInputAttachments, LocalReferencedSourcesContext, usePromptInputReferencedSources, PromptInputActionAddAttachments, PromptInputActionAddScreenshot, PromptInput, PromptInputBody, PromptInputTextarea, PromptInputHeader, PromptInputFooter, PromptInputTools, PromptInputToolbar, PromptInputAttachment, PromptInputAttachmentImagePreview, PromptInputAttachments, PromptInputButton, PromptInputActionMenu, PromptInputActionMenuTrigger, PromptInputActionMenuContent, PromptInputActionMenuItem, PromptInputSubmit, PromptInputSelect, PromptInputSelectTrigger, PromptInputSelectContent, PromptInputSelectItem, PromptInputSelectValue, PromptInputHoverCard, PromptInputHoverCardTrigger, PromptInputHoverCardContent, PromptInputTabsList, PromptInputTab, PromptInputTabLabel, PromptInputTabBody, PromptInputTabItem, PromptInputCommand, PromptInputCommandInput, PromptInputCommandList, PromptInputCommandEmpty, PromptInputCommandGroup, PromptInputCommandItem, PromptInputCommandSeparator, PromptInputSpeechButton, } from "./components/prompt-input/index.js";
|
|
46
48
|
export { Question, QuestionPrompt, QuestionDescription, QuestionOptions, QuestionOption, QuestionInput, QuestionActions, QuestionSubmit, } from "./components/question/index.js";
|
|
47
49
|
export { QueueItem, QueueItemIndicator, QueueItemContent, QueueItemDescription, QueueItemActions, QueueItemAction, QueueItemAttachment, QueueItemImage, QueueItemFile, QueueList, QueueSection, QueueSectionTrigger, QueueSectionLabel, QueueSectionContent, Queue, } from "./components/queue/index.js";
|
|
48
50
|
export { useReasoning, Reasoning, ReasoningTrigger, ReasoningContent, } from "./components/reasoning/index.js";
|
|
@@ -65,6 +67,8 @@ export { useVoiceSelector, VoiceSelector, VoiceSelectorTrigger, VoiceSelectorCon
|
|
|
65
67
|
export { WebPreview, WebPreviewNavigation, WebPreviewNavigationButton, WebPreviewUrl, WebPreviewBody, WebPreviewConsole, } from "./components/web-preview/index.js";
|
|
66
68
|
export { provideWebPreviewContext, useWebPreviewContext, } from "./components/web-preview/context.svelte.js";
|
|
67
69
|
export * as AgentParts from "./components/agent/index.js";
|
|
70
|
+
export * as ActionParts from './components/action/index.js';
|
|
71
|
+
export * as CodeParts from './components/code/index.js';
|
|
68
72
|
export * as ArtifactParts from "./components/artifact/index.js";
|
|
69
73
|
export * as AttachmentsParts from "./components/attachments/index.js";
|
|
70
74
|
export * as AudioPlayerParts from "./components/audio-player/index.js";
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export interface TooltipTriggerState {
|
|
5
|
+
describedBy?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface TooltipProps {
|
|
9
|
+
content?: string;
|
|
10
|
+
children: Snippet<[TooltipTriggerState]>;
|
|
11
|
+
delay?: number;
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { onMount, tick } from 'svelte';
|
|
17
|
+
|
|
18
|
+
let { content, children, delay = 250 }: TooltipProps = $props();
|
|
19
|
+
const tooltipId = $props.id();
|
|
20
|
+
let anchor = $state<HTMLSpanElement>();
|
|
21
|
+
let tooltip = $state<HTMLDivElement>();
|
|
22
|
+
let open = $state(false);
|
|
23
|
+
let left = $state(0);
|
|
24
|
+
let top = $state(0);
|
|
25
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
26
|
+
|
|
27
|
+
function portal(node: HTMLElement): { destroy(): void } {
|
|
28
|
+
document.body.appendChild(node);
|
|
29
|
+
return {
|
|
30
|
+
destroy() {
|
|
31
|
+
node.remove();
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function clearTimer(): void {
|
|
37
|
+
if (timer !== undefined) clearTimeout(timer);
|
|
38
|
+
timer = undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function show(immediate = false): void {
|
|
42
|
+
if (!content) return;
|
|
43
|
+
clearTimer();
|
|
44
|
+
if (immediate) {
|
|
45
|
+
open = true;
|
|
46
|
+
void position();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
timer = setTimeout(() => {
|
|
50
|
+
open = true;
|
|
51
|
+
void position();
|
|
52
|
+
}, delay);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function hide(): void {
|
|
56
|
+
clearTimer();
|
|
57
|
+
open = false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function position(): Promise<void> {
|
|
61
|
+
if (!open) return;
|
|
62
|
+
await tick();
|
|
63
|
+
if (!anchor || !tooltip) return;
|
|
64
|
+
|
|
65
|
+
const anchorRect = anchor.getBoundingClientRect();
|
|
66
|
+
const tooltipRect = tooltip.getBoundingClientRect();
|
|
67
|
+
const gap = 8;
|
|
68
|
+
const viewportPadding = 8;
|
|
69
|
+
const centeredLeft = anchorRect.left + anchorRect.width / 2 - tooltipRect.width / 2;
|
|
70
|
+
left = Math.min(
|
|
71
|
+
Math.max(centeredLeft, viewportPadding),
|
|
72
|
+
Math.max(viewportPadding, window.innerWidth - tooltipRect.width - viewportPadding),
|
|
73
|
+
);
|
|
74
|
+
const above = anchorRect.top - tooltipRect.height - gap;
|
|
75
|
+
top = above >= viewportPadding ? above : anchorRect.bottom + gap;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function handleFocusOut(event: FocusEvent): void {
|
|
79
|
+
if (!anchor?.contains(event.relatedTarget as Node | null)) hide();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function handleKeydown(event: KeyboardEvent): void {
|
|
83
|
+
if (event.key === 'Escape' && open) hide();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
onMount(() => {
|
|
87
|
+
const handleScroll = () => void position();
|
|
88
|
+
document.addEventListener('scroll', handleScroll, true);
|
|
89
|
+
return () => document.removeEventListener('scroll', handleScroll, true);
|
|
90
|
+
});
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<svelte:window onkeydown={handleKeydown} onresize={position} onscroll={position} />
|
|
94
|
+
|
|
95
|
+
<span
|
|
96
|
+
bind:this={anchor}
|
|
97
|
+
class="svadmin-ai-tooltip__anchor"
|
|
98
|
+
role="presentation"
|
|
99
|
+
onpointerenter={() => show()}
|
|
100
|
+
onpointerleave={hide}
|
|
101
|
+
onfocusin={() => show(true)}
|
|
102
|
+
onfocusout={handleFocusOut}
|
|
103
|
+
>
|
|
104
|
+
{@render children({ describedBy: content ? tooltipId : undefined })}
|
|
105
|
+
</span>
|
|
106
|
+
|
|
107
|
+
{#if content && open}
|
|
108
|
+
<div
|
|
109
|
+
use:portal
|
|
110
|
+
bind:this={tooltip}
|
|
111
|
+
id={tooltipId}
|
|
112
|
+
class="svadmin-ai-tooltip"
|
|
113
|
+
role="tooltip"
|
|
114
|
+
style:left={`${left}px`}
|
|
115
|
+
style:top={`${top}px`}
|
|
116
|
+
>
|
|
117
|
+
{content}
|
|
118
|
+
</div>
|
|
119
|
+
{/if}
|
|
120
|
+
|
|
121
|
+
<style>
|
|
122
|
+
.svadmin-ai-tooltip__anchor { display: inline-flex; }
|
|
123
|
+
.svadmin-ai-tooltip { position: fixed; z-index: 1000; width: max-content; max-width: min(16rem, calc(100vw - 1rem)); padding: 0.375rem 0.5rem; border: 1px solid var(--border, transparent); border-radius: min(var(--radius, 0.5rem), 0.375rem); background: var(--popover, var(--foreground, CanvasText)); color: var(--popover-foreground, var(--background, Canvas)); box-shadow: 0 0.25rem 0.75rem color-mix(in srgb, var(--foreground, CanvasText) 14%, transparent); font-size: 0.75rem; line-height: 1.25; pointer-events: none; }
|
|
124
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface TooltipTriggerState {
|
|
3
|
+
describedBy?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TooltipProps {
|
|
6
|
+
content?: string;
|
|
7
|
+
children: Snippet<[TooltipTriggerState]>;
|
|
8
|
+
delay?: number;
|
|
9
|
+
}
|
|
10
|
+
declare const Tooltip: import("svelte").Component<TooltipProps, {}, "">;
|
|
11
|
+
type Tooltip = ReturnType<typeof Tooltip>;
|
|
12
|
+
export default Tooltip;
|
package/dist/parity-manifest.js
CHANGED
|
@@ -257,6 +257,7 @@ export const AI_ELEMENT_PARITY = [
|
|
|
257
257
|
official: 'Tool getStatusBadge ToolHeader ToolContent ToolInput ToolOutput',
|
|
258
258
|
exact: 'Tool getStatusBadge ToolHeader ToolContent ToolInput ToolOutput',
|
|
259
259
|
helpers: 'getStatusBadge',
|
|
260
|
+
behavior: 'intentional-difference',
|
|
260
261
|
}),
|
|
261
262
|
family('toolbar', 'Toolbar', {
|
|
262
263
|
official: 'Toolbar',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ai-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Composable Svelte 5 AI interaction components for SVAdmin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@svadmin/core": "^0.
|
|
53
|
+
"@svadmin/core": "^0.49.0",
|
|
54
54
|
"@tanstack/svelte-query": "^6.1.48",
|
|
55
55
|
"svelte": "^5.56.10"
|
|
56
56
|
},
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && bun scripts/clean-dist.ts",
|
|
84
84
|
"check": "svelte-check --tsgo-experimental-api --tsconfig ./tsconfig.json --threshold error",
|
|
85
|
-
"test": "vitest run --config ./vitest.config.ts && bun test scripts/clean-dist.test.ts"
|
|
85
|
+
"test": "vitest run --config ./vitest.config.ts && bun test scripts/clean-dist.test.ts scripts/audit-upstream-parity.test.ts",
|
|
86
|
+
"audit:upstream": "bun scripts/audit-upstream-parity.ts"
|
|
86
87
|
},
|
|
87
88
|
"license": "MIT",
|
|
88
89
|
"publishConfig": {
|