@aigentyc/chat-sdk 0.5.0 → 0.5.2
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/dist/{ChatInterface-2MN5cpYB.d.ts → ChatInterface-CRmM_RG_.d.ts} +9 -1
- package/dist/{ChatInterface-BnVyOUG5.d.cts → ChatInterface-DKF3BY42.d.cts} +9 -1
- package/dist/{SlotsContext-BZBi51ZT.d.ts → SlotsContext-B_087V7B.d.ts} +11 -2
- package/dist/{SlotsContext-D_C7zlUA.d.cts → SlotsContext-DAQiASVu.d.cts} +11 -2
- package/dist/ai-elements.cjs +39 -27
- package/dist/ai-elements.d.cts +63 -1
- package/dist/ai-elements.d.ts +63 -1
- package/dist/ai-elements.js +2 -2
- package/dist/{chunk-3MP2EGEJ.cjs → chunk-72QJ2ORD.cjs} +4 -2
- package/dist/chunk-72QJ2ORD.cjs.map +1 -0
- package/dist/{chunk-KTYYLZN7.cjs → chunk-B277MAUK.cjs} +76 -4
- package/dist/chunk-B277MAUK.cjs.map +1 -0
- package/dist/{chunk-P3RPAI4F.cjs → chunk-BYX6IOGX.cjs} +4 -4
- package/dist/{chunk-P3RPAI4F.cjs.map → chunk-BYX6IOGX.cjs.map} +1 -1
- package/dist/chunk-CNPYBLLT.js +81 -0
- package/dist/chunk-CNPYBLLT.js.map +1 -0
- package/dist/{chunk-FJZL33KP.js → chunk-CW6LCVNC.js} +3 -3
- package/dist/{chunk-FJZL33KP.js.map → chunk-CW6LCVNC.js.map} +1 -1
- package/dist/{chunk-D75TDRBH.js → chunk-JAEXKKSE.js} +41 -35
- package/dist/chunk-JAEXKKSE.js.map +1 -0
- package/dist/{chunk-Q3UJEIBN.cjs → chunk-JEK2V5I3.cjs} +6 -6
- package/dist/{chunk-Q3UJEIBN.cjs.map → chunk-JEK2V5I3.cjs.map} +1 -1
- package/dist/{chunk-7ESWDFF5.cjs → chunk-KHQYSEYN.cjs} +244 -146
- package/dist/chunk-KHQYSEYN.cjs.map +1 -0
- package/dist/{chunk-QYCEHFAB.js → chunk-LDQVDUUJ.js} +4 -2
- package/dist/chunk-LDQVDUUJ.js.map +1 -0
- package/dist/{chunk-5XF3NEFB.js → chunk-O5TPHZRP.js} +74 -5
- package/dist/chunk-O5TPHZRP.js.map +1 -0
- package/dist/{chunk-BWWN5LSE.js → chunk-PNUHUUA3.js} +221 -124
- package/dist/chunk-PNUHUUA3.js.map +1 -0
- package/dist/{chunk-52ZHMTAA.cjs → chunk-UXVOUC2A.cjs} +41 -35
- package/dist/chunk-UXVOUC2A.cjs.map +1 -0
- package/dist/{chunk-IU7Q7O5G.js → chunk-VQPOUMBC.js} +3 -3
- package/dist/{chunk-IU7Q7O5G.js.map → chunk-VQPOUMBC.js.map} +1 -1
- package/dist/chunk-VYBHYFG3.cjs +87 -0
- package/dist/chunk-VYBHYFG3.cjs.map +1 -0
- package/dist/components.cjs +20 -19
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +2 -2
- package/dist/components.d.ts +2 -2
- package/dist/components.js +8 -7
- package/dist/components.js.map +1 -1
- package/dist/core.cjs +21 -82
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +2 -78
- package/dist/core.js.map +1 -1
- package/dist/hooks.cjs +9 -8
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +4 -3
- package/dist/hooks.js.map +1 -1
- package/dist/i18n.cjs +5 -5
- package/dist/i18n.d.cts +2 -2
- package/dist/i18n.d.ts +2 -2
- package/dist/i18n.js +1 -1
- package/dist/index.cjs +35 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -6
- package/dist/index.d.ts +28 -6
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +10 -10
- package/dist/styles.css +1 -1
- package/dist/theme.cjs +4 -4
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +2 -2
- package/dist/tools.cjs +6 -5
- package/dist/tools.d.cts +2 -2
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +3 -2
- package/dist/{types-bsR_-fq8.d.cts → types-DRa1zFlN.d.cts} +10 -1
- package/dist/{types-bsR_-fq8.d.ts → types-DRa1zFlN.d.ts} +10 -1
- package/package.json +2 -2
- package/dist/chunk-3MP2EGEJ.cjs.map +0 -1
- package/dist/chunk-52ZHMTAA.cjs.map +0 -1
- package/dist/chunk-5XF3NEFB.js.map +0 -1
- package/dist/chunk-7ESWDFF5.cjs.map +0 -1
- package/dist/chunk-BWWN5LSE.js.map +0 -1
- package/dist/chunk-D75TDRBH.js.map +0 -1
- package/dist/chunk-KTYYLZN7.cjs.map +0 -1
- package/dist/chunk-QYCEHFAB.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Q as QuestionConfig } from './types-
|
|
2
|
+
import { Q as QuestionConfig } from './types-DRa1zFlN.js';
|
|
3
3
|
|
|
4
4
|
interface ChatInterfaceProps {
|
|
5
5
|
/** Allow per-instance overrides of any context value */
|
|
@@ -36,6 +36,14 @@ interface ChatInterfaceProps {
|
|
|
36
36
|
* - `"stream-order"` — parts render in the order received from the API
|
|
37
37
|
*/
|
|
38
38
|
messagePartOrder?: "text-first" | "tools-first" | "stream-order";
|
|
39
|
+
/**
|
|
40
|
+
* Where the view settles while an answer streams in.
|
|
41
|
+
* - `"latest-turn"` (default) — follows the answer down only until the
|
|
42
|
+
* visitor's question reaches the top, then holds there, so a long reply is
|
|
43
|
+
* read from its first line
|
|
44
|
+
* - `"bottom"` — always follows the end of the content
|
|
45
|
+
*/
|
|
46
|
+
scrollAnchor?: "latest-turn" | "bottom";
|
|
39
47
|
}
|
|
40
48
|
interface AssistantMessageSlotProps {
|
|
41
49
|
message: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Q as QuestionConfig } from './types-
|
|
2
|
+
import { Q as QuestionConfig } from './types-DRa1zFlN.cjs';
|
|
3
3
|
|
|
4
4
|
interface ChatInterfaceProps {
|
|
5
5
|
/** Allow per-instance overrides of any context value */
|
|
@@ -36,6 +36,14 @@ interface ChatInterfaceProps {
|
|
|
36
36
|
* - `"stream-order"` — parts render in the order received from the API
|
|
37
37
|
*/
|
|
38
38
|
messagePartOrder?: "text-first" | "tools-first" | "stream-order";
|
|
39
|
+
/**
|
|
40
|
+
* Where the view settles while an answer streams in.
|
|
41
|
+
* - `"latest-turn"` (default) — follows the answer down only until the
|
|
42
|
+
* visitor's question reaches the top, then holds there, so a long reply is
|
|
43
|
+
* read from its first line
|
|
44
|
+
* - `"bottom"` — always follows the end of the content
|
|
45
|
+
*/
|
|
46
|
+
scrollAnchor?: "latest-turn" | "bottom";
|
|
39
47
|
}
|
|
40
48
|
interface AssistantMessageSlotProps {
|
|
41
49
|
message: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RefObject, ComponentType } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { h as LiveChatState, g as LiveChatMessage, b as ChatProviderProps, f as ChatMessage, c as ChatAttachmentInput, d as ChatConfig, e as ChatEventCallbacks } from './types-DRa1zFlN.js';
|
|
4
4
|
|
|
5
5
|
type ChatStatus$1 = "idle" | "streaming" | "error";
|
|
6
6
|
interface ActiveTool$1 {
|
|
@@ -76,6 +76,15 @@ interface ChatContextValue {
|
|
|
76
76
|
*/
|
|
77
77
|
sendMessage: (content: string, files?: ChatAttachmentInput[]) => void;
|
|
78
78
|
stopGeneration: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Re-run the last turn after a failure. No-op while a turn is in flight.
|
|
81
|
+
*
|
|
82
|
+
* Worth offering for a transient refusal — a rate limit, a dropped stream, a
|
|
83
|
+
* momentary 503. It cannot clear a refusal caused by the history itself,
|
|
84
|
+
* because the same history is what gets re-sent; that needs
|
|
85
|
+
* {@link ChatContextValue.newConversation}.
|
|
86
|
+
*/
|
|
87
|
+
retryLastTurn: () => void;
|
|
79
88
|
newConversation: () => void;
|
|
80
89
|
clearMessages: () => void;
|
|
81
90
|
callbacks?: ChatEventCallbacks;
|
|
@@ -211,7 +220,7 @@ declare function useKeyboardLanguage({ fallback, supported, latin, }?: KeyboardL
|
|
|
211
220
|
/**
|
|
212
221
|
* All available slot names that can be overridden.
|
|
213
222
|
*/
|
|
214
|
-
type SlotName = "header" | "footer" | "input" | "welcomePage" | "userMessage" | "assistantMessage" | "systemMessage" | "loader" | "feedback" | "tools" | "toolRenderers" | "liveChatPanel" | "satisfactionRating" | "visitorIdentityForm" | "floatingButton" | "emptyState";
|
|
223
|
+
type SlotName = "header" | "footer" | "input" | "welcomePage" | "userMessage" | "assistantMessage" | "systemMessage" | "loader" | "feedback" | "tools" | "toolRenderers" | "liveChatPanel" | "satisfactionRating" | "visitorIdentityForm" | "floatingButton" | "emptyState" | "error";
|
|
215
224
|
/**
|
|
216
225
|
* A slot component receives the default component as a prop alongside its own props.
|
|
217
226
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RefObject, ComponentType } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { h as LiveChatState, g as LiveChatMessage, b as ChatProviderProps, f as ChatMessage, c as ChatAttachmentInput, d as ChatConfig, e as ChatEventCallbacks } from './types-DRa1zFlN.cjs';
|
|
4
4
|
|
|
5
5
|
type ChatStatus$1 = "idle" | "streaming" | "error";
|
|
6
6
|
interface ActiveTool$1 {
|
|
@@ -76,6 +76,15 @@ interface ChatContextValue {
|
|
|
76
76
|
*/
|
|
77
77
|
sendMessage: (content: string, files?: ChatAttachmentInput[]) => void;
|
|
78
78
|
stopGeneration: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Re-run the last turn after a failure. No-op while a turn is in flight.
|
|
81
|
+
*
|
|
82
|
+
* Worth offering for a transient refusal — a rate limit, a dropped stream, a
|
|
83
|
+
* momentary 503. It cannot clear a refusal caused by the history itself,
|
|
84
|
+
* because the same history is what gets re-sent; that needs
|
|
85
|
+
* {@link ChatContextValue.newConversation}.
|
|
86
|
+
*/
|
|
87
|
+
retryLastTurn: () => void;
|
|
79
88
|
newConversation: () => void;
|
|
80
89
|
clearMessages: () => void;
|
|
81
90
|
callbacks?: ChatEventCallbacks;
|
|
@@ -211,7 +220,7 @@ declare function useKeyboardLanguage({ fallback, supported, latin, }?: KeyboardL
|
|
|
211
220
|
/**
|
|
212
221
|
* All available slot names that can be overridden.
|
|
213
222
|
*/
|
|
214
|
-
type SlotName = "header" | "footer" | "input" | "welcomePage" | "userMessage" | "assistantMessage" | "systemMessage" | "loader" | "feedback" | "tools" | "toolRenderers" | "liveChatPanel" | "satisfactionRating" | "visitorIdentityForm" | "floatingButton" | "emptyState";
|
|
223
|
+
type SlotName = "header" | "footer" | "input" | "welcomePage" | "userMessage" | "assistantMessage" | "systemMessage" | "loader" | "feedback" | "tools" | "toolRenderers" | "liveChatPanel" | "satisfactionRating" | "visitorIdentityForm" | "floatingButton" | "emptyState" | "error";
|
|
215
224
|
/**
|
|
216
225
|
* A slot component receives the default component as a prop alongside its own props.
|
|
217
226
|
*/
|
package/dist/ai-elements.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkDDATCJ3O_cjs = require('./chunk-DDATCJ3O.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkB277MAUK_cjs = require('./chunk-B277MAUK.cjs');
|
|
6
6
|
require('./chunk-X7R334SB.cjs');
|
|
7
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-72QJ2ORD.cjs');
|
|
8
8
|
var chunkJOO6C3XT_cjs = require('./chunk-JOO6C3XT.cjs');
|
|
9
9
|
var chunkY4B45DW4_cjs = require('./chunk-Y4B45DW4.cjs');
|
|
10
10
|
var chunkEMVZ7HWM_cjs = require('./chunk-EMVZ7HWM.cjs');
|
|
@@ -3600,103 +3600,115 @@ var Image = ({
|
|
|
3600
3600
|
|
|
3601
3601
|
Object.defineProperty(exports, "Conversation", {
|
|
3602
3602
|
enumerable: true,
|
|
3603
|
-
get: function () { return
|
|
3603
|
+
get: function () { return chunkB277MAUK_cjs.Conversation; }
|
|
3604
3604
|
});
|
|
3605
3605
|
Object.defineProperty(exports, "ConversationContent", {
|
|
3606
3606
|
enumerable: true,
|
|
3607
|
-
get: function () { return
|
|
3607
|
+
get: function () { return chunkB277MAUK_cjs.ConversationContent; }
|
|
3608
3608
|
});
|
|
3609
3609
|
Object.defineProperty(exports, "ConversationEmptyState", {
|
|
3610
3610
|
enumerable: true,
|
|
3611
|
-
get: function () { return
|
|
3611
|
+
get: function () { return chunkB277MAUK_cjs.ConversationEmptyState; }
|
|
3612
3612
|
});
|
|
3613
3613
|
Object.defineProperty(exports, "ConversationScrollButton", {
|
|
3614
3614
|
enumerable: true,
|
|
3615
|
-
get: function () { return
|
|
3615
|
+
get: function () { return chunkB277MAUK_cjs.ConversationScrollButton; }
|
|
3616
|
+
});
|
|
3617
|
+
Object.defineProperty(exports, "FollowLatestTurn", {
|
|
3618
|
+
enumerable: true,
|
|
3619
|
+
get: function () { return chunkB277MAUK_cjs.FollowLatestTurn; }
|
|
3620
|
+
});
|
|
3621
|
+
Object.defineProperty(exports, "LATEST_TURN_ATTR", {
|
|
3622
|
+
enumerable: true,
|
|
3623
|
+
get: function () { return chunkB277MAUK_cjs.LATEST_TURN_ATTR; }
|
|
3616
3624
|
});
|
|
3617
3625
|
Object.defineProperty(exports, "Loader", {
|
|
3618
3626
|
enumerable: true,
|
|
3619
|
-
get: function () { return
|
|
3627
|
+
get: function () { return chunkB277MAUK_cjs.Loader; }
|
|
3620
3628
|
});
|
|
3621
3629
|
Object.defineProperty(exports, "Message", {
|
|
3622
3630
|
enumerable: true,
|
|
3623
|
-
get: function () { return
|
|
3631
|
+
get: function () { return chunkB277MAUK_cjs.Message; }
|
|
3624
3632
|
});
|
|
3625
3633
|
Object.defineProperty(exports, "MessageAction", {
|
|
3626
3634
|
enumerable: true,
|
|
3627
|
-
get: function () { return
|
|
3635
|
+
get: function () { return chunkB277MAUK_cjs.MessageAction; }
|
|
3628
3636
|
});
|
|
3629
3637
|
Object.defineProperty(exports, "MessageActions", {
|
|
3630
3638
|
enumerable: true,
|
|
3631
|
-
get: function () { return
|
|
3639
|
+
get: function () { return chunkB277MAUK_cjs.MessageActions; }
|
|
3632
3640
|
});
|
|
3633
3641
|
Object.defineProperty(exports, "MessageAttachment", {
|
|
3634
3642
|
enumerable: true,
|
|
3635
|
-
get: function () { return
|
|
3643
|
+
get: function () { return chunkB277MAUK_cjs.MessageAttachment; }
|
|
3636
3644
|
});
|
|
3637
3645
|
Object.defineProperty(exports, "MessageAttachments", {
|
|
3638
3646
|
enumerable: true,
|
|
3639
|
-
get: function () { return
|
|
3647
|
+
get: function () { return chunkB277MAUK_cjs.MessageAttachments; }
|
|
3640
3648
|
});
|
|
3641
3649
|
Object.defineProperty(exports, "MessageBranch", {
|
|
3642
3650
|
enumerable: true,
|
|
3643
|
-
get: function () { return
|
|
3651
|
+
get: function () { return chunkB277MAUK_cjs.MessageBranch; }
|
|
3644
3652
|
});
|
|
3645
3653
|
Object.defineProperty(exports, "MessageBranchContent", {
|
|
3646
3654
|
enumerable: true,
|
|
3647
|
-
get: function () { return
|
|
3655
|
+
get: function () { return chunkB277MAUK_cjs.MessageBranchContent; }
|
|
3648
3656
|
});
|
|
3649
3657
|
Object.defineProperty(exports, "MessageBranchNext", {
|
|
3650
3658
|
enumerable: true,
|
|
3651
|
-
get: function () { return
|
|
3659
|
+
get: function () { return chunkB277MAUK_cjs.MessageBranchNext; }
|
|
3652
3660
|
});
|
|
3653
3661
|
Object.defineProperty(exports, "MessageBranchPage", {
|
|
3654
3662
|
enumerable: true,
|
|
3655
|
-
get: function () { return
|
|
3663
|
+
get: function () { return chunkB277MAUK_cjs.MessageBranchPage; }
|
|
3656
3664
|
});
|
|
3657
3665
|
Object.defineProperty(exports, "MessageBranchPrevious", {
|
|
3658
3666
|
enumerable: true,
|
|
3659
|
-
get: function () { return
|
|
3667
|
+
get: function () { return chunkB277MAUK_cjs.MessageBranchPrevious; }
|
|
3660
3668
|
});
|
|
3661
3669
|
Object.defineProperty(exports, "MessageBranchSelector", {
|
|
3662
3670
|
enumerable: true,
|
|
3663
|
-
get: function () { return
|
|
3671
|
+
get: function () { return chunkB277MAUK_cjs.MessageBranchSelector; }
|
|
3664
3672
|
});
|
|
3665
3673
|
Object.defineProperty(exports, "MessageContent", {
|
|
3666
3674
|
enumerable: true,
|
|
3667
|
-
get: function () { return
|
|
3675
|
+
get: function () { return chunkB277MAUK_cjs.MessageContent; }
|
|
3668
3676
|
});
|
|
3669
3677
|
Object.defineProperty(exports, "MessageFeedback", {
|
|
3670
3678
|
enumerable: true,
|
|
3671
|
-
get: function () { return
|
|
3679
|
+
get: function () { return chunkB277MAUK_cjs.MessageFeedback; }
|
|
3672
3680
|
});
|
|
3673
3681
|
Object.defineProperty(exports, "MessageResponse", {
|
|
3674
3682
|
enumerable: true,
|
|
3675
|
-
get: function () { return
|
|
3683
|
+
get: function () { return chunkB277MAUK_cjs.MessageResponse; }
|
|
3676
3684
|
});
|
|
3677
3685
|
Object.defineProperty(exports, "MessageToolbar", {
|
|
3678
3686
|
enumerable: true,
|
|
3679
|
-
get: function () { return
|
|
3687
|
+
get: function () { return chunkB277MAUK_cjs.MessageToolbar; }
|
|
3680
3688
|
});
|
|
3681
3689
|
Object.defineProperty(exports, "Source", {
|
|
3682
3690
|
enumerable: true,
|
|
3683
|
-
get: function () { return
|
|
3691
|
+
get: function () { return chunkB277MAUK_cjs.Source; }
|
|
3684
3692
|
});
|
|
3685
3693
|
Object.defineProperty(exports, "Sources", {
|
|
3686
3694
|
enumerable: true,
|
|
3687
|
-
get: function () { return
|
|
3695
|
+
get: function () { return chunkB277MAUK_cjs.Sources; }
|
|
3688
3696
|
});
|
|
3689
3697
|
Object.defineProperty(exports, "SourcesContent", {
|
|
3690
3698
|
enumerable: true,
|
|
3691
|
-
get: function () { return
|
|
3699
|
+
get: function () { return chunkB277MAUK_cjs.SourcesContent; }
|
|
3692
3700
|
});
|
|
3693
3701
|
Object.defineProperty(exports, "SourcesTrigger", {
|
|
3694
3702
|
enumerable: true,
|
|
3695
|
-
get: function () { return
|
|
3703
|
+
get: function () { return chunkB277MAUK_cjs.SourcesTrigger; }
|
|
3696
3704
|
});
|
|
3697
3705
|
Object.defineProperty(exports, "SpinnerLoader", {
|
|
3698
3706
|
enumerable: true,
|
|
3699
|
-
get: function () { return
|
|
3707
|
+
get: function () { return chunkB277MAUK_cjs.SpinnerLoader; }
|
|
3708
|
+
});
|
|
3709
|
+
Object.defineProperty(exports, "anchorToLatestTurn", {
|
|
3710
|
+
enumerable: true,
|
|
3711
|
+
get: function () { return chunkB277MAUK_cjs.anchorToLatestTurn; }
|
|
3700
3712
|
});
|
|
3701
3713
|
exports.AIImage = Image;
|
|
3702
3714
|
exports.Artifact = Artifact;
|
package/dist/ai-elements.d.cts
CHANGED
|
@@ -67,7 +67,69 @@ type MessageToolbarProps = ComponentProps<"div">;
|
|
|
67
67
|
declare const MessageToolbar: ({ className, children, ...props }: MessageToolbarProps) => react_jsx_runtime.JSX.Element;
|
|
68
68
|
|
|
69
69
|
type ConversationProps = ComponentProps<typeof StickToBottom>;
|
|
70
|
+
/**
|
|
71
|
+
* Marks the turn the visitor sent last. {@link anchorToLatestTurn} stops the
|
|
72
|
+
* view there instead of at the bottom of whatever came back.
|
|
73
|
+
*/
|
|
74
|
+
declare const LATEST_TURN_ATTR = "data-ac-latest-turn";
|
|
75
|
+
type TargetScrollTop = NonNullable<ConversationProps["targetScrollTop"]>;
|
|
76
|
+
/**
|
|
77
|
+
* Where "the bottom" is for a conversation: never further down than the point
|
|
78
|
+
* where the latest question reaches the top of the view.
|
|
79
|
+
*
|
|
80
|
+
* ## Why not simply stick to the bottom
|
|
81
|
+
*
|
|
82
|
+
* `StickToBottom` follows the end of the content, which is right while an
|
|
83
|
+
* answer is shorter than the view and wrong the moment it is taller. A reply
|
|
84
|
+
* that carries a product grid can run to thousands of pixels; following its
|
|
85
|
+
* end lands the visitor on the last row of cards with the written answer
|
|
86
|
+
* scrolled far out of sight above. Nothing on screen changes while the text
|
|
87
|
+
* streams in up there, so a turn that worked reads as a chat that stopped
|
|
88
|
+
* answering — which is how it was reported from the field.
|
|
89
|
+
*
|
|
90
|
+
* Capping the target instead gives the reading order people expect: the
|
|
91
|
+
* question pinned at the top, the answer growing downward from it.
|
|
92
|
+
*
|
|
93
|
+
* ## Why it is safe to hand to the library
|
|
94
|
+
*
|
|
95
|
+
* `use-stick-to-bottom` clamps the result to `min(this, bottom)`, so an answer
|
|
96
|
+
* that fits on screen behaves exactly as before. It also treats this capped
|
|
97
|
+
* position as "at the bottom" — so the lock holds while the answer grows, and a
|
|
98
|
+
* visitor who scrolls away still escapes it as usual.
|
|
99
|
+
*
|
|
100
|
+
* Measured from the live layout on every call rather than cached: the anchor
|
|
101
|
+
* moves whenever anything above it changes size (an image loading, an older
|
|
102
|
+
* result folding away), and the library already memoises per animation frame.
|
|
103
|
+
*/
|
|
104
|
+
declare const anchorToLatestTurn: TargetScrollTop;
|
|
70
105
|
declare const Conversation: ({ className, ...props }: ConversationProps) => react_jsx_runtime.JSX.Element;
|
|
106
|
+
/**
|
|
107
|
+
* Bring the view to a turn the visitor just sent. Render inside a
|
|
108
|
+
* {@link Conversation}; `turnKey` is the id of that turn.
|
|
109
|
+
*
|
|
110
|
+
* ## Why the anchor alone is not enough
|
|
111
|
+
*
|
|
112
|
+
* `use-stick-to-bottom` follows new content only while it believes the view is
|
|
113
|
+
* locked to the end, and it drops that lock on any upward scroll it did not
|
|
114
|
+
* make itself — a visitor reading back, but also the browser keeping content
|
|
115
|
+
* steady when something above the view shrinks, as an older result card does
|
|
116
|
+
* when it folds away. Once released it stays released: content growth is
|
|
117
|
+
* handled with the current position preserved, so every later answer streamed
|
|
118
|
+
* in below the fold while the view sat still, and the conversation read as one
|
|
119
|
+
* that had stopped answering.
|
|
120
|
+
*
|
|
121
|
+
* Sending a message is the one moment the visitor has plainly asked to follow
|
|
122
|
+
* along, so this re-engages the lock then. The scroll target is capped by
|
|
123
|
+
* {@link anchorToLatestTurn}, so "re-engage" lands on the new question rather
|
|
124
|
+
* than on the end of a long answer, and the library only ever scrolls
|
|
125
|
+
* downward, so it never drags the view back up over something being read.
|
|
126
|
+
*
|
|
127
|
+
* Deferred a frame so the new turn has been laid out when the target is
|
|
128
|
+
* measured.
|
|
129
|
+
*/
|
|
130
|
+
declare const FollowLatestTurn: ({ turnKey }: {
|
|
131
|
+
turnKey?: string;
|
|
132
|
+
}) => null;
|
|
71
133
|
type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
|
|
72
134
|
declare const ConversationContent: ({ className, ...props }: ConversationContentProps) => react_jsx_runtime.JSX.Element;
|
|
73
135
|
type ConversationEmptyStateProps = ComponentProps<"div"> & {
|
|
@@ -873,4 +935,4 @@ type ImageProps = Experimental_GeneratedImage & {
|
|
|
873
935
|
};
|
|
874
936
|
declare const Image: ({ base64, uint8Array, mediaType, ...props }: ImageProps) => react_jsx_runtime.JSX.Element;
|
|
875
937
|
|
|
876
|
-
export { Image as AIImage, Artifact, ArtifactAction, type ArtifactActionProps, ArtifactActions, type ArtifactActionsProps, ArtifactClose, type ArtifactCloseProps, ArtifactContent, type ArtifactContentProps, ArtifactDescription, type ArtifactDescriptionProps, ArtifactHeader, type ArtifactHeaderProps, type ArtifactProps, ArtifactTitle, type ArtifactTitleProps, type AttachmentsContext, Canvas, ChainOfThought, ChainOfThoughtContent, type ChainOfThoughtContentProps, ChainOfThoughtHeader, type ChainOfThoughtHeaderProps, ChainOfThoughtImage, type ChainOfThoughtImageProps, type ChainOfThoughtProps, ChainOfThoughtSearchResult, type ChainOfThoughtSearchResultProps, ChainOfThoughtSearchResults, type ChainOfThoughtSearchResultsProps, ChainOfThoughtStep, type ChainOfThoughtStepProps, Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps, CodeBlock, CodeBlockCopyButton, type CodeBlockCopyButtonProps, ComponentRenderer, type ComponentRendererProps, Confirmation, ConfirmationAccepted, type ConfirmationAcceptedProps, ConfirmationAction, type ConfirmationActionProps, ConfirmationActions, type ConfirmationActionsProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, ConfirmationRequest, type ConfirmationRequestProps, ConfirmationTitle, type ConfirmationTitleProps, Connection, Context, ContextCacheUsage, type ContextCacheUsageProps, ContextContent, ContextContentBody, type ContextContentBodyProps, ContextContentFooter, type ContextContentFooterProps, ContextContentHeader, type ContextContentHeaderProps, type ContextContentProps, ContextInputUsage, type ContextInputUsageProps, ContextOutputUsage, type ContextOutputUsageProps, type ContextProps, ContextReasoningUsage, type ContextReasoningUsageProps, ContextTrigger, type ContextTriggerProps, Controls, type ControlsProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Edge, FollowupButtons, InlineCitation, InlineCitationCard, InlineCitationCardBody, type InlineCitationCardBodyProps, type InlineCitationCardProps, InlineCitationCardTrigger, type InlineCitationCardTriggerProps, InlineCitationCarousel, InlineCitationCarouselContent, type InlineCitationCarouselContentProps, InlineCitationCarouselHeader, type InlineCitationCarouselHeaderProps, InlineCitationCarouselIndex, type InlineCitationCarouselIndexProps, InlineCitationCarouselItem, type InlineCitationCarouselItemProps, InlineCitationCarouselNext, type InlineCitationCarouselNextProps, InlineCitationCarouselPrev, type InlineCitationCarouselPrevProps, type InlineCitationCarouselProps, type InlineCitationProps, InlineCitationQuote, type InlineCitationQuoteProps, InlineCitationSource, type InlineCitationSourceProps, InlineCitationText, type InlineCitationTextProps, Loader, type LoaderProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAttachment, type MessageAttachmentProps, MessageAttachments, type MessageAttachmentsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, Node, NodeAction, type NodeActionProps, NodeContent, type NodeContentProps, NodeDescription, type NodeDescriptionProps, NodeFooter, type NodeFooterProps, NodeHeader, type NodeHeaderProps, type NodeProps, NodeTitle, type NodeTitleProps, OpenIn, OpenInChatGPT, OpenInClaude, OpenInContent, type OpenInContentProps, OpenInCursor, OpenInItem, type OpenInItemProps, OpenInLabel, type OpenInLabelProps, type OpenInProps, OpenInScira, OpenInSeparator, type OpenInSeparatorProps, OpenInT3, OpenInTrigger, type OpenInTriggerProps, OpenInv0, Panel, Plan, PlanAction, type PlanActionProps, PlanContent, type PlanContentProps, PlanDescription, type PlanDescriptionProps, PlanFooter, type PlanFooterProps, PlanHeader, type PlanHeaderProps, type PlanProps, PlanTitle, type PlanTitleProps, PlanTrigger, type PlanTriggerProps, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputAttachment, type PromptInputAttachmentProps, PromptInputAttachments, type PromptInputAttachmentsProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSpeechButton, type PromptInputSpeechButtonProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Queue, QueueItem, QueueItemAction, type QueueItemActionProps, QueueItemActions, type QueueItemActionsProps, QueueItemAttachment, type QueueItemAttachmentProps, QueueItemContent, type QueueItemContentProps, QueueItemDescription, type QueueItemDescriptionProps, QueueItemFile, type QueueItemFileProps, QueueItemImage, type QueueItemImageProps, QueueItemIndicator, type QueueItemIndicatorProps, type QueueItemProps, QueueList, type QueueListProps, type QueueMessage, type QueueMessagePart, type QueueProps, QueueSection, QueueSectionContent, type QueueSectionContentProps, QueueSectionLabel, type QueueSectionLabelProps, type QueueSectionProps, QueueSectionTrigger, type QueueSectionTriggerProps, type QueueTodo, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, Shimmer, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpinnerLoader, type SpinnerLoaderProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Task, TaskContent, type TaskContentProps, TaskItem, TaskItemFile, type TaskItemFileProps, type TaskItemProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextInputContext, type TextShimmerProps, ThinkingSpinner, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolProps, Toolbar, WebPreview, WebPreviewBody, type WebPreviewBodyProps, WebPreviewConsole, type WebPreviewConsoleProps, type WebPreviewContextValue, WebPreviewNavigation, WebPreviewNavigationButton, type WebPreviewNavigationButtonProps, type WebPreviewNavigationProps, type WebPreviewProps, WebPreviewUrl, type WebPreviewUrlProps, highlightCode, usePromptInputAttachments, usePromptInputController, useProviderAttachments, useReasoning };
|
|
938
|
+
export { Image as AIImage, Artifact, ArtifactAction, type ArtifactActionProps, ArtifactActions, type ArtifactActionsProps, ArtifactClose, type ArtifactCloseProps, ArtifactContent, type ArtifactContentProps, ArtifactDescription, type ArtifactDescriptionProps, ArtifactHeader, type ArtifactHeaderProps, type ArtifactProps, ArtifactTitle, type ArtifactTitleProps, type AttachmentsContext, Canvas, ChainOfThought, ChainOfThoughtContent, type ChainOfThoughtContentProps, ChainOfThoughtHeader, type ChainOfThoughtHeaderProps, ChainOfThoughtImage, type ChainOfThoughtImageProps, type ChainOfThoughtProps, ChainOfThoughtSearchResult, type ChainOfThoughtSearchResultProps, ChainOfThoughtSearchResults, type ChainOfThoughtSearchResultsProps, ChainOfThoughtStep, type ChainOfThoughtStepProps, Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps, CodeBlock, CodeBlockCopyButton, type CodeBlockCopyButtonProps, ComponentRenderer, type ComponentRendererProps, Confirmation, ConfirmationAccepted, type ConfirmationAcceptedProps, ConfirmationAction, type ConfirmationActionProps, ConfirmationActions, type ConfirmationActionsProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, ConfirmationRequest, type ConfirmationRequestProps, ConfirmationTitle, type ConfirmationTitleProps, Connection, Context, ContextCacheUsage, type ContextCacheUsageProps, ContextContent, ContextContentBody, type ContextContentBodyProps, ContextContentFooter, type ContextContentFooterProps, ContextContentHeader, type ContextContentHeaderProps, type ContextContentProps, ContextInputUsage, type ContextInputUsageProps, ContextOutputUsage, type ContextOutputUsageProps, type ContextProps, ContextReasoningUsage, type ContextReasoningUsageProps, ContextTrigger, type ContextTriggerProps, Controls, type ControlsProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Edge, FollowLatestTurn, FollowupButtons, InlineCitation, InlineCitationCard, InlineCitationCardBody, type InlineCitationCardBodyProps, type InlineCitationCardProps, InlineCitationCardTrigger, type InlineCitationCardTriggerProps, InlineCitationCarousel, InlineCitationCarouselContent, type InlineCitationCarouselContentProps, InlineCitationCarouselHeader, type InlineCitationCarouselHeaderProps, InlineCitationCarouselIndex, type InlineCitationCarouselIndexProps, InlineCitationCarouselItem, type InlineCitationCarouselItemProps, InlineCitationCarouselNext, type InlineCitationCarouselNextProps, InlineCitationCarouselPrev, type InlineCitationCarouselPrevProps, type InlineCitationCarouselProps, type InlineCitationProps, InlineCitationQuote, type InlineCitationQuoteProps, InlineCitationSource, type InlineCitationSourceProps, InlineCitationText, type InlineCitationTextProps, LATEST_TURN_ATTR, Loader, type LoaderProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAttachment, type MessageAttachmentProps, MessageAttachments, type MessageAttachmentsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, Node, NodeAction, type NodeActionProps, NodeContent, type NodeContentProps, NodeDescription, type NodeDescriptionProps, NodeFooter, type NodeFooterProps, NodeHeader, type NodeHeaderProps, type NodeProps, NodeTitle, type NodeTitleProps, OpenIn, OpenInChatGPT, OpenInClaude, OpenInContent, type OpenInContentProps, OpenInCursor, OpenInItem, type OpenInItemProps, OpenInLabel, type OpenInLabelProps, type OpenInProps, OpenInScira, OpenInSeparator, type OpenInSeparatorProps, OpenInT3, OpenInTrigger, type OpenInTriggerProps, OpenInv0, Panel, Plan, PlanAction, type PlanActionProps, PlanContent, type PlanContentProps, PlanDescription, type PlanDescriptionProps, PlanFooter, type PlanFooterProps, PlanHeader, type PlanHeaderProps, type PlanProps, PlanTitle, type PlanTitleProps, PlanTrigger, type PlanTriggerProps, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputAttachment, type PromptInputAttachmentProps, PromptInputAttachments, type PromptInputAttachmentsProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSpeechButton, type PromptInputSpeechButtonProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Queue, QueueItem, QueueItemAction, type QueueItemActionProps, QueueItemActions, type QueueItemActionsProps, QueueItemAttachment, type QueueItemAttachmentProps, QueueItemContent, type QueueItemContentProps, QueueItemDescription, type QueueItemDescriptionProps, QueueItemFile, type QueueItemFileProps, QueueItemImage, type QueueItemImageProps, QueueItemIndicator, type QueueItemIndicatorProps, type QueueItemProps, QueueList, type QueueListProps, type QueueMessage, type QueueMessagePart, type QueueProps, QueueSection, QueueSectionContent, type QueueSectionContentProps, QueueSectionLabel, type QueueSectionLabelProps, type QueueSectionProps, QueueSectionTrigger, type QueueSectionTriggerProps, type QueueTodo, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, Shimmer, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpinnerLoader, type SpinnerLoaderProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Task, TaskContent, type TaskContentProps, TaskItem, TaskItemFile, type TaskItemFileProps, type TaskItemProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextInputContext, type TextShimmerProps, ThinkingSpinner, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolProps, Toolbar, WebPreview, WebPreviewBody, type WebPreviewBodyProps, WebPreviewConsole, type WebPreviewConsoleProps, type WebPreviewContextValue, WebPreviewNavigation, WebPreviewNavigationButton, type WebPreviewNavigationButtonProps, type WebPreviewNavigationProps, type WebPreviewProps, WebPreviewUrl, type WebPreviewUrlProps, anchorToLatestTurn, highlightCode, usePromptInputAttachments, usePromptInputController, useProviderAttachments, useReasoning };
|
package/dist/ai-elements.d.ts
CHANGED
|
@@ -67,7 +67,69 @@ type MessageToolbarProps = ComponentProps<"div">;
|
|
|
67
67
|
declare const MessageToolbar: ({ className, children, ...props }: MessageToolbarProps) => react_jsx_runtime.JSX.Element;
|
|
68
68
|
|
|
69
69
|
type ConversationProps = ComponentProps<typeof StickToBottom>;
|
|
70
|
+
/**
|
|
71
|
+
* Marks the turn the visitor sent last. {@link anchorToLatestTurn} stops the
|
|
72
|
+
* view there instead of at the bottom of whatever came back.
|
|
73
|
+
*/
|
|
74
|
+
declare const LATEST_TURN_ATTR = "data-ac-latest-turn";
|
|
75
|
+
type TargetScrollTop = NonNullable<ConversationProps["targetScrollTop"]>;
|
|
76
|
+
/**
|
|
77
|
+
* Where "the bottom" is for a conversation: never further down than the point
|
|
78
|
+
* where the latest question reaches the top of the view.
|
|
79
|
+
*
|
|
80
|
+
* ## Why not simply stick to the bottom
|
|
81
|
+
*
|
|
82
|
+
* `StickToBottom` follows the end of the content, which is right while an
|
|
83
|
+
* answer is shorter than the view and wrong the moment it is taller. A reply
|
|
84
|
+
* that carries a product grid can run to thousands of pixels; following its
|
|
85
|
+
* end lands the visitor on the last row of cards with the written answer
|
|
86
|
+
* scrolled far out of sight above. Nothing on screen changes while the text
|
|
87
|
+
* streams in up there, so a turn that worked reads as a chat that stopped
|
|
88
|
+
* answering — which is how it was reported from the field.
|
|
89
|
+
*
|
|
90
|
+
* Capping the target instead gives the reading order people expect: the
|
|
91
|
+
* question pinned at the top, the answer growing downward from it.
|
|
92
|
+
*
|
|
93
|
+
* ## Why it is safe to hand to the library
|
|
94
|
+
*
|
|
95
|
+
* `use-stick-to-bottom` clamps the result to `min(this, bottom)`, so an answer
|
|
96
|
+
* that fits on screen behaves exactly as before. It also treats this capped
|
|
97
|
+
* position as "at the bottom" — so the lock holds while the answer grows, and a
|
|
98
|
+
* visitor who scrolls away still escapes it as usual.
|
|
99
|
+
*
|
|
100
|
+
* Measured from the live layout on every call rather than cached: the anchor
|
|
101
|
+
* moves whenever anything above it changes size (an image loading, an older
|
|
102
|
+
* result folding away), and the library already memoises per animation frame.
|
|
103
|
+
*/
|
|
104
|
+
declare const anchorToLatestTurn: TargetScrollTop;
|
|
70
105
|
declare const Conversation: ({ className, ...props }: ConversationProps) => react_jsx_runtime.JSX.Element;
|
|
106
|
+
/**
|
|
107
|
+
* Bring the view to a turn the visitor just sent. Render inside a
|
|
108
|
+
* {@link Conversation}; `turnKey` is the id of that turn.
|
|
109
|
+
*
|
|
110
|
+
* ## Why the anchor alone is not enough
|
|
111
|
+
*
|
|
112
|
+
* `use-stick-to-bottom` follows new content only while it believes the view is
|
|
113
|
+
* locked to the end, and it drops that lock on any upward scroll it did not
|
|
114
|
+
* make itself — a visitor reading back, but also the browser keeping content
|
|
115
|
+
* steady when something above the view shrinks, as an older result card does
|
|
116
|
+
* when it folds away. Once released it stays released: content growth is
|
|
117
|
+
* handled with the current position preserved, so every later answer streamed
|
|
118
|
+
* in below the fold while the view sat still, and the conversation read as one
|
|
119
|
+
* that had stopped answering.
|
|
120
|
+
*
|
|
121
|
+
* Sending a message is the one moment the visitor has plainly asked to follow
|
|
122
|
+
* along, so this re-engages the lock then. The scroll target is capped by
|
|
123
|
+
* {@link anchorToLatestTurn}, so "re-engage" lands on the new question rather
|
|
124
|
+
* than on the end of a long answer, and the library only ever scrolls
|
|
125
|
+
* downward, so it never drags the view back up over something being read.
|
|
126
|
+
*
|
|
127
|
+
* Deferred a frame so the new turn has been laid out when the target is
|
|
128
|
+
* measured.
|
|
129
|
+
*/
|
|
130
|
+
declare const FollowLatestTurn: ({ turnKey }: {
|
|
131
|
+
turnKey?: string;
|
|
132
|
+
}) => null;
|
|
71
133
|
type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
|
|
72
134
|
declare const ConversationContent: ({ className, ...props }: ConversationContentProps) => react_jsx_runtime.JSX.Element;
|
|
73
135
|
type ConversationEmptyStateProps = ComponentProps<"div"> & {
|
|
@@ -873,4 +935,4 @@ type ImageProps = Experimental_GeneratedImage & {
|
|
|
873
935
|
};
|
|
874
936
|
declare const Image: ({ base64, uint8Array, mediaType, ...props }: ImageProps) => react_jsx_runtime.JSX.Element;
|
|
875
937
|
|
|
876
|
-
export { Image as AIImage, Artifact, ArtifactAction, type ArtifactActionProps, ArtifactActions, type ArtifactActionsProps, ArtifactClose, type ArtifactCloseProps, ArtifactContent, type ArtifactContentProps, ArtifactDescription, type ArtifactDescriptionProps, ArtifactHeader, type ArtifactHeaderProps, type ArtifactProps, ArtifactTitle, type ArtifactTitleProps, type AttachmentsContext, Canvas, ChainOfThought, ChainOfThoughtContent, type ChainOfThoughtContentProps, ChainOfThoughtHeader, type ChainOfThoughtHeaderProps, ChainOfThoughtImage, type ChainOfThoughtImageProps, type ChainOfThoughtProps, ChainOfThoughtSearchResult, type ChainOfThoughtSearchResultProps, ChainOfThoughtSearchResults, type ChainOfThoughtSearchResultsProps, ChainOfThoughtStep, type ChainOfThoughtStepProps, Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps, CodeBlock, CodeBlockCopyButton, type CodeBlockCopyButtonProps, ComponentRenderer, type ComponentRendererProps, Confirmation, ConfirmationAccepted, type ConfirmationAcceptedProps, ConfirmationAction, type ConfirmationActionProps, ConfirmationActions, type ConfirmationActionsProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, ConfirmationRequest, type ConfirmationRequestProps, ConfirmationTitle, type ConfirmationTitleProps, Connection, Context, ContextCacheUsage, type ContextCacheUsageProps, ContextContent, ContextContentBody, type ContextContentBodyProps, ContextContentFooter, type ContextContentFooterProps, ContextContentHeader, type ContextContentHeaderProps, type ContextContentProps, ContextInputUsage, type ContextInputUsageProps, ContextOutputUsage, type ContextOutputUsageProps, type ContextProps, ContextReasoningUsage, type ContextReasoningUsageProps, ContextTrigger, type ContextTriggerProps, Controls, type ControlsProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Edge, FollowupButtons, InlineCitation, InlineCitationCard, InlineCitationCardBody, type InlineCitationCardBodyProps, type InlineCitationCardProps, InlineCitationCardTrigger, type InlineCitationCardTriggerProps, InlineCitationCarousel, InlineCitationCarouselContent, type InlineCitationCarouselContentProps, InlineCitationCarouselHeader, type InlineCitationCarouselHeaderProps, InlineCitationCarouselIndex, type InlineCitationCarouselIndexProps, InlineCitationCarouselItem, type InlineCitationCarouselItemProps, InlineCitationCarouselNext, type InlineCitationCarouselNextProps, InlineCitationCarouselPrev, type InlineCitationCarouselPrevProps, type InlineCitationCarouselProps, type InlineCitationProps, InlineCitationQuote, type InlineCitationQuoteProps, InlineCitationSource, type InlineCitationSourceProps, InlineCitationText, type InlineCitationTextProps, Loader, type LoaderProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAttachment, type MessageAttachmentProps, MessageAttachments, type MessageAttachmentsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, Node, NodeAction, type NodeActionProps, NodeContent, type NodeContentProps, NodeDescription, type NodeDescriptionProps, NodeFooter, type NodeFooterProps, NodeHeader, type NodeHeaderProps, type NodeProps, NodeTitle, type NodeTitleProps, OpenIn, OpenInChatGPT, OpenInClaude, OpenInContent, type OpenInContentProps, OpenInCursor, OpenInItem, type OpenInItemProps, OpenInLabel, type OpenInLabelProps, type OpenInProps, OpenInScira, OpenInSeparator, type OpenInSeparatorProps, OpenInT3, OpenInTrigger, type OpenInTriggerProps, OpenInv0, Panel, Plan, PlanAction, type PlanActionProps, PlanContent, type PlanContentProps, PlanDescription, type PlanDescriptionProps, PlanFooter, type PlanFooterProps, PlanHeader, type PlanHeaderProps, type PlanProps, PlanTitle, type PlanTitleProps, PlanTrigger, type PlanTriggerProps, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputAttachment, type PromptInputAttachmentProps, PromptInputAttachments, type PromptInputAttachmentsProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSpeechButton, type PromptInputSpeechButtonProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Queue, QueueItem, QueueItemAction, type QueueItemActionProps, QueueItemActions, type QueueItemActionsProps, QueueItemAttachment, type QueueItemAttachmentProps, QueueItemContent, type QueueItemContentProps, QueueItemDescription, type QueueItemDescriptionProps, QueueItemFile, type QueueItemFileProps, QueueItemImage, type QueueItemImageProps, QueueItemIndicator, type QueueItemIndicatorProps, type QueueItemProps, QueueList, type QueueListProps, type QueueMessage, type QueueMessagePart, type QueueProps, QueueSection, QueueSectionContent, type QueueSectionContentProps, QueueSectionLabel, type QueueSectionLabelProps, type QueueSectionProps, QueueSectionTrigger, type QueueSectionTriggerProps, type QueueTodo, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, Shimmer, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpinnerLoader, type SpinnerLoaderProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Task, TaskContent, type TaskContentProps, TaskItem, TaskItemFile, type TaskItemFileProps, type TaskItemProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextInputContext, type TextShimmerProps, ThinkingSpinner, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolProps, Toolbar, WebPreview, WebPreviewBody, type WebPreviewBodyProps, WebPreviewConsole, type WebPreviewConsoleProps, type WebPreviewContextValue, WebPreviewNavigation, WebPreviewNavigationButton, type WebPreviewNavigationButtonProps, type WebPreviewNavigationProps, type WebPreviewProps, WebPreviewUrl, type WebPreviewUrlProps, highlightCode, usePromptInputAttachments, usePromptInputController, useProviderAttachments, useReasoning };
|
|
938
|
+
export { Image as AIImage, Artifact, ArtifactAction, type ArtifactActionProps, ArtifactActions, type ArtifactActionsProps, ArtifactClose, type ArtifactCloseProps, ArtifactContent, type ArtifactContentProps, ArtifactDescription, type ArtifactDescriptionProps, ArtifactHeader, type ArtifactHeaderProps, type ArtifactProps, ArtifactTitle, type ArtifactTitleProps, type AttachmentsContext, Canvas, ChainOfThought, ChainOfThoughtContent, type ChainOfThoughtContentProps, ChainOfThoughtHeader, type ChainOfThoughtHeaderProps, ChainOfThoughtImage, type ChainOfThoughtImageProps, type ChainOfThoughtProps, ChainOfThoughtSearchResult, type ChainOfThoughtSearchResultProps, ChainOfThoughtSearchResults, type ChainOfThoughtSearchResultsProps, ChainOfThoughtStep, type ChainOfThoughtStepProps, Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps, CodeBlock, CodeBlockCopyButton, type CodeBlockCopyButtonProps, ComponentRenderer, type ComponentRendererProps, Confirmation, ConfirmationAccepted, type ConfirmationAcceptedProps, ConfirmationAction, type ConfirmationActionProps, ConfirmationActions, type ConfirmationActionsProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, ConfirmationRequest, type ConfirmationRequestProps, ConfirmationTitle, type ConfirmationTitleProps, Connection, Context, ContextCacheUsage, type ContextCacheUsageProps, ContextContent, ContextContentBody, type ContextContentBodyProps, ContextContentFooter, type ContextContentFooterProps, ContextContentHeader, type ContextContentHeaderProps, type ContextContentProps, ContextInputUsage, type ContextInputUsageProps, ContextOutputUsage, type ContextOutputUsageProps, type ContextProps, ContextReasoningUsage, type ContextReasoningUsageProps, ContextTrigger, type ContextTriggerProps, Controls, type ControlsProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Edge, FollowLatestTurn, FollowupButtons, InlineCitation, InlineCitationCard, InlineCitationCardBody, type InlineCitationCardBodyProps, type InlineCitationCardProps, InlineCitationCardTrigger, type InlineCitationCardTriggerProps, InlineCitationCarousel, InlineCitationCarouselContent, type InlineCitationCarouselContentProps, InlineCitationCarouselHeader, type InlineCitationCarouselHeaderProps, InlineCitationCarouselIndex, type InlineCitationCarouselIndexProps, InlineCitationCarouselItem, type InlineCitationCarouselItemProps, InlineCitationCarouselNext, type InlineCitationCarouselNextProps, InlineCitationCarouselPrev, type InlineCitationCarouselPrevProps, type InlineCitationCarouselProps, type InlineCitationProps, InlineCitationQuote, type InlineCitationQuoteProps, InlineCitationSource, type InlineCitationSourceProps, InlineCitationText, type InlineCitationTextProps, LATEST_TURN_ATTR, Loader, type LoaderProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAttachment, type MessageAttachmentProps, MessageAttachments, type MessageAttachmentsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, Node, NodeAction, type NodeActionProps, NodeContent, type NodeContentProps, NodeDescription, type NodeDescriptionProps, NodeFooter, type NodeFooterProps, NodeHeader, type NodeHeaderProps, type NodeProps, NodeTitle, type NodeTitleProps, OpenIn, OpenInChatGPT, OpenInClaude, OpenInContent, type OpenInContentProps, OpenInCursor, OpenInItem, type OpenInItemProps, OpenInLabel, type OpenInLabelProps, type OpenInProps, OpenInScira, OpenInSeparator, type OpenInSeparatorProps, OpenInT3, OpenInTrigger, type OpenInTriggerProps, OpenInv0, Panel, Plan, PlanAction, type PlanActionProps, PlanContent, type PlanContentProps, PlanDescription, type PlanDescriptionProps, PlanFooter, type PlanFooterProps, PlanHeader, type PlanHeaderProps, type PlanProps, PlanTitle, type PlanTitleProps, PlanTrigger, type PlanTriggerProps, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputAttachment, type PromptInputAttachmentProps, PromptInputAttachments, type PromptInputAttachmentsProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSpeechButton, type PromptInputSpeechButtonProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Queue, QueueItem, QueueItemAction, type QueueItemActionProps, QueueItemActions, type QueueItemActionsProps, QueueItemAttachment, type QueueItemAttachmentProps, QueueItemContent, type QueueItemContentProps, QueueItemDescription, type QueueItemDescriptionProps, QueueItemFile, type QueueItemFileProps, QueueItemImage, type QueueItemImageProps, QueueItemIndicator, type QueueItemIndicatorProps, type QueueItemProps, QueueList, type QueueListProps, type QueueMessage, type QueueMessagePart, type QueueProps, QueueSection, QueueSectionContent, type QueueSectionContentProps, QueueSectionLabel, type QueueSectionLabelProps, type QueueSectionProps, QueueSectionTrigger, type QueueSectionTriggerProps, type QueueTodo, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, Shimmer, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpinnerLoader, type SpinnerLoaderProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Task, TaskContent, type TaskContentProps, TaskItem, TaskItemFile, type TaskItemFileProps, type TaskItemProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextInputContext, type TextShimmerProps, ThinkingSpinner, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolProps, Toolbar, WebPreview, WebPreviewBody, type WebPreviewBodyProps, WebPreviewConsole, type WebPreviewConsoleProps, type WebPreviewContextValue, WebPreviewNavigation, WebPreviewNavigationButton, type WebPreviewNavigationButtonProps, type WebPreviewNavigationProps, type WebPreviewProps, WebPreviewUrl, type WebPreviewUrlProps, anchorToLatestTurn, highlightCode, usePromptInputAttachments, usePromptInputController, useProviderAttachments, useReasoning };
|
package/dist/ai-elements.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { detectLanguage, LATIN } from './chunk-BYTPAQ7F.js';
|
|
3
|
-
export { Conversation, ConversationContent, ConversationEmptyState, ConversationScrollButton, Loader, Message, MessageAction, MessageActions, MessageAttachment, MessageAttachments, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageFeedback, MessageResponse, MessageToolbar, Source, Sources, SourcesContent, SourcesTrigger, SpinnerLoader } from './chunk-
|
|
3
|
+
export { Conversation, ConversationContent, ConversationEmptyState, ConversationScrollButton, FollowLatestTurn, LATEST_TURN_ATTR, Loader, Message, MessageAction, MessageActions, MessageAttachment, MessageAttachments, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageFeedback, MessageResponse, MessageToolbar, Source, Sources, SourcesContent, SourcesTrigger, SpinnerLoader, anchorToLatestTurn } from './chunk-O5TPHZRP.js';
|
|
4
4
|
import './chunk-MZQKGNWF.js';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-LDQVDUUJ.js';
|
|
6
6
|
import { processImagesInHtml } from './chunk-PS3U7T37.js';
|
|
7
7
|
import { Badge, Input, Carousel, CarouselContent, CarouselItem, ScrollArea, ScrollBar, Progress, Alert, AlertDescription, Dialog, DialogTrigger, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from './chunk-R3TYC66R.js';
|
|
8
8
|
import { Collapsible, CollapsibleTrigger, CollapsibleContent, Button, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, Separator, Textarea } from './chunk-JAOD6CNW.js';
|
|
@@ -22,6 +22,7 @@ var en = {
|
|
|
22
22
|
conversationTooLong: "Conversation Too Long",
|
|
23
23
|
conversationTooLongDesc: "The conversation has become too long to continue.",
|
|
24
24
|
somethingWentWrongDesc: "We encountered an issue. Please try again or start fresh.",
|
|
25
|
+
tryAgain: "Try Again",
|
|
25
26
|
typeMessage: "Type a message...",
|
|
26
27
|
send: "Send",
|
|
27
28
|
aboutUs: "About Us",
|
|
@@ -128,6 +129,7 @@ var he = {
|
|
|
128
129
|
conversationTooLong: "\u05D4\u05E9\u05D9\u05D7\u05D4 \u05D0\u05E8\u05D5\u05DB\u05D4 \u05DE\u05D3\u05D9",
|
|
129
130
|
conversationTooLongDesc: "\u05D4\u05E9\u05D9\u05D7\u05D4 \u05D4\u05E4\u05DB\u05D4 \u05DC\u05D0\u05E8\u05D5\u05DB\u05D4 \u05DE\u05D3\u05D9 \u05D1\u05E9\u05D1\u05D9\u05DC \u05DC\u05D4\u05DE\u05E9\u05D9\u05DA.",
|
|
130
131
|
somethingWentWrongDesc: "\u05E0\u05EA\u05E7\u05DC\u05E0\u05D5 \u05D1\u05D1\u05E2\u05D9\u05D4. \u05D0\u05E0\u05D0 \u05E0\u05E1\u05D5 \u05E9\u05D5\u05D1 \u05D0\u05D5 \u05D4\u05EA\u05D7\u05D9\u05DC\u05D5 \u05DE\u05D7\u05D3\u05E9.",
|
|
132
|
+
tryAgain: "\u05DC\u05E0\u05E1\u05D5\u05EA \u05E9\u05D5\u05D1",
|
|
131
133
|
typeMessage: "\u05D4\u05E7\u05DC\u05D3 \u05D4\u05D5\u05D3\u05E2\u05D4...",
|
|
132
134
|
send: "\u05E9\u05DC\u05D7",
|
|
133
135
|
aboutUs: "\u05D0\u05D5\u05D3\u05D5\u05EA\u05D9\u05E0\u05D5",
|
|
@@ -266,5 +268,5 @@ exports.I18nProvider = I18nProvider;
|
|
|
266
268
|
exports.addLanguage = addLanguage;
|
|
267
269
|
exports.isRTL = isRTL;
|
|
268
270
|
exports.useI18n = useI18n;
|
|
269
|
-
//# sourceMappingURL=chunk-
|
|
270
|
-
//# sourceMappingURL=chunk-
|
|
271
|
+
//# sourceMappingURL=chunk-72QJ2ORD.cjs.map
|
|
272
|
+
//# sourceMappingURL=chunk-72QJ2ORD.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/providers/I18nProvider.tsx"],"names":["createContext","useState","useCallback","useMemo","jsx","useContext"],"mappings":";;;;;;AA6HA,IAAM,EAAA,GAAqB;AAAA,EACzB,YAAA,EAAc,yBAAA;AAAA,EACd,eAAA,EAAiB,wEAAA;AAAA,EACjB,mBAAA,EAAqB,6BAAA;AAAA,EACrB,YAAA,EAAc,4BAAA;AAAA,EACd,UAAA,EAAY,eAAA;AAAA,EACZ,QAAA,EAAU,aAAA;AAAA,EACV,eAAA,EAAiB,kBAAA;AAAA,EACjB,WAAA,EAAa,eAAA;AAAA,EACb,SAAA,EAAW,YAAA;AAAA,EACX,YAAA,EAAc,4BAAA;AAAA,EACd,SAAA,EAAW,YAAA;AAAA,EACX,oBAAA,EAAsB,wBAAA;AAAA,EACtB,kBAAA,EAAoB,sBAAA;AAAA,EACpB,mBAAA,EAAqB,uBAAA;AAAA,EACrB,uBAAA,EAAyB,mDAAA;AAAA,EACzB,sBAAA,EAAwB,2DAAA;AAAA,EACxB,QAAA,EAAU,WAAA;AAAA,EACV,WAAA,EAAa,mBAAA;AAAA,EACb,IAAA,EAAM,MAAA;AAAA,EACN,OAAA,EAAS,UAAA;AAAA,EACT,WAAA,EAAa,+BAAA;AAAA,EACb,OAAA,EAAS,SAAA;AAAA,EACT,WAAA,EAAa,8BAAA;AAAA,EACb,QAAA,EAAU,UAAA;AAAA,EACV,YAAA,EAAc,yBAAA;AAAA,EACd,MAAA,EAAQ,QAAA;AAAA,EACR,UAAA,EAAY,2BAAA;A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A,EAAU,aAAa,SAAA,EAAU,CAAA;AAAA,IAC7C,CAAC,CAAA,EAAG,QAAA,EAAU,SAAS;AAAA,GACzB;AAEA,EAAA,uBAAOC,cAAA,CAAC,WAAA,CAAY,QAAA,EAAZ,EAAqB,OAAe,QAAA,EAAS,CAAA;AACvD;AAMO,SAAS,OAAA,GAA4B;AAC1C,EAAA,MAAM,GAAA,GAAMC,iBAAW,WAAW,CAAA;AAClC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,MAAM,6CAA6C,CAAA;AAAA,EAC/D;AACA,EAAA,OAAO,GAAA;AACT","file":"chunk-72QJ2ORD.cjs","sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useContext,\n useState,\n useCallback,\n useMemo,\n type ReactNode,\n} from \"react\";\n\n/**\n * All supported translation keys.\n */\nexport type TranslationKeys =\n | \"welcomeTitle\"\n | \"welcomeSubtitle\"\n | \"searchKnowledgeBase\"\n | \"searchingFor\"\n | \"processing\"\n | \"thinking\"\n | \"newConversation\"\n | \"backToStart\"\n | \"closeChat\"\n | \"alwaysVerify\"\n | \"poweredBy\"\n | \"startNewConversation\"\n | \"somethingWentWrong\"\n | \"conversationTooLong\"\n | \"conversationTooLongDesc\"\n | \"somethingWentWrongDesc\"\n | \"tryAgain\"\n | \"typeMessage\"\n | \"send\"\n | \"aboutUs\"\n | \"aboutUsDesc\"\n | \"support\"\n | \"supportDesc\"\n | \"features\"\n | \"featuresDesc\"\n | \"search\"\n | \"searchDesc\"\n | \"greeting\"\n | \"guest\"\n | \"guestDesc\"\n | \"customer\"\n | \"customerDesc\"\n | \"partner\"\n | \"partnerDesc\"\n | \"aboutUsQuery\"\n | \"supportQuery\"\n | \"featuresQuery\"\n | \"searchQuery\"\n | \"whatWentWrong\"\n | \"wrongAnswer\"\n | \"partialAnswer\"\n | \"hallucination\"\n | \"inappropriateTone\"\n | \"addDetails\"\n | \"submitting\"\n | \"submitFeedback\"\n | \"helpful\"\n | \"notHelpful\"\n | \"copyResponse\"\n | \"searchingProducts\"\n | \"searchingProductsFor\"\n | \"sendingVerification\"\n | \"verifyingOrders\"\n | \"generatingLogin\"\n | \"noProductsFound\"\n | \"noOrdersFound\"\n | \"inStock\"\n | \"outOfStock\"\n | \"backorder\"\n | \"sale\"\n | \"addToCart\"\n | \"addedToCart\"\n | \"addToCartError\"\n | \"loginToStore\"\n | \"enterEmail\"\n | \"sendCode\"\n | \"otpSentTo\"\n | \"verifyCode\"\n | \"verifiedSuccess\"\n | \"resendCode\"\n | \"invalidCode\"\n | \"selectVariation\"\n | \"orderStatus_completed\"\n | \"orderStatus_processing\"\n | \"orderStatus_on-hold\"\n | \"orderStatus_pending\"\n | \"orderStatus_cancelled\"\n | \"orderStatus_failed\"\n | \"orderStatus_refunded\"\n | \"cart\"\n | \"yourCart\"\n | \"cartItems\"\n | \"cartEmpty\"\n | \"checkout\"\n | \"cartTotal\"\n | \"removeItem\"\n | \"liveChatConnecting\"\n | \"liveChatPosition\"\n | \"liveChatCancel\"\n | \"liveChatChattingWith\"\n | \"liveChatEndChat\"\n | \"liveChatRateTitle\"\n | \"liveChatRateThank\"\n | \"liveChatBackToAI\"\n | \"liveChatSubmit\"\n | \"liveChatSkip\"\n | \"liveChatFeedbackPlaceholder\"\n | \"liveChatTalkToHuman\"\n | \"liveChatIdentityTitle\"\n | \"liveChatIdentityName\"\n | \"liveChatIdentityEmail\"\n | \"liveChatIdentityConnect\"\n | \"liveChatIdentityContinue\"\n | \"liveChatRateExperience\"\n | \"liveChatEnded\";\n\n/** A complete set of translations for a language. */\nexport type TranslationMap = Record<TranslationKeys, string>;\n\n/** Built-in English translations. */\nconst en: TranslationMap = {\n welcomeTitle: \"Welcome to {clientName}\",\n welcomeSubtitle: \"How can I assist you today? Select a topic or type your message below.\",\n searchKnowledgeBase: \"Searching knowledge base...\",\n searchingFor: 'Searching for \"{query}\"...',\n processing: \"Processing...\",\n thinking: \"Thinking...\",\n newConversation: \"New conversation\",\n backToStart: \"Back to start\",\n closeChat: \"Close chat\",\n alwaysVerify: \"Always verify AI responses\",\n poweredBy: \"powered by\",\n startNewConversation: \"Start New Conversation\",\n somethingWentWrong: \"Something Went Wrong\",\n conversationTooLong: \"Conversation Too Long\",\n conversationTooLongDesc: \"The conversation has become too long to continue.\",\n somethingWentWrongDesc: \"We encountered an issue. Please try again or start fresh.\",\n tryAgain: \"Try Again\",\n typeMessage: \"Type a message...\",\n send: \"Send\",\n aboutUs: \"About Us\",\n aboutUsDesc: \"Learn more about our services\",\n support: \"Support\",\n supportDesc: \"Get help with your questions\",\n features: \"Features\",\n featuresDesc: \"Discover what we can do\",\n search: \"Search\",\n searchDesc: \"Find specific information\",\n greeting: \"Hi there 👋 How can I help you today?\",\n guest: \"Guest\",\n guestDesc: \"Just browsing\",\n customer: \"Customer\",\n customerDesc: \"Existing customer with questions\",\n partner: \"Partner\",\n partnerDesc: \"Business partner or professional\",\n aboutUsQuery: \"Tell me about About Us\",\n supportQuery: \"Tell me about Support\",\n featuresQuery: \"Tell me about Features\",\n searchQuery: \"Tell me about Search\",\n whatWentWrong: \"What went wrong?\",\n wrongAnswer: \"Wrong answer\",\n partialAnswer: \"Partial answer\",\n hallucination: \"Hallucination\",\n inappropriateTone: \"Inappropriate tone\",\n addDetails: \"Add details (optional)...\",\n submitting: \"Submitting...\",\n submitFeedback: \"Submit Feedback\",\n helpful: \"Helpful\",\n notHelpful: \"Not helpful\",\n copyResponse: \"Copy response\",\n searchingProducts: \"Searching products...\",\n searchingProductsFor: 'Searching products: \"{query}\"...',\n sendingVerification: \"Sending verification code...\",\n verifyingOrders: \"Verifying and fetching orders...\",\n generatingLogin: \"Generating login link...\",\n noProductsFound: \"No products found\",\n noOrdersFound: \"No orders found\",\n inStock: \"In stock\",\n outOfStock: \"Out of stock\",\n backorder: \"Backorder\",\n sale: \"Sale\",\n addToCart: \"Add to Cart\",\n addedToCart: \"Added to cart!\",\n addToCartError: \"Failed to add to cart\",\n loginToStore: \"Login to Store\",\n enterEmail: \"Enter your email to verify\",\n sendCode: \"Send verification code\",\n otpSentTo: \"Verification code sent to {email}\",\n verifyCode: \"Verify\",\n verifiedSuccess: \"Verified successfully!\",\n resendCode: \"Resend code\",\n invalidCode: \"Invalid code, please try again\",\n selectVariation: \"Select\",\n orderStatus_completed: \"Completed\",\n orderStatus_processing: \"Processing\",\n \"orderStatus_on-hold\": \"On Hold\",\n orderStatus_pending: \"Pending\",\n orderStatus_cancelled: \"Cancelled\",\n orderStatus_failed: \"Failed\",\n orderStatus_refunded: \"Refunded\",\n cart: \"Cart\",\n yourCart: \"Your Cart\",\n cartItems: \"{count} items\",\n cartEmpty: \"Your cart is empty\",\n checkout: \"Checkout\",\n cartTotal: \"Total\",\n removeItem: \"Remove\",\n liveChatConnecting: \"Connecting you with an operator...\",\n liveChatPosition: \"Position #{position}\",\n liveChatCancel: \"Cancel\",\n liveChatChattingWith: \"Chatting with {name}\",\n liveChatEndChat: \"End Chat\",\n liveChatRateTitle: \"How was your experience?\",\n liveChatRateThank: \"Thank you for your feedback!\",\n liveChatBackToAI: \"Back to AI Assistant\",\n liveChatSubmit: \"Submit\",\n liveChatSkip: \"Skip\",\n liveChatFeedbackPlaceholder: \"Any additional feedback? (optional)\",\n liveChatTalkToHuman: \"Talk to an operator\",\n liveChatIdentityTitle: \"Please provide your details to connect with an operator\",\n liveChatIdentityName: \"Your name\",\n liveChatIdentityEmail: \"Your email\",\n liveChatIdentityConnect: \"Connect\",\n liveChatIdentityContinue: \"Continue\",\n liveChatRateExperience: \"Rate your experience\",\n liveChatEnded: \"Chat ended\",\n};\n\n/** Built-in Hebrew translations. */\nconst he: TranslationMap = {\n welcomeTitle: \"ברוכים הבאים ל-{clientName}\",\n welcomeSubtitle: \"איך אוכל לעזור היום? בחרו נושא או הקלידו הודעה למטה.\",\n searchKnowledgeBase: \"מחפש במאגר הידע...\",\n searchingFor: 'מחפש את \"{query}\"...',\n processing: \"מעבד...\",\n thinking: \"חושב...\",\n newConversation: \"שיחה חדשה\",\n backToStart: \"חזרה להתחלה\",\n closeChat: \"סגור צ'אט\",\n alwaysVerify: \"תמיד כדאי לוודא את תשובות ה-AI\",\n poweredBy: \"מופעל על ידי\",\n startNewConversation: \"התחל שיחה חדשה\",\n somethingWentWrong: \"משהו השתבש\",\n conversationTooLong: \"השיחה ארוכה מדי\",\n conversationTooLongDesc: \"השיחה הפכה לארוכה מדי בשביל להמשיך.\",\n somethingWentWrongDesc: \"נתקלנו בבעיה. אנא נסו שוב או התחילו מחדש.\",\n tryAgain: \"לנסות שוב\",\n typeMessage: \"הקלד הודעה...\",\n send: \"שלח\",\n aboutUs: \"אודותינו\",\n aboutUsDesc: \"למדו עוד על השירותים שלנו\",\n support: \"תמיכה\",\n supportDesc: \"קבלו עזרה עם השאלות שלכם\",\n features: \"פיצ'רים\",\n featuresDesc: \"גלו מה אנחנו יכולים לעשות\",\n search: \"חיפוש\",\n searchDesc: \"מצאו מידע ספציפי\",\n greeting: \"שלום 👋 איך אוכל לעזור לכם היום?\",\n guest: \"אורח\",\n guestDesc: \"רק גולש\",\n customer: \"לקוח\",\n customerDesc: \"לקוח קיים עם שאלות\",\n partner: \"שותף\",\n partnerDesc: \"שותף עסקי או איש מקצוע\",\n aboutUsQuery: \"ספר לי על אודותינו\",\n supportQuery: \"ספר לי על תמיכה\",\n featuresQuery: \"ספר לי על פיצ'רים\",\n searchQuery: \"ספר לי על חיפוש\",\n whatWentWrong: \"מה השתבש?\",\n wrongAnswer: \"תשובה לא נכונה\",\n partialAnswer: \"תשובה חלקית\",\n hallucination: \"הזיה (מידע מומצא)\",\n inappropriateTone: \"טון לא הולם\",\n addDetails: \"הוסיפו פרטים (אופציונלי)...\",\n submitting: \"שולח...\",\n submitFeedback: \"שלח משוב\",\n helpful: \"עוזר\",\n notHelpful: \"לא עוזר\",\n copyResponse: \"העתק תשובה\",\n searchingProducts: \"מחפש מוצרים...\",\n searchingProductsFor: 'מחפש מוצרים: \"{query}\"...',\n sendingVerification: \"שולח קוד אימות...\",\n verifyingOrders: \"מאמת ומביא הזמנות...\",\n generatingLogin: \"מייצר קישור התחברות...\",\n noProductsFound: \"לא נמצאו מוצרים\",\n noOrdersFound: \"לא נמצאו הזמנות\",\n inStock: \"במלאי\",\n outOfStock: \"אזל מהמלאי\",\n backorder: \"בהזמנה מראש\",\n sale: \"מבצע\",\n addToCart: \"הוסף לסל\",\n addedToCart: \"נוסף לסל!\",\n addToCartError: \"שגיאה בהוספה לסל\",\n loginToStore: \"התחבר לחנות\",\n enterEmail: \"הזינו אימייל לאימות\",\n sendCode: \"שלח קוד אימות\",\n otpSentTo: \"קוד אימות נשלח ל-{email}\",\n verifyCode: \"אמת\",\n verifiedSuccess: \"אומת בהצלחה!\",\n resendCode: \"שלח שוב\",\n invalidCode: \"קוד שגוי, נסו שוב\",\n selectVariation: \"בחר\",\n orderStatus_completed: \"הושלמה\",\n orderStatus_processing: \"בטיפול\",\n \"orderStatus_on-hold\": \"בהמתנה\",\n orderStatus_pending: \"ממתינה\",\n orderStatus_cancelled: \"בוטלה\",\n orderStatus_failed: \"נכשלה\",\n orderStatus_refunded: \"הוחזרה\",\n cart: \"סל\",\n yourCart: \"הסל שלך\",\n cartItems: \"{count} פריטים\",\n cartEmpty: \"הסל ריק\",\n checkout: \"לתשלום\",\n cartTotal: \"סה״כ\",\n removeItem: \"הסר\",\n liveChatConnecting: \"מחבר אותך לנציג...\",\n liveChatPosition: \"מיקום #{position}\",\n liveChatCancel: \"ביטול\",\n liveChatChattingWith: \"משוחח עם {name}\",\n liveChatEndChat: \"סיום שיחה\",\n liveChatRateTitle: \"איך היה השירות?\",\n liveChatRateThank: \"תודה על המשוב!\",\n liveChatBackToAI: \"חזרה לעוזר AI\",\n liveChatSubmit: \"שלח\",\n liveChatSkip: \"דלג\",\n liveChatFeedbackPlaceholder: \"משוב נוסף (אופציונלי)...\",\n liveChatTalkToHuman: \"דבר עם נציג\",\n liveChatIdentityTitle: \"אנא מלא/י את הפרטים כדי להתחבר לנציג\",\n liveChatIdentityName: \"שם\",\n liveChatIdentityEmail: \"אימייל\",\n liveChatIdentityConnect: \"התחבר\",\n liveChatIdentityContinue: \"המשך\",\n liveChatRateExperience: \"דרגו את החוויה שלכם\",\n liveChatEnded: \"השיחה הסתיימה\",\n};\n\n/** Built-in translation registry. */\nconst builtInTranslations: Record<string, TranslationMap> = { en, he };\n\n/** Registry for dynamically added languages. */\nconst customTranslations: Record<string, TranslationMap> = {};\n\n/**\n * Register a new language at runtime. Merges with any existing translations.\n *\n * @param code - Language code (e.g. \"fr\", \"es\")\n * @param translations - Full or partial translation map\n */\nexport function addLanguage(\n code: string,\n translations: Partial<TranslationMap>\n): void {\n const base = customTranslations[code] || builtInTranslations[code] || en;\n customTranslations[code] = { ...base, ...translations };\n}\n\n/** Resolve a translation string for the given language and key. */\nfunction resolve(\n language: string,\n key: TranslationKeys,\n overrides?: Partial<TranslationMap>,\n params?: Record<string, string>\n): string {\n // Priority: overrides > custom > built-in > fallback to English\n let text =\n overrides?.[key] ||\n customTranslations[language]?.[key] ||\n builtInTranslations[language]?.[key] ||\n builtInTranslations[\"en\"][key] ||\n key;\n\n if (params) {\n Object.entries(params).forEach(([k, v]) => {\n text = text.replace(`{${k}}`, v);\n });\n }\n return text;\n}\n\n/** RTL language codes. */\nconst RTL_LANGUAGES = new Set([\"he\", \"ar\", \"fa\", \"ur\"]);\n\n/** Returns true if the given language code is RTL. */\nexport function isRTL(language: string): boolean {\n return RTL_LANGUAGES.has(language);\n}\n\ninterface I18nContextValue {\n /** Translate a key, with optional interpolation params. */\n t: (key: TranslationKeys, params?: Record<string, string>) => string;\n /** Current language code. */\n language: string;\n /** Change the active language at runtime. */\n setLanguage: (lang: string) => void;\n /** Current text direction. */\n direction: \"ltr\" | \"rtl\";\n}\n\nconst I18nContext = createContext<I18nContextValue | null>(null);\n\n/** Props for the I18nProvider component. */\nexport interface I18nProviderProps {\n /** Active language code. Defaults to \"en\". */\n language?: string;\n /** Per-key translation overrides applied on top of built-in strings. */\n translations?: Partial<TranslationMap>;\n children: ReactNode;\n}\n\n/**\n * Provides i18n context to descendant components.\n * Supports built-in \"en\" and \"he\", dynamic languages via `addLanguage()`,\n * and per-instance overrides via the `translations` prop.\n */\nexport function I18nProvider({\n language: initialLanguage = \"en\",\n translations: overrides,\n children,\n}: I18nProviderProps) {\n const [language, setLanguage] = useState(initialLanguage);\n\n const t = useCallback(\n (key: TranslationKeys, params?: Record<string, string>) =>\n resolve(language, key, overrides, params),\n [language, overrides]\n );\n\n const direction = isRTL(language) ? \"rtl\" : \"ltr\";\n\n const value = useMemo<I18nContextValue>(\n () => ({ t, language, setLanguage, direction }),\n [t, language, direction]\n );\n\n return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>;\n}\n\n/**\n * Returns the i18n context: `t()` translation function, current language, and `setLanguage`.\n * Must be used within an `I18nProvider`.\n */\nexport function useI18n(): I18nContextValue {\n const ctx = useContext(I18nContext);\n if (!ctx) {\n throw new Error(\"useI18n must be used within an I18nProvider\");\n }\n return ctx;\n}\n"]}
|