@svadmin/ai-elements 0.2.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 +27 -4
- package/dist/ai.css +35 -1
- package/dist/components/ChatDialog.svelte +10 -7
- 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 +21 -16
- package/dist/components/artifact/ArtifactAction.svelte.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/message/MessageAction.svelte +22 -16
- 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 +9 -7
- package/dist/components/message/MessageResponse.svelte.d.ts +1 -1
- package/dist/components/message/index.d.ts +6 -0
- package/dist/components/message/index.js +3 -0
- package/dist/components/prompt-input/PromptInput.svelte +1 -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/PromptInputToolbar.svelte +14 -0
- package/dist/components/prompt-input/PromptInputToolbar.svelte.d.ts +9 -0
- package/dist/components/prompt-input/index.d.ts +8 -0
- package/dist/components/prompt-input/index.js +4 -0
- package/dist/components/response/index.d.ts +2 -0
- package/dist/components/response/index.js +1 -0
- package/dist/components/tool/ToolHeader.svelte +4 -17
- package/dist/components/voice-selector/VoiceSelectorRoot.svelte.d.ts +1 -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/contracts.d.ts +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +7 -3
- package/dist/internal/Tooltip.svelte +124 -0
- package/dist/internal/Tooltip.svelte.d.ts +12 -0
- package/package.json +4 -3
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
export type MessageActionProps = Omit<HTMLButtonAttributes, 'children' | 'class' | 'size'> & {
|
|
6
6
|
tooltip?: string;
|
|
7
7
|
label?: string;
|
|
8
|
-
size?: 'sm' | 'default' | 'icon' | 'icon-sm';
|
|
9
|
-
variant?: 'default' | 'outline' | 'ghost';
|
|
8
|
+
size?: 'xs' | 'sm' | 'default' | 'lg' | 'icon-xs' | 'icon-sm' | 'icon' | 'icon-lg';
|
|
9
|
+
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
|
|
10
10
|
class?: string;
|
|
11
11
|
children?: Snippet;
|
|
12
12
|
};
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
<script lang="ts">
|
|
16
16
|
import { cn } from '../../utils.js';
|
|
17
|
+
import Tooltip from '../../internal/Tooltip.svelte';
|
|
17
18
|
|
|
18
19
|
let {
|
|
19
20
|
tooltip,
|
|
@@ -27,11 +28,11 @@
|
|
|
27
28
|
'aria-describedby': ariaDescribedBy,
|
|
28
29
|
...rest
|
|
29
30
|
}: MessageActionProps = $props();
|
|
30
|
-
const
|
|
31
|
-
const describedBy = $derived([ariaDescribedBy, tooltip ? tooltipId : undefined].filter(Boolean).join(' ') || undefined);
|
|
31
|
+
const actionChildren = $derived(children);
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
|
-
<
|
|
34
|
+
<Tooltip content={tooltip}>
|
|
35
|
+
{#snippet children({ describedBy: tooltipDescribedBy })}
|
|
35
36
|
<button
|
|
36
37
|
{...rest}
|
|
37
38
|
{type}
|
|
@@ -40,25 +41,30 @@
|
|
|
40
41
|
data-slot="message-action"
|
|
41
42
|
data-size={size}
|
|
42
43
|
data-variant={variant}
|
|
43
|
-
aria-describedby={
|
|
44
|
+
aria-describedby={[ariaDescribedBy, tooltipDescribedBy].filter(Boolean).join(' ') || undefined}
|
|
44
45
|
>
|
|
45
|
-
{@render
|
|
46
|
+
{@render actionChildren?.()}
|
|
46
47
|
{#if label || tooltip}<span class="svadmin-ai__sr-only">{label ?? tooltip}</span>{/if}
|
|
47
48
|
</button>
|
|
48
|
-
{
|
|
49
|
-
</
|
|
49
|
+
{/snippet}
|
|
50
|
+
</Tooltip>
|
|
50
51
|
|
|
51
52
|
<style>
|
|
52
|
-
.svadmin-ai-message-action__anchor { position: relative; display: inline-flex; }
|
|
53
53
|
.svadmin-ai-message-action { display: inline-flex; min-height: 2rem; align-items: center; justify-content: center; gap: 0.375rem; border: 1px solid transparent; border-radius: min(var(--radius, 0.5rem), 0.375rem); padding: 0.375rem 0.625rem; background: transparent; color: var(--muted-foreground, currentColor); font: inherit; font-size: 0.8125rem; cursor: pointer; }
|
|
54
|
-
.svadmin-ai-message-action[data-size='
|
|
54
|
+
.svadmin-ai-message-action[data-size='xs'] { min-height: 1.5rem; padding: 0.2rem 0.4rem; font-size: 0.75rem; }
|
|
55
|
+
.svadmin-ai-message-action[data-size='lg'] { min-height: 2.5rem; padding-inline: 1rem; }
|
|
56
|
+
.svadmin-ai-message-action[data-size^='icon'] { width: 2rem; padding: 0; }
|
|
57
|
+
.svadmin-ai-message-action[data-size='icon-xs'] { width: 1.5rem; min-height: 1.5rem; }
|
|
58
|
+
.svadmin-ai-message-action[data-size='icon-lg'] { width: 2.5rem; min-height: 2.5rem; }
|
|
55
59
|
.svadmin-ai-message-action[data-variant='outline'] { border-color: var(--border, currentColor); }
|
|
56
60
|
.svadmin-ai-message-action[data-variant='default'] { background: var(--primary, currentColor); color: var(--primary-foreground, Canvas); }
|
|
57
|
-
.svadmin-ai-message-action
|
|
61
|
+
.svadmin-ai-message-action[data-variant='secondary'] { background: var(--secondary, var(--muted, transparent)); color: var(--secondary-foreground, var(--foreground, currentColor)); }
|
|
62
|
+
.svadmin-ai-message-action[data-variant='destructive'] { background: var(--destructive, currentColor); color: var(--destructive-foreground, Canvas); }
|
|
63
|
+
.svadmin-ai-message-action[data-variant='link'] { padding-inline: 0; color: var(--primary, currentColor); text-decoration: underline; text-underline-offset: 0.2rem; }
|
|
64
|
+
.svadmin-ai-message-action[data-variant='ghost']:hover:not(:disabled), .svadmin-ai-message-action[data-variant='outline']:hover:not(:disabled) { background: var(--muted, transparent); color: var(--foreground, currentColor); }
|
|
65
|
+
.svadmin-ai-message-action[data-variant='default']:hover:not(:disabled) { background: color-mix(in oklch, var(--primary, currentColor) 88%, var(--background, Canvas)); color: var(--primary-foreground, Canvas); }
|
|
66
|
+
.svadmin-ai-message-action[data-variant='secondary']:hover:not(:disabled) { background: color-mix(in oklch, var(--secondary, var(--muted, transparent)) 80%, var(--foreground, currentColor)); color: var(--secondary-foreground, var(--foreground, currentColor)); }
|
|
67
|
+
.svadmin-ai-message-action[data-variant='destructive']:hover:not(:disabled) { background: color-mix(in oklch, var(--destructive, currentColor) 88%, var(--background, Canvas)); color: var(--destructive-foreground, Canvas); }
|
|
58
68
|
.svadmin-ai-message-action:disabled { cursor: not-allowed; opacity: 0.5; }
|
|
59
69
|
.svadmin-ai-message-action:focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }
|
|
60
|
-
.svadmin-ai-message-action__tooltip { position: absolute; z-index: 50; bottom: calc(100% + 0.5rem); left: 50%; width: max-content; max-width: 16rem; transform: translateX(-50%); visibility: hidden; border-radius: min(var(--radius, 0.5rem), 0.375rem); padding: 0.375rem 0.5rem; background: var(--popover, var(--foreground, currentColor)); color: var(--popover-foreground, var(--background, Canvas)); font-size: 0.75rem; line-height: 1.25; opacity: 0; pointer-events: none; transition: opacity 120ms ease, visibility 120ms ease; }
|
|
61
|
-
.svadmin-ai-message-action__anchor:hover .svadmin-ai-message-action__tooltip,
|
|
62
|
-
.svadmin-ai-message-action__anchor:focus-within .svadmin-ai-message-action__tooltip { visibility: visible; opacity: 1; }
|
|
63
|
-
@media (prefers-reduced-motion: reduce) { .svadmin-ai-message-action__tooltip { transition: none; } }
|
|
64
70
|
</style>
|
|
@@ -3,8 +3,8 @@ import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
|
3
3
|
export type MessageActionProps = Omit<HTMLButtonAttributes, 'children' | 'class' | 'size'> & {
|
|
4
4
|
tooltip?: string;
|
|
5
5
|
label?: string;
|
|
6
|
-
size?: 'sm' | 'default' | 'icon' | 'icon-sm';
|
|
7
|
-
variant?: 'default' | 'outline' | 'ghost';
|
|
6
|
+
size?: 'xs' | 'sm' | 'default' | 'lg' | 'icon-xs' | 'icon-sm' | 'icon' | 'icon-lg';
|
|
7
|
+
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
|
|
8
8
|
class?: string;
|
|
9
9
|
children?: Snippet;
|
|
10
10
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
export interface MessageAttachmentData {
|
|
6
|
+
id: string;
|
|
7
|
+
filename?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
mediaType?: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface MessageAttachmentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> {
|
|
14
|
+
data: MessageAttachmentData;
|
|
15
|
+
class?: string;
|
|
16
|
+
onRemove?: () => void;
|
|
17
|
+
children?: Snippet;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import { Paperclip, X } from '@lucide/svelte';
|
|
23
|
+
import { cn, safeResourceUrl } from '../../utils.js';
|
|
24
|
+
import MessageAttachmentPreview from './MessageAttachmentPreview.svelte';
|
|
25
|
+
|
|
26
|
+
let { data, class: className = '', onRemove, children, ...rest }: MessageAttachmentProps = $props();
|
|
27
|
+
const filename = $derived(data.filename ?? data.name ?? '');
|
|
28
|
+
const isImage = $derived(Boolean(data.url && data.mediaType?.startsWith('image/')));
|
|
29
|
+
const safeUrl = $derived(safeResourceUrl(data.url));
|
|
30
|
+
|
|
31
|
+
function remove(event: MouseEvent): void {
|
|
32
|
+
event.stopPropagation();
|
|
33
|
+
onRemove?.();
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div {...rest} class={cn('svadmin-ai-message-attachment', className)} data-slot="message-attachment" data-media={isImage ? 'image' : 'file'}>
|
|
38
|
+
{#if children}
|
|
39
|
+
{@render children()}
|
|
40
|
+
{:else if isImage && safeUrl}
|
|
41
|
+
<MessageAttachmentPreview {data} />
|
|
42
|
+
{:else}
|
|
43
|
+
<div class="svadmin-ai-message-attachment__file" title={filename || 'Attachment'}>
|
|
44
|
+
<Paperclip size={16} aria-hidden="true" />
|
|
45
|
+
<span>{filename || 'Attachment'}</span>
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
48
|
+
{#if onRemove}
|
|
49
|
+
<button class="svadmin-ai-message-attachment__remove" type="button" aria-label="Remove attachment" title="Remove attachment" onclick={remove}>
|
|
50
|
+
<X size={13} aria-hidden="true" />
|
|
51
|
+
</button>
|
|
52
|
+
{/if}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.svadmin-ai-message-attachment { position: relative; width: 6rem; height: 6rem; overflow: hidden; border: 1px solid var(--border, currentColor); border-radius: min(var(--radius, .5rem), .5rem); background: var(--muted, transparent); color: var(--foreground, currentColor); }
|
|
57
|
+
.svadmin-ai-message-attachment[data-media='file'] { display: flex; width: auto; min-width: 8rem; max-width: min(18rem, 100%); height: 2.25rem; align-items: center; padding: .35rem .6rem; background: var(--card, transparent); }
|
|
58
|
+
.svadmin-ai-message-attachment__file { display: flex; min-width: 0; align-items: center; gap: .45rem; color: var(--muted-foreground, currentColor); font-size: .78rem; }
|
|
59
|
+
.svadmin-ai-message-attachment__file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
60
|
+
.svadmin-ai-message-attachment__remove { position: absolute; top: .35rem; right: .35rem; display: inline-flex; width: 1.5rem; height: 1.5rem; align-items: center; justify-content: center; border: 1px solid var(--border, currentColor); border-radius: 999px; background: color-mix(in oklch, var(--background, transparent) 86%, transparent); color: var(--muted-foreground, currentColor); cursor: pointer; opacity: 0; }
|
|
61
|
+
.svadmin-ai-message-attachment:hover .svadmin-ai-message-attachment__remove, .svadmin-ai-message-attachment__remove:focus-visible { opacity: 1; }
|
|
62
|
+
.svadmin-ai-message-attachment__remove:hover { color: var(--destructive, currentColor); }
|
|
63
|
+
.svadmin-ai-message-attachment__remove:focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }
|
|
64
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export interface MessageAttachmentData {
|
|
4
|
+
id: string;
|
|
5
|
+
filename?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
mediaType?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MessageAttachmentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> {
|
|
11
|
+
data: MessageAttachmentData;
|
|
12
|
+
class?: string;
|
|
13
|
+
onRemove?: () => void;
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
}
|
|
16
|
+
declare const MessageAttachment: import("svelte").Component<MessageAttachmentProps, {}, "">;
|
|
17
|
+
type MessageAttachment = ReturnType<typeof MessageAttachment>;
|
|
18
|
+
export default MessageAttachment;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { MessageAttachmentData } from './MessageAttachment.svelte';
|
|
4
|
+
|
|
5
|
+
export interface MessageAttachmentPreviewProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'class'> {
|
|
6
|
+
data: MessageAttachmentData;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { X } from '@lucide/svelte';
|
|
13
|
+
import { cn, safeResourceUrl } from '../../utils.js';
|
|
14
|
+
|
|
15
|
+
let { data, class: className = '', ...rest }: MessageAttachmentPreviewProps = $props();
|
|
16
|
+
const src = $derived(safeResourceUrl(data.url));
|
|
17
|
+
const label = $derived(data.filename ?? data.name ?? 'Image attachment');
|
|
18
|
+
let dialog = $state<HTMLDialogElement | null>(null);
|
|
19
|
+
|
|
20
|
+
function openPreview(): void {
|
|
21
|
+
if (typeof dialog?.showModal === 'function') dialog.showModal();
|
|
22
|
+
else dialog?.setAttribute('open', '');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function closePreview(): void {
|
|
26
|
+
if (typeof dialog?.close === 'function') dialog.close();
|
|
27
|
+
else dialog?.removeAttribute('open');
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<button {...rest} class={cn('svadmin-ai-message-attachment-preview', className)} type="button" aria-label={`Preview ${label}`} onclick={openPreview}>
|
|
32
|
+
{#if src}<img src={src} alt={label} width="96" height="96" />{:else}<X aria-hidden="true" />{/if}
|
|
33
|
+
</button>
|
|
34
|
+
{#if src}
|
|
35
|
+
<dialog bind:this={dialog} class="svadmin-ai-message-attachment-dialog" aria-label={`${label} preview`} onclick={(event) => { if (event.target === dialog) closePreview(); }}>
|
|
36
|
+
<button type="button" class="svadmin-ai-message-attachment-dialog__close" aria-label="Close preview" onclick={closePreview}><X size={18} aria-hidden="true" /></button>
|
|
37
|
+
<img src={src} alt={`${label} preview`} />
|
|
38
|
+
</dialog>
|
|
39
|
+
{/if}
|
|
40
|
+
|
|
41
|
+
<style>
|
|
42
|
+
.svadmin-ai-message-attachment-preview { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
|
|
43
|
+
.svadmin-ai-message-attachment-preview img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
|
|
44
|
+
.svadmin-ai-message-attachment-preview:hover img { transform: scale(1.03); }
|
|
45
|
+
.svadmin-ai-message-attachment-preview:focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: -2px; }
|
|
46
|
+
.svadmin-ai-message-attachment-dialog { width: min(94vw, 68rem); max-width: none; max-height: 88vh; padding: 2.5rem 1rem 1rem; border: 1px solid var(--border, currentColor); border-radius: min(var(--radius, .5rem), .5rem); background: var(--background, Canvas); color: var(--foreground, currentColor); }
|
|
47
|
+
.svadmin-ai-message-attachment-dialog::backdrop { background: color-mix(in oklch, var(--foreground, currentColor) 45%, transparent); }
|
|
48
|
+
.svadmin-ai-message-attachment-dialog img { display: block; width: 100%; max-height: calc(88vh - 3.5rem); object-fit: contain; }
|
|
49
|
+
.svadmin-ai-message-attachment-dialog__close { position: absolute; top: .5rem; right: .5rem; display: inline-flex; width: 2rem; height: 2rem; align-items: center; justify-content: center; border: 1px solid var(--border, currentColor); border-radius: min(var(--radius, .5rem), .375rem); background: var(--background, Canvas); color: var(--foreground, currentColor); cursor: pointer; }
|
|
50
|
+
.svadmin-ai-message-attachment-dialog__close:focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }
|
|
51
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { MessageAttachmentData } from './MessageAttachment.svelte';
|
|
3
|
+
export interface MessageAttachmentPreviewProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'class'> {
|
|
4
|
+
data: MessageAttachmentData;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const MessageAttachmentPreview: import("svelte").Component<MessageAttachmentPreviewProps, {}, "">;
|
|
8
|
+
type MessageAttachmentPreview = ReturnType<typeof MessageAttachmentPreview>;
|
|
9
|
+
export default MessageAttachmentPreview;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
export interface MessageAttachmentsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> {
|
|
6
|
+
class?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { cn } from '../../utils.js';
|
|
13
|
+
|
|
14
|
+
let { class: className = '', children, ...rest }: MessageAttachmentsProps = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{#if children}
|
|
18
|
+
<div {...rest} class={cn('svadmin-ai-message-attachments', className)} data-slot="message-attachments">
|
|
19
|
+
{@render children()}
|
|
20
|
+
</div>
|
|
21
|
+
{/if}
|
|
22
|
+
|
|
23
|
+
<style>
|
|
24
|
+
.svadmin-ai-message-attachments { display: flex; width: fit-content; max-width: 100%; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; gap: .5rem; margin-inline-start: auto; }
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export interface MessageAttachmentsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> {
|
|
4
|
+
class?: string;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
}
|
|
7
|
+
declare const MessageAttachments: import("svelte").Component<MessageAttachmentsProps, {}, "">;
|
|
8
|
+
type MessageAttachments = ReturnType<typeof MessageAttachments>;
|
|
9
|
+
export default MessageAttachments;
|
|
@@ -5,29 +5,31 @@
|
|
|
5
5
|
export type MessageResponseProps = Omit<ResponseProps, 'children' | 'streaming'> & {
|
|
6
6
|
streaming?: boolean;
|
|
7
7
|
isAnimating?: boolean;
|
|
8
|
-
children?: Snippet;
|
|
8
|
+
children?: Snippet | string;
|
|
9
9
|
};
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<script lang="ts">
|
|
13
13
|
import Response from '../Response.svelte';
|
|
14
|
-
import { cn } from '../../utils.js';
|
|
15
|
-
|
|
16
14
|
let {
|
|
17
15
|
content = '',
|
|
18
16
|
text,
|
|
19
17
|
streaming = false,
|
|
20
18
|
isAnimating,
|
|
21
|
-
class: className = '',
|
|
22
19
|
children,
|
|
20
|
+
class: className = '',
|
|
23
21
|
...rest
|
|
24
22
|
}: MessageResponseProps = $props();
|
|
25
23
|
</script>
|
|
26
24
|
|
|
27
|
-
{#if children}
|
|
28
|
-
<
|
|
25
|
+
{#if typeof children === 'string'}
|
|
26
|
+
<Response {...rest} content={children} streaming={isAnimating ?? streaming} class={className} />
|
|
27
|
+
{:else if text ?? content}
|
|
28
|
+
<Response {...rest} content={text ?? content} streaming={isAnimating ?? streaming} class={className} />
|
|
29
|
+
{:else if children}
|
|
30
|
+
<div {...rest} class={`svadmin-ai__markdown ${className}`.trim()}>
|
|
29
31
|
{@render children()}
|
|
30
32
|
</div>
|
|
31
33
|
{:else}
|
|
32
|
-
<Response {...rest} content=
|
|
34
|
+
<Response {...rest} content="" streaming={isAnimating ?? streaming} class={className} />
|
|
33
35
|
{/if}
|
|
@@ -3,7 +3,7 @@ import type { ResponseProps } from '../Response.svelte';
|
|
|
3
3
|
export type MessageResponseProps = Omit<ResponseProps, 'children' | 'streaming'> & {
|
|
4
4
|
streaming?: boolean;
|
|
5
5
|
isAnimating?: boolean;
|
|
6
|
-
children?: Snippet;
|
|
6
|
+
children?: Snippet | string;
|
|
7
7
|
};
|
|
8
8
|
declare const MessageResponse: import("svelte").Component<MessageResponseProps, {}, "">;
|
|
9
9
|
type MessageResponse = ReturnType<typeof MessageResponse>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { default, default as Root, default as Message } from '../Message.svelte';
|
|
2
|
+
export { default as MessageAttachments, default as Attachments } from './MessageAttachments.svelte';
|
|
3
|
+
export { default as MessageAttachment, default as Attachment } from './MessageAttachment.svelte';
|
|
4
|
+
export { default as MessageAttachmentPreview, default as AttachmentPreview } from './MessageAttachmentPreview.svelte';
|
|
2
5
|
export { default as Content, default as MessageContent } from '../MessageContent.svelte';
|
|
3
6
|
export { default as Avatar, default as MessageAvatar } from '../MessageAvatar.svelte';
|
|
4
7
|
export { default as Actions, default as MessageActions } from '../MessageActions.svelte';
|
|
@@ -16,3 +19,6 @@ export type { MessageContentProps } from '../MessageContent.svelte';
|
|
|
16
19
|
export type { MessageActionProps } from './MessageAction.svelte';
|
|
17
20
|
export type { MessageBranchContentProps } from './MessageBranchContent.svelte';
|
|
18
21
|
export type { MessageResponseProps } from './MessageResponse.svelte';
|
|
22
|
+
export type { MessageAttachmentsProps } from './MessageAttachments.svelte';
|
|
23
|
+
export type { MessageAttachmentData, MessageAttachmentProps } from './MessageAttachment.svelte';
|
|
24
|
+
export type { MessageAttachmentPreviewProps } from './MessageAttachmentPreview.svelte';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { default, default as Root, default as Message } from '../Message.svelte';
|
|
2
|
+
export { default as MessageAttachments, default as Attachments } from './MessageAttachments.svelte';
|
|
3
|
+
export { default as MessageAttachment, default as Attachment } from './MessageAttachment.svelte';
|
|
4
|
+
export { default as MessageAttachmentPreview, default as AttachmentPreview } from './MessageAttachmentPreview.svelte';
|
|
2
5
|
export { default as Content, default as MessageContent } from '../MessageContent.svelte';
|
|
3
6
|
export { default as Avatar, default as MessageAvatar } from '../MessageAvatar.svelte';
|
|
4
7
|
export { default as Actions, default as MessageActions } from '../MessageActions.svelte';
|
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
>
|
|
370
370
|
<input bind:this={inputElement} class="svadmin-ai__sr-only" type="file" {accept} {multiple} disabled={disabled} aria-label="Upload files" onchange={(event) => addFiles((event.currentTarget as HTMLInputElement).files ?? [])} />
|
|
371
371
|
{#if syncHiddenInput}<input type="hidden" name="message" value={activeText} />{/if}
|
|
372
|
-
{#if activeFiles.length > 0}
|
|
372
|
+
{#if activeFiles.length > 0 && !children}
|
|
373
373
|
<ul class="flex flex-wrap gap-2" aria-label="Attachments">
|
|
374
374
|
{#each activeFiles as file, index (file.id)}
|
|
375
375
|
<li class="flex min-w-0 items-center gap-1 rounded border border-border px-2 py-1 text-xs">
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { PromptInputFile } from './context.svelte.js';
|
|
4
|
+
export interface PromptInputAttachmentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'class'> {
|
|
5
|
+
data: PromptInputFile;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { Paperclip, X } from '@lucide/svelte';
|
|
12
|
+
import { cn, safeResourceUrl } from '../../utils.js';
|
|
13
|
+
import { usePromptInputAttachments } from './context.svelte.js';
|
|
14
|
+
import PromptInputAttachmentImagePreview from './PromptInputAttachmentImagePreview.svelte';
|
|
15
|
+
let { data, class: className = '', ...rest }: PromptInputAttachmentProps = $props();
|
|
16
|
+
const attachments = usePromptInputAttachments();
|
|
17
|
+
const isImage = $derived(Boolean(data.mediaType?.startsWith('image/') && safeResourceUrl(data.url)));
|
|
18
|
+
const label = $derived(data.filename ?? data.name ?? 'Attachment');
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div {...rest} class={cn('group relative flex h-8 max-w-full min-w-0 items-center gap-2 overflow-hidden rounded border border-border px-2 text-xs', isImage && 'size-16 p-0', className)} data-slot="prompt-input-attachment">
|
|
22
|
+
{#if isImage}
|
|
23
|
+
<PromptInputAttachmentImagePreview {data} />
|
|
24
|
+
{:else}
|
|
25
|
+
<Paperclip size={14} aria-hidden="true" />
|
|
26
|
+
<span class="truncate" title={label}>{label}</span>
|
|
27
|
+
{/if}
|
|
28
|
+
<button type="button" class="absolute right-0.5 top-0.5 inline-flex size-5 items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100" aria-label={`Remove ${label}`} title={`Remove ${label}`} onclick={() => attachments.remove(data.id)}>
|
|
29
|
+
<X size={12} aria-hidden="true" />
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { PromptInputFile } from './context.svelte.js';
|
|
3
|
+
export interface PromptInputAttachmentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'class'> {
|
|
4
|
+
data: PromptInputFile;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const PromptInputAttachment: import("svelte").Component<PromptInputAttachmentProps, {}, "">;
|
|
8
|
+
type PromptInputAttachment = ReturnType<typeof PromptInputAttachment>;
|
|
9
|
+
export default PromptInputAttachment;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { PromptInputFile } from './context.svelte.js';
|
|
4
|
+
export interface PromptInputAttachmentImagePreviewProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'class'> { data: PromptInputFile; class?: string; }
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { X } from '@lucide/svelte';
|
|
9
|
+
import { cn, safeResourceUrl } from '../../utils.js';
|
|
10
|
+
let { data, class: className = '', ...rest }: PromptInputAttachmentImagePreviewProps = $props();
|
|
11
|
+
const src = $derived(safeResourceUrl(data.url));
|
|
12
|
+
const label = $derived(data.filename ?? data.name ?? 'Image attachment');
|
|
13
|
+
let dialog = $state<HTMLDialogElement | null>(null);
|
|
14
|
+
function openPreview(): void { if (typeof dialog?.showModal === 'function') dialog.showModal(); else dialog?.setAttribute('open', ''); }
|
|
15
|
+
function closePreview(): void { if (typeof dialog?.close === 'function') dialog.close(); else dialog?.removeAttribute('open'); }
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<button {...rest} class={cn('block size-full cursor-zoom-in overflow-hidden', className)} type="button" aria-label={`Preview ${label}`} onclick={openPreview}>
|
|
19
|
+
{#if src}<img src={src} alt={label} width="64" height="64" class="size-full object-cover" />{/if}
|
|
20
|
+
</button>
|
|
21
|
+
{#if src}
|
|
22
|
+
<dialog bind:this={dialog} class="svadmin-ai-prompt-attachment-dialog" aria-label={`${label} preview`} onclick={(event) => { if (event.target === dialog) closePreview(); }}>
|
|
23
|
+
<button type="button" class="svadmin-ai-prompt-attachment-dialog__close" aria-label="Close preview" onclick={closePreview}><X size={18} aria-hidden="true" /></button>
|
|
24
|
+
<img src={src} alt={`${label} preview`} />
|
|
25
|
+
</dialog>
|
|
26
|
+
{/if}
|
|
27
|
+
|
|
28
|
+
<style>
|
|
29
|
+
.svadmin-ai-prompt-attachment-dialog { width: min(92vw, 60rem); max-width: none; max-height: 84vh; padding: 2.5rem 1rem 1rem; border: 1px solid var(--border, currentColor); border-radius: min(var(--radius, .5rem), .5rem); background: var(--background, Canvas); color: var(--foreground, currentColor); }
|
|
30
|
+
.svadmin-ai-prompt-attachment-dialog::backdrop { background: color-mix(in oklch, var(--foreground, currentColor) 45%, transparent); }
|
|
31
|
+
.svadmin-ai-prompt-attachment-dialog img { display: block; width: 100%; max-height: calc(84vh - 3.5rem); object-fit: contain; }
|
|
32
|
+
.svadmin-ai-prompt-attachment-dialog__close { position: absolute; top: .5rem; right: .5rem; display: inline-flex; width: 2rem; height: 2rem; align-items: center; justify-content: center; border: 1px solid var(--border, currentColor); border-radius: min(var(--radius, .5rem), .375rem); background: var(--background, Canvas); color: var(--foreground, currentColor); cursor: pointer; }
|
|
33
|
+
.svadmin-ai-prompt-attachment-dialog__close:focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { PromptInputFile } from './context.svelte.js';
|
|
3
|
+
export interface PromptInputAttachmentImagePreviewProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'class'> {
|
|
4
|
+
data: PromptInputFile;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const PromptInputAttachmentImagePreview: import("svelte").Component<PromptInputAttachmentImagePreviewProps, {}, "">;
|
|
8
|
+
type PromptInputAttachmentImagePreview = ReturnType<typeof PromptInputAttachmentImagePreview>;
|
|
9
|
+
export default PromptInputAttachmentImagePreview;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import type { PromptInputFile } from './context.svelte.js';
|
|
5
|
+
export interface PromptInputAttachmentsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> {
|
|
6
|
+
class?: string;
|
|
7
|
+
children?: Snippet<[PromptInputFile]>;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { cn } from '../../utils.js';
|
|
13
|
+
import { usePromptInputAttachments } from './context.svelte.js';
|
|
14
|
+
let { class: className = '', children, ...rest }: PromptInputAttachmentsProps = $props();
|
|
15
|
+
const context = usePromptInputAttachments();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div {...rest} class={cn('flex flex-wrap gap-2 overflow-hidden', className)} data-slot="prompt-input-attachments" aria-live="polite">
|
|
19
|
+
{#each context.files as file (file.id)}
|
|
20
|
+
{@render children?.(file)}
|
|
21
|
+
{/each}
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { PromptInputFile } from './context.svelte.js';
|
|
4
|
+
export interface PromptInputAttachmentsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> {
|
|
5
|
+
class?: string;
|
|
6
|
+
children?: Snippet<[PromptInputFile]>;
|
|
7
|
+
}
|
|
8
|
+
declare const PromptInputAttachments: import("svelte").Component<PromptInputAttachmentsProps, {}, "">;
|
|
9
|
+
type PromptInputAttachments = ReturnType<typeof PromptInputAttachments>;
|
|
10
|
+
export default PromptInputAttachments;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
export type PromptInputToolbarProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> & { class?: string; children?: Snippet };
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { cn } from '../../utils.js';
|
|
9
|
+
let { class: className = '', children, ...rest }: PromptInputToolbarProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div {...rest} class={cn('flex items-center justify-between gap-1 p-1', className)} data-slot="prompt-input-toolbar">
|
|
13
|
+
{@render children?.()}
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export type PromptInputToolbarProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> & {
|
|
4
|
+
class?: string;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const PromptInputToolbar: import("svelte").Component<PromptInputToolbarProps, {}, "">;
|
|
8
|
+
type PromptInputToolbar = ReturnType<typeof PromptInputToolbar>;
|
|
9
|
+
export default PromptInputToolbar;
|
|
@@ -5,6 +5,10 @@ export { default as Textarea, default as PromptInputTextarea } from './PromptInp
|
|
|
5
5
|
export { default as Header, default as PromptInputHeader } from './PromptInputHeader.svelte';
|
|
6
6
|
export { default as Footer, default as PromptInputFooter } from './PromptInputFooter.svelte';
|
|
7
7
|
export { default as Tools, default as PromptInputTools } from './PromptInputTools.svelte';
|
|
8
|
+
export { default as Toolbar, default as PromptInputToolbar } from './PromptInputToolbar.svelte';
|
|
9
|
+
export { default as Attachment, default as PromptInputAttachment } from './PromptInputAttachment.svelte';
|
|
10
|
+
export { default as AttachmentImagePreview, default as PromptInputAttachmentImagePreview } from './PromptInputAttachmentImagePreview.svelte';
|
|
11
|
+
export { default as Attachments, default as PromptInputAttachments } from './PromptInputAttachments.svelte';
|
|
8
12
|
export { default as Button, default as PromptInputButton } from './PromptInputButton.svelte';
|
|
9
13
|
export { default as ActionAddAttachments, default as PromptInputActionAddAttachments } from './PromptInputActionAddAttachments.svelte';
|
|
10
14
|
export { default as ActionAddScreenshot, default as PromptInputActionAddScreenshot } from './PromptInputActionAddScreenshot.svelte';
|
|
@@ -38,5 +42,9 @@ export { PROMPT_INPUT_REFERENCED_SOURCES as LocalReferencedSourcesContext, usePr
|
|
|
38
42
|
export type { PromptInputMessage, PromptInputProps, PromptInputSubmitDetail } from './PromptInput.svelte';
|
|
39
43
|
export type { PromptInputProviderProps } from './PromptInputProvider.svelte';
|
|
40
44
|
export type { PromptInputButtonProps, PromptInputButtonTooltip } from './PromptInputButton.svelte';
|
|
45
|
+
export type { PromptInputToolbarProps } from './PromptInputToolbar.svelte';
|
|
46
|
+
export type { PromptInputAttachmentProps } from './PromptInputAttachment.svelte';
|
|
47
|
+
export type { PromptInputAttachmentImagePreviewProps } from './PromptInputAttachmentImagePreview.svelte';
|
|
48
|
+
export type { PromptInputAttachmentsProps } from './PromptInputAttachments.svelte';
|
|
41
49
|
export type { PromptInputSpeechButtonProps } from './PromptInputSpeechButton.svelte';
|
|
42
50
|
export type { PromptInputAttachmentsContext, PromptInputController, PromptInputFile, PromptInputReferencedSourcesContext } from './context.svelte.js';
|
|
@@ -5,6 +5,10 @@ export { default as Textarea, default as PromptInputTextarea } from './PromptInp
|
|
|
5
5
|
export { default as Header, default as PromptInputHeader } from './PromptInputHeader.svelte';
|
|
6
6
|
export { default as Footer, default as PromptInputFooter } from './PromptInputFooter.svelte';
|
|
7
7
|
export { default as Tools, default as PromptInputTools } from './PromptInputTools.svelte';
|
|
8
|
+
export { default as Toolbar, default as PromptInputToolbar } from './PromptInputToolbar.svelte';
|
|
9
|
+
export { default as Attachment, default as PromptInputAttachment } from './PromptInputAttachment.svelte';
|
|
10
|
+
export { default as AttachmentImagePreview, default as PromptInputAttachmentImagePreview } from './PromptInputAttachmentImagePreview.svelte';
|
|
11
|
+
export { default as Attachments, default as PromptInputAttachments } from './PromptInputAttachments.svelte';
|
|
8
12
|
export { default as Button, default as PromptInputButton } from './PromptInputButton.svelte';
|
|
9
13
|
export { default as ActionAddAttachments, default as PromptInputActionAddAttachments } from './PromptInputActionAddAttachments.svelte';
|
|
10
14
|
export { default as ActionAddScreenshot, default as PromptInputActionAddScreenshot } from './PromptInputActionAddScreenshot.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, default as Root, default as Response } from '../Response.svelte';
|
|
@@ -14,15 +14,14 @@
|
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<script lang="ts">
|
|
17
|
-
import {
|
|
17
|
+
import { ChevronDown, Wrench } from '@lucide/svelte';
|
|
18
18
|
import { cn } from '../../utils.js';
|
|
19
19
|
import { useToolContext } from './context.svelte.js';
|
|
20
|
-
import
|
|
20
|
+
import ToolStatusBadge from './ToolStatusBadge.svelte';
|
|
21
21
|
|
|
22
22
|
let { title, type, state: stateProp, toolName, class: className = '', children, ...rest }: ToolHeaderProps = $props();
|
|
23
23
|
const tool = useToolContext('ToolHeader');
|
|
24
24
|
const resolvedState = $derived(stateProp ?? tool.state);
|
|
25
|
-
const badge = $derived(getStatusBadge(resolvedState));
|
|
26
25
|
const derivedName = $derived(title ?? toolName ?? (type === 'dynamic-tool' ? toolName : type?.split('-').slice(1).join('-')) ?? tool.name);
|
|
27
26
|
</script>
|
|
28
27
|
|
|
@@ -33,13 +32,7 @@
|
|
|
33
32
|
<span class="svadmin-ai-tool-header__summary">
|
|
34
33
|
<Wrench size={16} aria-hidden="true" />
|
|
35
34
|
<strong>{derivedName}</strong>
|
|
36
|
-
<
|
|
37
|
-
{#if badge.icon === 'check-circle'}<CheckCircle2 size={14} aria-hidden="true" />
|
|
38
|
-
{:else if badge.icon === 'x-circle'}<CircleX size={14} aria-hidden="true" />
|
|
39
|
-
{:else if badge.icon === 'clock'}<Clock3 class={badge.pulse ? 'animate-pulse' : ''} size={14} aria-hidden="true" />
|
|
40
|
-
{:else}<Circle size={12} aria-hidden="true" />{/if}
|
|
41
|
-
{badge.label}
|
|
42
|
-
</span>
|
|
35
|
+
<ToolStatusBadge state={resolvedState} />
|
|
43
36
|
</span>
|
|
44
37
|
<ChevronDown class={cn(tool.open && 'svadmin-ai-tool-header__chevron--open')} size={16} aria-hidden="true" />
|
|
45
38
|
{/if}
|
|
@@ -48,15 +41,9 @@
|
|
|
48
41
|
<style>
|
|
49
42
|
.svadmin-ai-tool-header { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem; cursor: pointer; list-style: none; }
|
|
50
43
|
.svadmin-ai-tool-header::-webkit-details-marker { display: none; }
|
|
51
|
-
.svadmin-ai-tool-header__summary
|
|
44
|
+
.svadmin-ai-tool-header__summary { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }
|
|
52
45
|
.svadmin-ai-tool-header__summary strong { overflow: hidden; font-size: 0.875rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
|
|
53
46
|
.svadmin-ai-tool-header__summary > :global(svg) { color: var(--muted-foreground, currentColor); }
|
|
54
|
-
.svadmin-ai-tool-header__badge { flex: none; border-radius: 999px; padding: 0.2rem 0.5rem; background: var(--muted, transparent); color: var(--muted-foreground, currentColor); font-size: 0.6875rem; }
|
|
55
|
-
.svadmin-ai-tool-header__badge[data-tone='success'] { color: var(--success, currentColor); }
|
|
56
|
-
.svadmin-ai-tool-header__badge[data-tone='info'] { color: var(--info, currentColor); }
|
|
57
|
-
.svadmin-ai-tool-header__badge[data-tone='warning'] { color: var(--warning, currentColor); }
|
|
58
|
-
.svadmin-ai-tool-header__badge[data-tone='danger'] { color: var(--destructive, currentColor); }
|
|
59
|
-
.svadmin-ai-tool-header__badge[data-tone='pending'] { color: var(--primary, currentColor); }
|
|
60
47
|
.svadmin-ai-tool-header > :global(svg:last-child) { flex: none; color: var(--muted-foreground, currentColor); transition: transform 150ms ease; }
|
|
61
48
|
.svadmin-ai-tool-header > :global(.svadmin-ai-tool-header__chevron--open) { transform: rotate(180deg); }
|
|
62
49
|
.svadmin-ai-tool-header:focus-visible { outline: 2px solid var(--ring, currentColor); outline-offset: 2px; }
|
|
@@ -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;
|
|
@@ -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';
|