@widgetic/chat 0.1.44 → 0.1.47
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 +162 -20
- package/dist/components/ActionBar.svelte +14 -1
- package/dist/components/ActionBar.svelte.d.ts +6 -0
- package/dist/components/AttachmentDisplay.svelte +22 -130
- package/dist/components/AttachmentPreviewDialog.svelte +428 -0
- package/dist/components/AttachmentPreviewDialog.svelte.d.ts +14 -0
- package/dist/components/Chat.svelte +556 -121
- package/dist/components/Chat.svelte.d.ts +15 -2
- package/dist/components/ChatComposer.svelte +63 -69
- package/dist/components/ChatComposer.svelte.d.ts +8 -3
- package/dist/components/ChatDropOverlay.svelte +58 -0
- package/dist/components/ChatDropOverlay.svelte.d.ts +8 -0
- package/dist/components/ChatMessages.svelte +322 -98
- package/dist/components/ChatMessages.svelte.d.ts +11 -2
- package/dist/components/ComposerAttachmentsTray.svelte +144 -56
- package/dist/components/ComposerAttachmentsTray.svelte.d.ts +11 -1
- package/dist/components/FileGlyphIcon.svelte +34 -0
- package/dist/components/FileGlyphIcon.svelte.d.ts +8 -0
- package/dist/components/PanelSuggestionButtons.svelte +67 -19
- package/dist/components/PanelSuggestionButtons.svelte.d.ts +3 -1
- package/dist/components/RestoreCheckpointDialog.svelte +66 -0
- package/dist/components/RestoreCheckpointDialog.svelte.d.ts +11 -0
- package/dist/components/SentAttachments.svelte +118 -0
- package/dist/components/SentAttachments.svelte.d.ts +12 -0
- package/dist/components/agent/AgentTurn.svelte +17 -2
- package/dist/components/agent/CodeCard.svelte +9 -3
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/messages.d.ts +52 -4
- package/dist/i18n/messages.js +58 -6
- package/dist/i18n/suggestions.d.ts +17 -2
- package/dist/i18n/suggestions.js +11 -12
- package/dist/services/index.d.ts +4 -2
- package/dist/services/index.js +2 -1
- package/dist/services/limitRefusal.d.ts +42 -0
- package/dist/services/limitRefusal.js +60 -0
- package/dist/services/sketchAssistantClient.d.ts +11 -3
- package/dist/services/sketchAssistantClient.js +37 -10
- package/dist/services/sketchAssistantErrors.d.ts +16 -1
- package/dist/services/sketchAssistantErrors.js +25 -4
- package/dist/services/sketchAssistantOrchestrator.d.ts +7 -1
- package/dist/services/sketchAssistantOrchestrator.js +2 -2
- package/dist/types/attachment.d.ts +11 -0
- package/dist/utils/agentTurn.d.ts +32 -1
- package/dist/utils/agentTurn.js +46 -3
- package/dist/utils/attachmentDuplicates.d.ts +48 -0
- package/dist/utils/attachmentDuplicates.js +70 -0
- package/dist/utils/attachmentPolicy.d.ts +88 -0
- package/dist/utils/attachmentPolicy.js +135 -0
- package/dist/utils/attachmentPreview.d.ts +146 -0
- package/dist/utils/attachmentPreview.js +224 -0
- package/dist/utils/attachmentTray.d.ts +35 -0
- package/dist/utils/attachmentTray.js +27 -0
- package/dist/utils/chatFileDrag.d.ts +39 -0
- package/dist/utils/chatFileDrag.js +29 -0
- package/dist/utils/composerPreview.d.ts +33 -0
- package/dist/utils/composerPreview.js +31 -0
- package/dist/utils/generationArchiveStore.d.ts +5 -1
- package/dist/utils/generationArchiveStore.js +9 -4
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/limitFailureLine.d.ts +20 -0
- package/dist/utils/limitFailureLine.js +40 -0
- package/dist/utils/panelListPadding.d.ts +20 -0
- package/dist/utils/panelListPadding.js +31 -0
- package/dist/utils/pasteInsertion.d.ts +43 -0
- package/dist/utils/pasteInsertion.js +94 -0
- package/dist/utils/pastedContent.d.ts +13 -0
- package/dist/utils/pastedContent.js +18 -1
- package/dist/utils/referenceItems.js +11 -3
- package/dist/utils/sentAttachments.d.ts +43 -0
- package/dist/utils/sentAttachments.js +38 -0
- package/dist/utils/sentReferenceBadges.d.ts +11 -1
- package/dist/utils/sentReferenceBadges.js +47 -2
- package/package.json +3 -3
|
@@ -193,8 +193,11 @@ interface Props {
|
|
|
193
193
|
/** Undo the last sketch-assistant canvas turn (one engine undo step). */
|
|
194
194
|
onSketchUndo?: () => void | Promise<void>;
|
|
195
195
|
/**
|
|
196
|
-
* What the "Upgrade" button of a failure about the plan or the credits does.
|
|
197
|
-
*
|
|
196
|
+
* What the "Upgrade" button of a failure about the plan or the credits does. The button is drawn right under the failure,
|
|
197
|
+
* in the chat: under a code generation the host saved a failure for ("Code generation failed: … Upgrade your plan …"), and
|
|
198
|
+
* under the sketch assistant's own sentences for a refusal because of money (`chat.sketch.noCredits`, `.planRequired`,
|
|
199
|
+
* `.limitReached`). Without this function the button opens the billing page of the Widgetic site; a host that is a guest on
|
|
200
|
+
* somebody else's page gives its own function.
|
|
198
201
|
*/
|
|
199
202
|
onUpgradePlans?: () => void;
|
|
200
203
|
/**
|
|
@@ -306,6 +309,16 @@ interface Props {
|
|
|
306
309
|
* a run began.
|
|
307
310
|
*/
|
|
308
311
|
generationChanges?: import('../utils/codeChanges.js').CodeChanges | null;
|
|
312
|
+
/**
|
|
313
|
+
* The agent's own words about what the last run changed (`operation.metadata.summary`: a sentence or two of plain text), or `null`
|
|
314
|
+
* when it said nothing: a gateway that does not send one, a build that was not kept. The conclusion under that run says it in
|
|
315
|
+
* place of "Done. Your changes are ready.".
|
|
316
|
+
*
|
|
317
|
+
* Like `generationChanges` it is what the run left behind, so it is NOT given up when `isGenerating` ends: give it when the
|
|
318
|
+
* operation completes (it may come after `isGenerating` fell) and clear it (`null`) when the next run starts. A page that forgets
|
|
319
|
+
* to clear it is safe: the chat ignores the very value it held when a run began.
|
|
320
|
+
*/
|
|
321
|
+
generationSummary?: string | null;
|
|
309
322
|
onStopGeneration?: () => void;
|
|
310
323
|
/**
|
|
311
324
|
* Renders the inline design-control card attached to an assistant reply
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { ComposerMention, MentionSource } from '../types/mention.js';
|
|
5
5
|
import { useChatLanguage } from '../i18n/language.js';
|
|
6
6
|
import { dirForUserText, useTextDirection } from '@widgetic/design-system/components/textDirection';
|
|
7
|
+
import { HintTooltip } from '@widgetic/design-system/components';
|
|
7
8
|
import {
|
|
8
9
|
Composer,
|
|
9
10
|
IconButton,
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
} from '@widgetic/design-system/components/chat/index';
|
|
16
17
|
import { chatLog, chatError } from '../utils/logger.js';
|
|
17
18
|
import { attachmentsFromPaste, type PastedAttachment } from '../utils/pastedContent.js';
|
|
19
|
+
import type { PasteSelection } from '../utils/pasteInsertion.js';
|
|
18
20
|
import {
|
|
19
21
|
DEFAULT_MENTION_LIMIT,
|
|
20
22
|
buildMentionRows,
|
|
@@ -62,13 +64,15 @@
|
|
|
62
64
|
*/
|
|
63
65
|
editing?: ComposerEditing | null;
|
|
64
66
|
onInputChange?: (text: string) => void;
|
|
65
|
-
onFilesDropped?: (files: File[]) => void;
|
|
66
67
|
/**
|
|
67
68
|
* What a paste brings in as files to attach: a screenshot or a file on the clipboard, or a long text (which comes as a text
|
|
68
69
|
* file, with the first words of the text as its label). Without it the composer pastes as the browser does: a page that
|
|
69
70
|
* cannot attach files gets no attachment from a paste, and the text goes into the box.
|
|
71
|
+
*
|
|
72
|
+
* `selection` is where the caret was when the paste arrived (or the part of the text the paste replaces): a long text is
|
|
73
|
+
* named in the message by a badge written there.
|
|
70
74
|
*/
|
|
71
|
-
onFilesPasted?: (pasted: PastedAttachment[]) => void;
|
|
75
|
+
onFilesPasted?: (pasted: PastedAttachment[], selection?: PasteSelection) => void;
|
|
72
76
|
/** Opens the file picker. The "+" of the toolbar is drawn only when the page can attach files. */
|
|
73
77
|
onAttach?: () => void;
|
|
74
78
|
/** Figma side-panel composer: no top border on the shell; DS Composer keeps its own border. */
|
|
@@ -141,7 +145,6 @@
|
|
|
141
145
|
onQueue,
|
|
142
146
|
editing = null,
|
|
143
147
|
onInputChange,
|
|
144
|
-
onFilesDropped,
|
|
145
148
|
onFilesPasted,
|
|
146
149
|
onAttach,
|
|
147
150
|
panelLayout = false,
|
|
@@ -174,6 +177,25 @@
|
|
|
174
177
|
return shellElement?.querySelector('textarea') ?? null;
|
|
175
178
|
}
|
|
176
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Puts the caret at `position` in the text (the box is given the focus). The page calls it after it wrote into the text by itself
|
|
182
|
+
* (a badge for a pasted text): a text set from outside leaves the caret at its end, and the person goes on typing after the badge.
|
|
183
|
+
* It waits for the new text to reach the box first.
|
|
184
|
+
*/
|
|
185
|
+
export async function placeCaret(position: number): Promise<void> {
|
|
186
|
+
try {
|
|
187
|
+
await tick();
|
|
188
|
+
const messageBox = findMessageBox();
|
|
189
|
+
if (!messageBox) return;
|
|
190
|
+
const caretPosition = Math.max(0, Math.min(Math.floor(position), messageBox.value.length));
|
|
191
|
+
messageBox.focus({ preventScroll: true });
|
|
192
|
+
messageBox.setSelectionRange(caretPosition, caretPosition);
|
|
193
|
+
chatLog('[ChatComposer] Caret placed at', caretPosition);
|
|
194
|
+
} catch (error) {
|
|
195
|
+
chatError('[ChatComposer] Could not place the caret:', error);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
177
199
|
// The box takes the focus once it is drawn (the note of a part opens ready to be written in), caret after what is written.
|
|
178
200
|
$effect(() => {
|
|
179
201
|
if (!autofocus) return;
|
|
@@ -214,12 +236,12 @@
|
|
|
214
236
|
});
|
|
215
237
|
|
|
216
238
|
// The files the message may refer to, with the words the box says about them. `{name}` is filled by the box with the file's own name.
|
|
239
|
+
// No hint about how to refer to a file ("Type # to …"): a person who attached a file is not told, in any way, how to use it.
|
|
217
240
|
const composerReferences = $derived(
|
|
218
241
|
referenceItems
|
|
219
242
|
? {
|
|
220
243
|
items: referenceItems,
|
|
221
244
|
messages: {
|
|
222
|
-
hint: $t('chat.input.referenceHint'),
|
|
223
245
|
menuLabel: $t('chat.input.referenceMenuLabel'),
|
|
224
246
|
remove: $t('chat.input.referenceRemove', { name: '{name}' }),
|
|
225
247
|
},
|
|
@@ -233,7 +255,6 @@
|
|
|
233
255
|
// that is used then), never a generic word such as "Assistant": the person knows what they are talking to.
|
|
234
256
|
const fallbackModelLabel = $derived(models?.[0]?.label?.trim() ?? '');
|
|
235
257
|
|
|
236
|
-
let isFileDragOver = $state(false);
|
|
237
258
|
let sendNudgePhase = $state<SendNudgePhase>('idle');
|
|
238
259
|
let sendNudgeBounce = $state(false);
|
|
239
260
|
let sendNudgeHideTimer: ReturnType<typeof setTimeout> | null = null;
|
|
@@ -291,40 +312,8 @@
|
|
|
291
312
|
const busy = $derived(isGenerating || isSending);
|
|
292
313
|
const allowEmptySend = $derived(canSendWithoutText);
|
|
293
314
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function handleFileDragEnter(event: DragEvent) {
|
|
299
|
-
if (!isOsFileDrag(event)) return;
|
|
300
|
-
event.preventDefault();
|
|
301
|
-
isFileDragOver = true;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function handleFileDragOver(event: DragEvent) {
|
|
305
|
-
if (!isOsFileDrag(event)) return;
|
|
306
|
-
event.preventDefault();
|
|
307
|
-
if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy';
|
|
308
|
-
isFileDragOver = true;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
function handleFileDragLeave(event: DragEvent) {
|
|
312
|
-
if (!isOsFileDrag(event)) return;
|
|
313
|
-
const related = event.relatedTarget as Node | null;
|
|
314
|
-
if (related && (event.currentTarget as HTMLElement).contains(related)) return;
|
|
315
|
-
isFileDragOver = false;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function handleFileDrop(event: DragEvent) {
|
|
319
|
-
if (!isOsFileDrag(event)) return;
|
|
320
|
-
event.preventDefault();
|
|
321
|
-
event.stopPropagation();
|
|
322
|
-
isFileDragOver = false;
|
|
323
|
-
const droppedFiles = Array.from(event.dataTransfer?.files || []).filter((file) => file && file.size > 0);
|
|
324
|
-
if (droppedFiles.length === 0) return;
|
|
325
|
-
chatLog('[ChatComposer] OS files dropped:', droppedFiles.length);
|
|
326
|
-
onFilesDropped?.(droppedFiles);
|
|
327
|
-
}
|
|
315
|
+
// Files dragged over the chat, and dropped on it, are taken by the chat itself (the whole chat is the drop area, not only this
|
|
316
|
+
// box): see `handleChatFileDrag` in `Chat.svelte`.
|
|
328
317
|
|
|
329
318
|
/**
|
|
330
319
|
* A paste into the box. A picture or a file on the clipboard, or a long text, is attached the way a dropped file is. A short
|
|
@@ -339,8 +328,13 @@
|
|
|
339
328
|
const pastedAttachments = attachmentsFromPaste(event.clipboardData);
|
|
340
329
|
if (pastedAttachments.length === 0) return;
|
|
341
330
|
event.preventDefault();
|
|
342
|
-
|
|
343
|
-
|
|
331
|
+
// Where the caret is now (read before anything is waited for): a long text is named in the message right there.
|
|
332
|
+
const selection =
|
|
333
|
+
event.target instanceof HTMLTextAreaElement
|
|
334
|
+
? { start: event.target.selectionStart ?? 0, end: event.target.selectionEnd ?? 0 }
|
|
335
|
+
: undefined;
|
|
336
|
+
chatLog('[ChatComposer] Pasted content attached:', pastedAttachments.length, 'caret at', selection?.start);
|
|
337
|
+
onFilesPasted(pastedAttachments, selection);
|
|
344
338
|
} catch (error) {
|
|
345
339
|
chatError('[ChatComposer] Could not read what was pasted:', error);
|
|
346
340
|
}
|
|
@@ -528,41 +522,41 @@
|
|
|
528
522
|
<!-- Figma: Composer toolbar, left side: attach ("+"), then the mode. -->
|
|
529
523
|
{#snippet attachControl()}
|
|
530
524
|
{#if onAttach}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
525
|
+
<!-- Resting the pointer on the "+" (the tooltip's usual delay) says what it adds and which kinds of files go in. -->
|
|
526
|
+
<HintTooltip content={$t('chat.actions.uploadTooltip')} side="top" align="start">
|
|
527
|
+
{#snippet trigger({ props })}
|
|
528
|
+
<IconButton
|
|
529
|
+
{...props}
|
|
530
|
+
variant="ghost"
|
|
531
|
+
data-testid="chat-composer-attach"
|
|
532
|
+
label={$t('chat.actions.uploadLabel')}
|
|
533
|
+
disabled={isSending && !isGenerating}
|
|
534
|
+
onclick={() => onAttach?.()}
|
|
535
|
+
>
|
|
536
|
+
<svg
|
|
537
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
538
|
+
class="size-4 stroke-2"
|
|
539
|
+
viewBox="0 0 24 24"
|
|
540
|
+
fill="none"
|
|
541
|
+
stroke="currentColor"
|
|
542
|
+
stroke-linecap="round"
|
|
543
|
+
stroke-linejoin="round"
|
|
544
|
+
aria-hidden="true"
|
|
545
|
+
>
|
|
546
|
+
<path d="M12 5l0 14" />
|
|
547
|
+
<path d="M5 12l14 0" />
|
|
548
|
+
</svg>
|
|
549
|
+
</IconButton>
|
|
550
|
+
{/snippet}
|
|
551
|
+
</HintTooltip>
|
|
552
552
|
{/if}
|
|
553
553
|
{/snippet}
|
|
554
554
|
|
|
555
555
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
556
556
|
<div
|
|
557
|
-
class="chat-composer-shell border-border bg-background relative shrink-0 {panelLayout ? '' : 'border-t'} {className}
|
|
558
|
-
? 'outline-primary outline-2 outline-dashed'
|
|
559
|
-
: ''}"
|
|
557
|
+
class="chat-composer-shell border-border bg-background relative shrink-0 {panelLayout ? '' : 'border-t'} {className}"
|
|
560
558
|
{style}
|
|
561
559
|
bind:this={shellElement}
|
|
562
|
-
ondragenter={handleFileDragEnter}
|
|
563
|
-
ondragover={handleFileDragOver}
|
|
564
|
-
ondragleave={handleFileDragLeave}
|
|
565
|
-
ondrop={handleFileDrop}
|
|
566
560
|
onpaste={handlePaste}
|
|
567
561
|
onkeydowncapture={handleMentionKeydown}
|
|
568
562
|
oninput={handleMentionInput}
|
|
@@ -2,6 +2,7 @@ import { type Snippet } from 'svelte';
|
|
|
2
2
|
import type { ComposerMention, MentionSource } from '../types/mention.js';
|
|
3
3
|
import { type ComposerCompletion, type ComposerEditing, type ComposerSendOptions, type ReferenceHoverEvent, type ReferenceItem } from '@widgetic/design-system/components/chat/index';
|
|
4
4
|
import { type PastedAttachment } from '../utils/pastedContent.js';
|
|
5
|
+
import type { PasteSelection } from '../utils/pasteInsertion.js';
|
|
5
6
|
export type ComposerModelOption = {
|
|
6
7
|
id: string;
|
|
7
8
|
label: string;
|
|
@@ -34,13 +35,15 @@ interface Props {
|
|
|
34
35
|
*/
|
|
35
36
|
editing?: ComposerEditing | null;
|
|
36
37
|
onInputChange?: (text: string) => void;
|
|
37
|
-
onFilesDropped?: (files: File[]) => void;
|
|
38
38
|
/**
|
|
39
39
|
* What a paste brings in as files to attach: a screenshot or a file on the clipboard, or a long text (which comes as a text
|
|
40
40
|
* file, with the first words of the text as its label). Without it the composer pastes as the browser does: a page that
|
|
41
41
|
* cannot attach files gets no attachment from a paste, and the text goes into the box.
|
|
42
|
+
*
|
|
43
|
+
* `selection` is where the caret was when the paste arrived (or the part of the text the paste replaces): a long text is
|
|
44
|
+
* named in the message by a badge written there.
|
|
42
45
|
*/
|
|
43
|
-
onFilesPasted?: (pasted: PastedAttachment[]) => void;
|
|
46
|
+
onFilesPasted?: (pasted: PastedAttachment[], selection?: PasteSelection) => void;
|
|
44
47
|
/** Opens the file picker. The "+" of the toolbar is drawn only when the page can attach files. */
|
|
45
48
|
onAttach?: () => void;
|
|
46
49
|
/** Figma side-panel composer: no top border on the shell; DS Composer keeps its own border. */
|
|
@@ -96,6 +99,8 @@ interface Props {
|
|
|
96
99
|
*/
|
|
97
100
|
onMentionPick?: (mention: ComposerMention) => void;
|
|
98
101
|
}
|
|
99
|
-
declare const ChatComposer: import("svelte").Component<Props, {
|
|
102
|
+
declare const ChatComposer: import("svelte").Component<Props, {
|
|
103
|
+
placeCaret: (position: number) => Promise<void>;
|
|
104
|
+
}, "value">;
|
|
100
105
|
type ChatComposer = ReturnType<typeof ChatComposer>;
|
|
101
106
|
export default ChatComposer;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* What covers the whole chat while files are dragged over it (Figma: "Chat / Drop files" and "Chat / Drop not allowed"): the chat
|
|
4
|
+
* dims behind a white veil, and a dashed frame says what releasing the files would do. In green it invites the drop; in red it says
|
|
5
|
+
* the files are of a kind the box does not take (only the type of a file is known while it is dragged: its size is judged on the
|
|
6
|
+
* drop, and a file that is too large is told about then). The veil lets the pointer through, so the chat below keeps receiving the
|
|
7
|
+
* drag, and a drop anywhere on the chat is taken by the chat itself (see `Chat.svelte`).
|
|
8
|
+
*/
|
|
9
|
+
import { fade } from 'svelte/transition';
|
|
10
|
+
import IconAlertTriangle from '@tabler/icons-svelte/icons/alert-triangle';
|
|
11
|
+
import IconCloudUpload from '@tabler/icons-svelte/icons/cloud-upload';
|
|
12
|
+
import { useChatLanguage } from '../i18n/language.js';
|
|
13
|
+
import type { FileDragOverlay } from '../utils/chatFileDrag.js';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
/** What covers the chat now: nothing, the invitation, or the refusal. */
|
|
17
|
+
overlay: FileDragOverlay;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let { overlay }: Props = $props();
|
|
21
|
+
|
|
22
|
+
const { t } = useChatLanguage();
|
|
23
|
+
|
|
24
|
+
const isRefusal = $derived(overlay === 'refuse');
|
|
25
|
+
|
|
26
|
+
// The veil fades in and out quickly, and not at all for a person who asked for less motion
|
|
27
|
+
const fadeDurationMs =
|
|
28
|
+
typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ? 0 : 120;
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
{#if overlay !== 'hidden'}
|
|
32
|
+
<div
|
|
33
|
+
class="chat-drop-overlay bg-background/80 pointer-events-none absolute inset-0 z-40 flex rounded-[inherit] p-3"
|
|
34
|
+
data-testid="chat-drop-overlay"
|
|
35
|
+
data-verdict={overlay}
|
|
36
|
+
role="status"
|
|
37
|
+
aria-live="polite"
|
|
38
|
+
transition:fade={{ duration: fadeDurationMs }}
|
|
39
|
+
>
|
|
40
|
+
<div
|
|
41
|
+
class="chat-drop-overlay-target flex min-w-0 flex-1 flex-col items-center justify-center gap-2 rounded-[18px] border-2 border-dashed px-6 text-center {isRefusal
|
|
42
|
+
? 'border-destructive bg-destructive/7'
|
|
43
|
+
: 'border-brand bg-brand-subtle/55'}"
|
|
44
|
+
>
|
|
45
|
+
{#if isRefusal}
|
|
46
|
+
<IconAlertTriangle class="text-destructive size-6" aria-hidden="true" />
|
|
47
|
+
{:else}
|
|
48
|
+
<IconCloudUpload class="text-brand size-6" aria-hidden="true" />
|
|
49
|
+
{/if}
|
|
50
|
+
<p class="text-label text-foreground" data-testid="chat-drop-overlay-title">
|
|
51
|
+
{isRefusal ? $t('chat.drop.refusedTitle') : $t('chat.drop.title')}
|
|
52
|
+
</p>
|
|
53
|
+
<p class="text-label-small text-muted-foreground" data-testid="chat-drop-overlay-hint">
|
|
54
|
+
{isRefusal ? $t('chat.drop.refusedHint') : $t('chat.drop.hint')}
|
|
55
|
+
</p>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileDragOverlay } from '../utils/chatFileDrag.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** What covers the chat now: nothing, the invitation, or the refusal. */
|
|
4
|
+
overlay: FileDragOverlay;
|
|
5
|
+
}
|
|
6
|
+
declare const ChatDropOverlay: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type ChatDropOverlay = ReturnType<typeof ChatDropOverlay>;
|
|
8
|
+
export default ChatDropOverlay;
|