@miiflow/assistant-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +563 -0
- package/dist/WelcomeScreen-CsFaFNcu.d.mts +246 -0
- package/dist/WelcomeScreen-TrcbOYob.d.ts +246 -0
- package/dist/avatar-D5eHcfjf.d.mts +109 -0
- package/dist/avatar-DftdWqSs.d.ts +109 -0
- package/dist/branding-SzYU4ncD.d.mts +18 -0
- package/dist/branding-SzYU4ncD.d.ts +18 -0
- package/dist/chunk-3E2HG62U.mjs +2 -0
- package/dist/chunk-3E2HG62U.mjs.map +1 -0
- package/dist/chunk-3ERHTQXR.js +2 -0
- package/dist/chunk-3ERHTQXR.js.map +1 -0
- package/dist/chunk-3GQNGDXX.mjs +22 -0
- package/dist/chunk-3GQNGDXX.mjs.map +1 -0
- package/dist/chunk-3KB4JYSQ.js +2 -0
- package/dist/chunk-3KB4JYSQ.js.map +1 -0
- package/dist/chunk-BA3VCHRC.js +22 -0
- package/dist/chunk-BA3VCHRC.js.map +1 -0
- package/dist/chunk-CRNBTU42.mjs +2 -0
- package/dist/chunk-CRNBTU42.mjs.map +1 -0
- package/dist/chunk-KPGHBLGY.mjs +2 -0
- package/dist/chunk-KPGHBLGY.mjs.map +1 -0
- package/dist/chunk-LJQHWCUK.js +2 -0
- package/dist/chunk-LJQHWCUK.js.map +1 -0
- package/dist/chunk-MFCWFFJV.mjs +2 -0
- package/dist/chunk-MFCWFFJV.mjs.map +1 -0
- package/dist/chunk-NSTK5EUQ.js +2 -0
- package/dist/chunk-NSTK5EUQ.js.map +1 -0
- package/dist/chunk-OCKHJ4WO.js +2 -0
- package/dist/chunk-OCKHJ4WO.js.map +1 -0
- package/dist/chunk-RTT6LULU.mjs +2 -0
- package/dist/chunk-RTT6LULU.mjs.map +1 -0
- package/dist/client/index.d.mts +249 -0
- package/dist/client/index.d.ts +249 -0
- package/dist/client/index.js +9 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/index.mjs +9 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/context/index.d.mts +43 -0
- package/dist/context/index.d.ts +43 -0
- package/dist/context/index.js +2 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/index.mjs +2 -0
- package/dist/context/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +109 -0
- package/dist/hooks/index.d.ts +109 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +157 -0
- package/dist/index.d.ts +157 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/message-B21_kqE2.d.ts +78 -0
- package/dist/message-ufYsvKXP.d.mts +78 -0
- package/dist/primitives/index.d.mts +86 -0
- package/dist/primitives/index.d.ts +86 -0
- package/dist/primitives/index.js +2 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/index.mjs +2 -0
- package/dist/primitives/index.mjs.map +1 -0
- package/dist/streaming-CF63E6iS.d.mts +426 -0
- package/dist/streaming-CF63E6iS.d.ts +426 -0
- package/dist/styled/index.d.mts +477 -0
- package/dist/styled/index.d.ts +477 -0
- package/dist/styled/index.js +2 -0
- package/dist/styled/index.js.map +1 -0
- package/dist/styled/index.mjs +2 -0
- package/dist/styled/index.mjs.map +1 -0
- package/dist/styles-no-preflight.css +1 -0
- package/dist/styles.css +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunk3ERHTQXR_js=require('../chunk-3ERHTQXR.js'),chunkLJQHWCUK_js=require('../chunk-LJQHWCUK.js'),chunkNSTK5EUQ_js=require('../chunk-NSTK5EUQ.js');Object.defineProperty(exports,"useAttachments",{enumerable:true,get:function(){return chunk3ERHTQXR_js.b}});Object.defineProperty(exports,"useStreaming",{enumerable:true,get:function(){return chunk3ERHTQXR_js.a}});Object.defineProperty(exports,"useAutoScroll",{enumerable:true,get:function(){return chunkLJQHWCUK_js.a}});Object.defineProperty(exports,"useMessageComposer",{enumerable:true,get:function(){return chunkLJQHWCUK_js.b}});Object.defineProperty(exports,"useBrandingCSSVars",{enumerable:true,get:function(){return chunkNSTK5EUQ_js.b}});//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{b as useAttachments,a as useStreaming}from'../chunk-3E2HG62U.mjs';export{a as useAutoScroll,b as useMessageComposer}from'../chunk-KPGHBLGY.mjs';export{b as useBrandingCSSVars}from'../chunk-CRNBTU42.mjs';//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export { A as Attachment, C as ChatMessage, M as MessageData, a as Participant, P as ParticipantRole, R as ReasoningChunk, S as SourceReference, b as SourceTypeConfig, c as SuggestedAction, d as SuggestedActionType } from './message-ufYsvKXP.mjs';
|
|
2
|
+
export { a as StreamChunk, b as StreamingOptions, c as StreamingState } from './streaming-CF63E6iS.mjs';
|
|
3
|
+
export { B as BrandingData } from './branding-SzYU4ncD.mjs';
|
|
4
|
+
export { ChatContext, ChatContextValue, ChatProvider, ChatProviderProps, useChatContext } from './context/index.mjs';
|
|
5
|
+
export { useAttachments, useAutoScroll, useBrandingCSSVars, useMessageComposer, useStreaming } from './hooks/index.mjs';
|
|
6
|
+
export { A as AvatarPrimitive, C as ComposerContext, a as ComposerInput, b as ComposerSubmit, M as MessageComposerPrimitive, c as MessageContentPrimitive, d as MessageContext, e as MessagePrimitive, f as MessageTimestampPrimitive, u as useComposer, g as useMessage } from './avatar-D5eHcfjf.mjs';
|
|
7
|
+
export { ActionButton, MessageList as MessageListPrimitive, StreamingText as StreamingTextPrimitive, SuggestedActionsContext, SuggestedActions as SuggestedActionsPrimitive, TypingIndicator as TypingIndicatorPrimitive, useSuggestedActions } from './primitives/index.mjs';
|
|
8
|
+
export { A as AttachmentPreview, a as Avatar, C as ChatContainer, b as ChatLayout, M as MarkdownContent, c as Message, d as MessageComposer, e as MessageList, S as StreamingText, f as SuggestedActions, T as TypingIndicator, W as WelcomeScreen } from './WelcomeScreen-CsFaFNcu.mjs';
|
|
9
|
+
import { ClassValue } from 'clsx';
|
|
10
|
+
import 'react/jsx-runtime';
|
|
11
|
+
import 'react';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Utility function to merge Tailwind CSS classes with proper precedence.
|
|
15
|
+
* Combines clsx for conditional classes with tailwind-merge for conflict resolution.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* cn("px-4 py-2", "px-6") // => "py-2 px-6"
|
|
19
|
+
* cn("text-red-500", isActive && "text-blue-500") // => "text-blue-500" when isActive
|
|
20
|
+
*/
|
|
21
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Format a date for display in chat messages.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Format a timestamp for display.
|
|
28
|
+
* - Today: "2:30 PM"
|
|
29
|
+
* - This year: "Dec 15, 2:30 PM"
|
|
30
|
+
* - Other years: "Dec 15, 2024, 2:30 PM"
|
|
31
|
+
*/
|
|
32
|
+
declare function formatMessageTime(date: Date | string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Format a relative time (e.g., "2 minutes ago").
|
|
35
|
+
*/
|
|
36
|
+
declare function formatRelativeTime(date: Date | string): string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Given a background color string, return the best contrast text color.
|
|
40
|
+
* Returns "#ffffff" for dark backgrounds and "#1D2033" for light backgrounds.
|
|
41
|
+
* Falls back to "#ffffff" if the color cannot be parsed.
|
|
42
|
+
*/
|
|
43
|
+
declare function getContrastTextColor(bgColor: string): string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Design tokens for the chat UI.
|
|
47
|
+
* These map to CSS custom properties for easy theming.
|
|
48
|
+
*/
|
|
49
|
+
declare const chatTokens: {
|
|
50
|
+
readonly spacing: {
|
|
51
|
+
/** Vertical spacing between messages (16px) */
|
|
52
|
+
readonly messageBetween: "1rem";
|
|
53
|
+
/** Message bubble horizontal padding (14px) */
|
|
54
|
+
readonly messagePx: "0.875rem";
|
|
55
|
+
/** Message bubble vertical padding (10px) */
|
|
56
|
+
readonly messagePy: "0.625rem";
|
|
57
|
+
/** Container padding (16px) */
|
|
58
|
+
readonly container: "1rem";
|
|
59
|
+
/** Composer padding (16px) */
|
|
60
|
+
readonly composerPadding: "1rem";
|
|
61
|
+
};
|
|
62
|
+
readonly typography: {
|
|
63
|
+
readonly message: {
|
|
64
|
+
readonly fontSize: "1rem";
|
|
65
|
+
readonly lineHeight: 1.5;
|
|
66
|
+
readonly letterSpacing: "0px";
|
|
67
|
+
};
|
|
68
|
+
readonly caption: {
|
|
69
|
+
readonly fontSize: "0.875rem";
|
|
70
|
+
readonly lineHeight: 1.4;
|
|
71
|
+
};
|
|
72
|
+
readonly small: {
|
|
73
|
+
readonly fontSize: "0.8125rem";
|
|
74
|
+
readonly lineHeight: 1.3;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly borderRadius: {
|
|
78
|
+
readonly message: "0.5rem";
|
|
79
|
+
readonly input: "1rem";
|
|
80
|
+
readonly panel: "0.5rem";
|
|
81
|
+
readonly button: "0.5rem";
|
|
82
|
+
readonly chip: "0.25rem";
|
|
83
|
+
};
|
|
84
|
+
readonly colors: {
|
|
85
|
+
readonly primary: "var(--chat-primary, #106997)";
|
|
86
|
+
readonly secondary: "var(--chat-secondary, #56C18A)";
|
|
87
|
+
readonly error: "var(--chat-error, #B1001B)";
|
|
88
|
+
readonly warning: "var(--chat-warning, #DD9652)";
|
|
89
|
+
readonly messageBg: "var(--chat-message-bg, rgba(0, 0, 0, 0.03))";
|
|
90
|
+
readonly userMessageBg: "var(--chat-user-message-bg, var(--chat-primary, #106997))";
|
|
91
|
+
readonly userMessageText: "var(--chat-user-message-text, #ffffff)";
|
|
92
|
+
readonly panelBg: "var(--chat-panel-bg, rgba(0, 0, 0, 0.02))";
|
|
93
|
+
readonly panelBorder: "var(--chat-panel-border, rgba(0, 0, 0, 0.06))";
|
|
94
|
+
readonly border: "var(--chat-border, rgba(0, 0, 0, 0.06))";
|
|
95
|
+
readonly borderHover: "var(--chat-border-hover, rgba(0, 0, 0, 0.12))";
|
|
96
|
+
readonly text: "var(--chat-text, #1D2033)";
|
|
97
|
+
readonly subtle: "var(--chat-text-subtle, rgba(0, 0, 0, 0.5))";
|
|
98
|
+
readonly placeholder: "var(--chat-placeholder, rgba(0, 0, 0, 0.4))";
|
|
99
|
+
readonly status: {
|
|
100
|
+
readonly pending: {
|
|
101
|
+
readonly main: "rgba(0, 0, 0, 0.3)";
|
|
102
|
+
readonly bg: "rgba(0, 0, 0, 0.05)";
|
|
103
|
+
};
|
|
104
|
+
readonly running: {
|
|
105
|
+
readonly main: "rgb(99, 102, 241)";
|
|
106
|
+
readonly bg: "rgba(99, 102, 241, 0.08)";
|
|
107
|
+
};
|
|
108
|
+
readonly completed: {
|
|
109
|
+
readonly main: "rgb(16, 185, 129)";
|
|
110
|
+
readonly bg: "rgba(16, 185, 129, 0.08)";
|
|
111
|
+
};
|
|
112
|
+
readonly failed: {
|
|
113
|
+
readonly main: "rgb(239, 68, 68)";
|
|
114
|
+
readonly bg: "rgba(239, 68, 68, 0.08)";
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly shadows: {
|
|
119
|
+
readonly subtle: "0 1px 2px rgba(0, 0, 0, 0.04)";
|
|
120
|
+
readonly input: "0 2px 8px rgba(0, 0, 0, 0.08)";
|
|
121
|
+
readonly inputFocus: "0 4px 16px rgba(0, 0, 0, 0.12)";
|
|
122
|
+
readonly button: "0 1px 3px rgba(0, 0, 0, 0.08)";
|
|
123
|
+
readonly buttonHover: "0 2px 6px rgba(0, 0, 0, 0.12)";
|
|
124
|
+
readonly primary: "0 2px 6px rgba(16, 105, 151, 0.3)";
|
|
125
|
+
readonly primaryHover: "0 4px 12px rgba(16, 105, 151, 0.4)";
|
|
126
|
+
};
|
|
127
|
+
readonly animations: {
|
|
128
|
+
readonly messageEntrance: {
|
|
129
|
+
readonly initial: {
|
|
130
|
+
readonly opacity: 0;
|
|
131
|
+
readonly y: 8;
|
|
132
|
+
};
|
|
133
|
+
readonly animate: {
|
|
134
|
+
readonly opacity: 1;
|
|
135
|
+
readonly y: 0;
|
|
136
|
+
};
|
|
137
|
+
readonly transition: {
|
|
138
|
+
readonly duration: 0.3;
|
|
139
|
+
readonly ease: readonly [0.4, 0, 0.2, 1];
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
readonly fadeIn: {
|
|
143
|
+
readonly initial: {
|
|
144
|
+
readonly opacity: 0;
|
|
145
|
+
};
|
|
146
|
+
readonly animate: {
|
|
147
|
+
readonly opacity: 1;
|
|
148
|
+
};
|
|
149
|
+
readonly transition: {
|
|
150
|
+
readonly duration: 0.2;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
type ChatTokens = typeof chatTokens;
|
|
156
|
+
|
|
157
|
+
export { type ChatTokens, chatTokens, cn, formatMessageTime, formatRelativeTime, getContrastTextColor };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export { A as Attachment, C as ChatMessage, M as MessageData, a as Participant, P as ParticipantRole, R as ReasoningChunk, S as SourceReference, b as SourceTypeConfig, c as SuggestedAction, d as SuggestedActionType } from './message-B21_kqE2.js';
|
|
2
|
+
export { a as StreamChunk, b as StreamingOptions, c as StreamingState } from './streaming-CF63E6iS.js';
|
|
3
|
+
export { B as BrandingData } from './branding-SzYU4ncD.js';
|
|
4
|
+
export { ChatContext, ChatContextValue, ChatProvider, ChatProviderProps, useChatContext } from './context/index.js';
|
|
5
|
+
export { useAttachments, useAutoScroll, useBrandingCSSVars, useMessageComposer, useStreaming } from './hooks/index.js';
|
|
6
|
+
export { A as AvatarPrimitive, C as ComposerContext, a as ComposerInput, b as ComposerSubmit, M as MessageComposerPrimitive, c as MessageContentPrimitive, d as MessageContext, e as MessagePrimitive, f as MessageTimestampPrimitive, u as useComposer, g as useMessage } from './avatar-DftdWqSs.js';
|
|
7
|
+
export { ActionButton, MessageList as MessageListPrimitive, StreamingText as StreamingTextPrimitive, SuggestedActionsContext, SuggestedActions as SuggestedActionsPrimitive, TypingIndicator as TypingIndicatorPrimitive, useSuggestedActions } from './primitives/index.js';
|
|
8
|
+
export { A as AttachmentPreview, a as Avatar, C as ChatContainer, b as ChatLayout, M as MarkdownContent, c as Message, d as MessageComposer, e as MessageList, S as StreamingText, f as SuggestedActions, T as TypingIndicator, W as WelcomeScreen } from './WelcomeScreen-TrcbOYob.js';
|
|
9
|
+
import { ClassValue } from 'clsx';
|
|
10
|
+
import 'react/jsx-runtime';
|
|
11
|
+
import 'react';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Utility function to merge Tailwind CSS classes with proper precedence.
|
|
15
|
+
* Combines clsx for conditional classes with tailwind-merge for conflict resolution.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* cn("px-4 py-2", "px-6") // => "py-2 px-6"
|
|
19
|
+
* cn("text-red-500", isActive && "text-blue-500") // => "text-blue-500" when isActive
|
|
20
|
+
*/
|
|
21
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Format a date for display in chat messages.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Format a timestamp for display.
|
|
28
|
+
* - Today: "2:30 PM"
|
|
29
|
+
* - This year: "Dec 15, 2:30 PM"
|
|
30
|
+
* - Other years: "Dec 15, 2024, 2:30 PM"
|
|
31
|
+
*/
|
|
32
|
+
declare function formatMessageTime(date: Date | string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Format a relative time (e.g., "2 minutes ago").
|
|
35
|
+
*/
|
|
36
|
+
declare function formatRelativeTime(date: Date | string): string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Given a background color string, return the best contrast text color.
|
|
40
|
+
* Returns "#ffffff" for dark backgrounds and "#1D2033" for light backgrounds.
|
|
41
|
+
* Falls back to "#ffffff" if the color cannot be parsed.
|
|
42
|
+
*/
|
|
43
|
+
declare function getContrastTextColor(bgColor: string): string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Design tokens for the chat UI.
|
|
47
|
+
* These map to CSS custom properties for easy theming.
|
|
48
|
+
*/
|
|
49
|
+
declare const chatTokens: {
|
|
50
|
+
readonly spacing: {
|
|
51
|
+
/** Vertical spacing between messages (16px) */
|
|
52
|
+
readonly messageBetween: "1rem";
|
|
53
|
+
/** Message bubble horizontal padding (14px) */
|
|
54
|
+
readonly messagePx: "0.875rem";
|
|
55
|
+
/** Message bubble vertical padding (10px) */
|
|
56
|
+
readonly messagePy: "0.625rem";
|
|
57
|
+
/** Container padding (16px) */
|
|
58
|
+
readonly container: "1rem";
|
|
59
|
+
/** Composer padding (16px) */
|
|
60
|
+
readonly composerPadding: "1rem";
|
|
61
|
+
};
|
|
62
|
+
readonly typography: {
|
|
63
|
+
readonly message: {
|
|
64
|
+
readonly fontSize: "1rem";
|
|
65
|
+
readonly lineHeight: 1.5;
|
|
66
|
+
readonly letterSpacing: "0px";
|
|
67
|
+
};
|
|
68
|
+
readonly caption: {
|
|
69
|
+
readonly fontSize: "0.875rem";
|
|
70
|
+
readonly lineHeight: 1.4;
|
|
71
|
+
};
|
|
72
|
+
readonly small: {
|
|
73
|
+
readonly fontSize: "0.8125rem";
|
|
74
|
+
readonly lineHeight: 1.3;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
readonly borderRadius: {
|
|
78
|
+
readonly message: "0.5rem";
|
|
79
|
+
readonly input: "1rem";
|
|
80
|
+
readonly panel: "0.5rem";
|
|
81
|
+
readonly button: "0.5rem";
|
|
82
|
+
readonly chip: "0.25rem";
|
|
83
|
+
};
|
|
84
|
+
readonly colors: {
|
|
85
|
+
readonly primary: "var(--chat-primary, #106997)";
|
|
86
|
+
readonly secondary: "var(--chat-secondary, #56C18A)";
|
|
87
|
+
readonly error: "var(--chat-error, #B1001B)";
|
|
88
|
+
readonly warning: "var(--chat-warning, #DD9652)";
|
|
89
|
+
readonly messageBg: "var(--chat-message-bg, rgba(0, 0, 0, 0.03))";
|
|
90
|
+
readonly userMessageBg: "var(--chat-user-message-bg, var(--chat-primary, #106997))";
|
|
91
|
+
readonly userMessageText: "var(--chat-user-message-text, #ffffff)";
|
|
92
|
+
readonly panelBg: "var(--chat-panel-bg, rgba(0, 0, 0, 0.02))";
|
|
93
|
+
readonly panelBorder: "var(--chat-panel-border, rgba(0, 0, 0, 0.06))";
|
|
94
|
+
readonly border: "var(--chat-border, rgba(0, 0, 0, 0.06))";
|
|
95
|
+
readonly borderHover: "var(--chat-border-hover, rgba(0, 0, 0, 0.12))";
|
|
96
|
+
readonly text: "var(--chat-text, #1D2033)";
|
|
97
|
+
readonly subtle: "var(--chat-text-subtle, rgba(0, 0, 0, 0.5))";
|
|
98
|
+
readonly placeholder: "var(--chat-placeholder, rgba(0, 0, 0, 0.4))";
|
|
99
|
+
readonly status: {
|
|
100
|
+
readonly pending: {
|
|
101
|
+
readonly main: "rgba(0, 0, 0, 0.3)";
|
|
102
|
+
readonly bg: "rgba(0, 0, 0, 0.05)";
|
|
103
|
+
};
|
|
104
|
+
readonly running: {
|
|
105
|
+
readonly main: "rgb(99, 102, 241)";
|
|
106
|
+
readonly bg: "rgba(99, 102, 241, 0.08)";
|
|
107
|
+
};
|
|
108
|
+
readonly completed: {
|
|
109
|
+
readonly main: "rgb(16, 185, 129)";
|
|
110
|
+
readonly bg: "rgba(16, 185, 129, 0.08)";
|
|
111
|
+
};
|
|
112
|
+
readonly failed: {
|
|
113
|
+
readonly main: "rgb(239, 68, 68)";
|
|
114
|
+
readonly bg: "rgba(239, 68, 68, 0.08)";
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly shadows: {
|
|
119
|
+
readonly subtle: "0 1px 2px rgba(0, 0, 0, 0.04)";
|
|
120
|
+
readonly input: "0 2px 8px rgba(0, 0, 0, 0.08)";
|
|
121
|
+
readonly inputFocus: "0 4px 16px rgba(0, 0, 0, 0.12)";
|
|
122
|
+
readonly button: "0 1px 3px rgba(0, 0, 0, 0.08)";
|
|
123
|
+
readonly buttonHover: "0 2px 6px rgba(0, 0, 0, 0.12)";
|
|
124
|
+
readonly primary: "0 2px 6px rgba(16, 105, 151, 0.3)";
|
|
125
|
+
readonly primaryHover: "0 4px 12px rgba(16, 105, 151, 0.4)";
|
|
126
|
+
};
|
|
127
|
+
readonly animations: {
|
|
128
|
+
readonly messageEntrance: {
|
|
129
|
+
readonly initial: {
|
|
130
|
+
readonly opacity: 0;
|
|
131
|
+
readonly y: 8;
|
|
132
|
+
};
|
|
133
|
+
readonly animate: {
|
|
134
|
+
readonly opacity: 1;
|
|
135
|
+
readonly y: 0;
|
|
136
|
+
};
|
|
137
|
+
readonly transition: {
|
|
138
|
+
readonly duration: 0.3;
|
|
139
|
+
readonly ease: readonly [0.4, 0, 0.2, 1];
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
readonly fadeIn: {
|
|
143
|
+
readonly initial: {
|
|
144
|
+
readonly opacity: 0;
|
|
145
|
+
};
|
|
146
|
+
readonly animate: {
|
|
147
|
+
readonly opacity: 1;
|
|
148
|
+
};
|
|
149
|
+
readonly transition: {
|
|
150
|
+
readonly duration: 0.2;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
type ChatTokens = typeof chatTokens;
|
|
156
|
+
|
|
157
|
+
export { type ChatTokens, chatTokens, cn, formatMessageTime, formatRelativeTime, getContrastTextColor };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkBA3VCHRC_js=require('./chunk-BA3VCHRC.js'),chunk3KB4JYSQ_js=require('./chunk-3KB4JYSQ.js'),chunk3ERHTQXR_js=require('./chunk-3ERHTQXR.js'),chunkLJQHWCUK_js=require('./chunk-LJQHWCUK.js'),chunkOCKHJ4WO_js=require('./chunk-OCKHJ4WO.js'),chunkNSTK5EUQ_js=require('./chunk-NSTK5EUQ.js');var i={hour:"numeric",minute:"2-digit",hour12:true},m={month:"short",day:"numeric"},Q={...m,year:"numeric",...i};function p(t){let e=typeof t=="string"?new Date(t):t,a=new Date;return e.getDate()===a.getDate()&&e.getMonth()===a.getMonth()&&e.getFullYear()===a.getFullYear()?e.toLocaleTimeString("en-US",i):e.getFullYear()===a.getFullYear()?`${e.toLocaleDateString("en-US",m)}, ${e.toLocaleTimeString("en-US",i)}`:e.toLocaleDateString("en-US",Q)}function X(t){let e=typeof t=="string"?new Date(t):t,g=new Date().getTime()-e.getTime(),s=Math.floor(g/1e3),r=Math.floor(s/60),o=Math.floor(r/60),n=Math.floor(o/24);return s<60?"just now":r<60?`${r} minute${r===1?"":"s"} ago`:o<24?`${o} hour${o===1?"":"s"} ago`:n<7?`${n} day${n===1?"":"s"} ago`:p(e)}var Z={spacing:{messageBetween:"1rem",messagePx:"0.875rem",messagePy:"0.625rem",container:"1rem",composerPadding:"1rem"},typography:{message:{fontSize:"1rem",lineHeight:1.5,letterSpacing:"0px"},caption:{fontSize:"0.875rem",lineHeight:1.4},small:{fontSize:"0.8125rem",lineHeight:1.3}},borderRadius:{message:"0.5rem",input:"1rem",panel:"0.5rem",button:"0.5rem",chip:"0.25rem"},colors:{primary:"var(--chat-primary, #106997)",secondary:"var(--chat-secondary, #56C18A)",error:"var(--chat-error, #B1001B)",warning:"var(--chat-warning, #DD9652)",messageBg:"var(--chat-message-bg, rgba(0, 0, 0, 0.03))",userMessageBg:"var(--chat-user-message-bg, var(--chat-primary, #106997))",userMessageText:"var(--chat-user-message-text, #ffffff)",panelBg:"var(--chat-panel-bg, rgba(0, 0, 0, 0.02))",panelBorder:"var(--chat-panel-border, rgba(0, 0, 0, 0.06))",border:"var(--chat-border, rgba(0, 0, 0, 0.06))",borderHover:"var(--chat-border-hover, rgba(0, 0, 0, 0.12))",text:"var(--chat-text, #1D2033)",subtle:"var(--chat-text-subtle, rgba(0, 0, 0, 0.5))",placeholder:"var(--chat-placeholder, rgba(0, 0, 0, 0.4))",status:{pending:{main:"rgba(0, 0, 0, 0.3)",bg:"rgba(0, 0, 0, 0.05)"},running:{main:"rgb(99, 102, 241)",bg:"rgba(99, 102, 241, 0.08)"},completed:{main:"rgb(16, 185, 129)",bg:"rgba(16, 185, 129, 0.08)"},failed:{main:"rgb(239, 68, 68)",bg:"rgba(239, 68, 68, 0.08)"}}},shadows:{subtle:"0 1px 2px rgba(0, 0, 0, 0.04)",input:"0 2px 8px rgba(0, 0, 0, 0.08)",inputFocus:"0 4px 16px rgba(0, 0, 0, 0.12)",button:"0 1px 3px rgba(0, 0, 0, 0.08)",buttonHover:"0 2px 6px rgba(0, 0, 0, 0.12)",primary:"0 2px 6px rgba(16, 105, 151, 0.3)",primaryHover:"0 4px 12px rgba(16, 105, 151, 0.4)"},animations:{messageEntrance:{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3,ease:[.4,0,.2,1]}},fadeIn:{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2}}}};Object.defineProperty(exports,"AttachmentPreview",{enumerable:true,get:function(){return chunkBA3VCHRC_js.b}});Object.defineProperty(exports,"Avatar",{enumerable:true,get:function(){return chunkBA3VCHRC_js.c}});Object.defineProperty(exports,"ChatContainer",{enumerable:true,get:function(){return chunkBA3VCHRC_js.d}});Object.defineProperty(exports,"ChatLayout",{enumerable:true,get:function(){return chunkBA3VCHRC_js.Y}});Object.defineProperty(exports,"MarkdownContent",{enumerable:true,get:function(){return chunkBA3VCHRC_js.f}});Object.defineProperty(exports,"Message",{enumerable:true,get:function(){return chunkBA3VCHRC_js.S}});Object.defineProperty(exports,"MessageComposer",{enumerable:true,get:function(){return chunkBA3VCHRC_js.T}});Object.defineProperty(exports,"MessageList",{enumerable:true,get:function(){return chunkBA3VCHRC_js.U}});Object.defineProperty(exports,"StreamingText",{enumerable:true,get:function(){return chunkBA3VCHRC_js.A}});Object.defineProperty(exports,"SuggestedActions",{enumerable:true,get:function(){return chunkBA3VCHRC_js.B}});Object.defineProperty(exports,"TypingIndicator",{enumerable:true,get:function(){return chunkBA3VCHRC_js.W}});Object.defineProperty(exports,"WelcomeScreen",{enumerable:true,get:function(){return chunkBA3VCHRC_js.Z}});Object.defineProperty(exports,"cn",{enumerable:true,get:function(){return chunkBA3VCHRC_js.a}});Object.defineProperty(exports,"ActionButton",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.q}});Object.defineProperty(exports,"AvatarPrimitive",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.l}});Object.defineProperty(exports,"ComposerContext",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.g}});Object.defineProperty(exports,"ComposerInput",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.j}});Object.defineProperty(exports,"ComposerSubmit",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.k}});Object.defineProperty(exports,"MessageComposerPrimitive",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.i}});Object.defineProperty(exports,"MessageContentPrimitive",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.d}});Object.defineProperty(exports,"MessageContext",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.a}});Object.defineProperty(exports,"MessageListPrimitive",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.f}});Object.defineProperty(exports,"MessagePrimitive",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.c}});Object.defineProperty(exports,"MessageTimestampPrimitive",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.e}});Object.defineProperty(exports,"StreamingTextPrimitive",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.m}});Object.defineProperty(exports,"SuggestedActionsContext",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.n}});Object.defineProperty(exports,"SuggestedActionsPrimitive",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.p}});Object.defineProperty(exports,"TypingIndicatorPrimitive",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.r}});Object.defineProperty(exports,"useComposer",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.h}});Object.defineProperty(exports,"useMessage",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.b}});Object.defineProperty(exports,"useSuggestedActions",{enumerable:true,get:function(){return chunk3KB4JYSQ_js.o}});Object.defineProperty(exports,"useAttachments",{enumerable:true,get:function(){return chunk3ERHTQXR_js.b}});Object.defineProperty(exports,"useStreaming",{enumerable:true,get:function(){return chunk3ERHTQXR_js.a}});Object.defineProperty(exports,"useAutoScroll",{enumerable:true,get:function(){return chunkLJQHWCUK_js.a}});Object.defineProperty(exports,"useMessageComposer",{enumerable:true,get:function(){return chunkLJQHWCUK_js.b}});Object.defineProperty(exports,"ChatContext",{enumerable:true,get:function(){return chunkOCKHJ4WO_js.a}});Object.defineProperty(exports,"ChatProvider",{enumerable:true,get:function(){return chunkOCKHJ4WO_js.b}});Object.defineProperty(exports,"useChatContext",{enumerable:true,get:function(){return chunkOCKHJ4WO_js.c}});Object.defineProperty(exports,"getContrastTextColor",{enumerable:true,get:function(){return chunkNSTK5EUQ_js.a}});Object.defineProperty(exports,"useBrandingCSSVars",{enumerable:true,get:function(){return chunkNSTK5EUQ_js.b}});exports.chatTokens=Z;exports.formatMessageTime=p;exports.formatRelativeTime=X;//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/format-date.ts","../src/styles/tokens.ts"],"names":["TIME_FORMAT","DATE_FORMAT","FULL_FORMAT","formatMessageTime","date","d","now","formatRelativeTime","diffMs","diffSeconds","diffMinutes","diffHours","diffDays","chatTokens"],"mappings":"iTAIA,IAAMA,EAA0C,CAC9C,IAAA,CAAM,UACN,MAAA,CAAQ,SAAA,CACR,OAAQ,IACV,CAAA,CAEMC,CAAAA,CAA0C,CAC9C,MAAO,OAAA,CACP,GAAA,CAAK,SACP,CAAA,CAEMC,CAAAA,CAA0C,CAC9C,GAAGD,CAAAA,CACH,IAAA,CAAM,SAAA,CACN,GAAGD,CACL,CAAA,CAQO,SAASG,CAAAA,CAAkBC,CAAAA,CAA6B,CAC7D,IAAMC,CAAAA,CAAI,OAAOD,CAAAA,EAAS,QAAA,CAAW,IAAI,IAAA,CAAKA,CAAI,EAAIA,CAAAA,CAChDE,CAAAA,CAAM,IAAI,IAAA,CAOhB,OAJED,CAAAA,CAAE,OAAA,KAAcC,CAAAA,CAAI,OAAA,IACpBD,CAAAA,CAAE,QAAA,KAAeC,CAAAA,CAAI,QAAA,EAAS,EAC9BD,CAAAA,CAAE,aAAY,GAAMC,CAAAA,CAAI,aAAY,CAG7BD,CAAAA,CAAE,mBAAmB,OAAA,CAASL,CAAW,CAAA,CAG/BK,CAAAA,CAAE,aAAY,GAAMC,CAAAA,CAAI,aAAY,CAG9C,CAAA,EAAGD,EAAE,kBAAA,CAAmB,OAAA,CAASJ,CAAW,CAAC,CAAA,EAAA,EAAKI,EAAE,kBAAA,CAAmB,OAAA,CAASL,CAAW,CAAC,CAAA,CAAA,CAG9FK,EAAE,kBAAA,CAAmB,OAAA,CAASH,CAAW,CAClD,CAKO,SAASK,CAAAA,CAAmBH,EAA6B,CAC9D,IAAMC,EAAI,OAAOD,CAAAA,EAAS,QAAA,CAAW,I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.js","sourcesContent":["/**\n * Format a date for display in chat messages.\n */\n\nconst TIME_FORMAT: Intl.DateTimeFormatOptions = {\n hour: \"numeric\",\n minute: \"2-digit\",\n hour12: true,\n};\n\nconst DATE_FORMAT: Intl.DateTimeFormatOptions = {\n month: \"short\",\n day: \"numeric\",\n};\n\nconst FULL_FORMAT: Intl.DateTimeFormatOptions = {\n ...DATE_FORMAT,\n year: \"numeric\",\n ...TIME_FORMAT,\n};\n\n/**\n * Format a timestamp for display.\n * - Today: \"2:30 PM\"\n * - This year: \"Dec 15, 2:30 PM\"\n * - Other years: \"Dec 15, 2024, 2:30 PM\"\n */\nexport function formatMessageTime(date: Date | string): string {\n const d = typeof date === \"string\" ? new Date(date) : date;\n const now = new Date();\n\n const isToday =\n d.getDate() === now.getDate() &&\n d.getMonth() === now.getMonth() &&\n d.getFullYear() === now.getFullYear();\n\n if (isToday) {\n return d.toLocaleTimeString(\"en-US\", TIME_FORMAT);\n }\n\n const isThisYear = d.getFullYear() === now.getFullYear();\n\n if (isThisYear) {\n return `${d.toLocaleDateString(\"en-US\", DATE_FORMAT)}, ${d.toLocaleTimeString(\"en-US\", TIME_FORMAT)}`;\n }\n\n return d.toLocaleDateString(\"en-US\", FULL_FORMAT);\n}\n\n/**\n * Format a relative time (e.g., \"2 minutes ago\").\n */\nexport function formatRelativeTime(date: Date | string): string {\n const d = typeof date === \"string\" ? new Date(date) : date;\n const now = new Date();\n const diffMs = now.getTime() - d.getTime();\n const diffSeconds = Math.floor(diffMs / 1000);\n const diffMinutes = Math.floor(diffSeconds / 60);\n const diffHours = Math.floor(diffMinutes / 60);\n const diffDays = Math.floor(diffHours / 24);\n\n if (diffSeconds < 60) {\n return \"just now\";\n }\n\n if (diffMinutes < 60) {\n return `${diffMinutes} minute${diffMinutes === 1 ? \"\" : \"s\"} ago`;\n }\n\n if (diffHours < 24) {\n return `${diffHours} hour${diffHours === 1 ? \"\" : \"s\"} ago`;\n }\n\n if (diffDays < 7) {\n return `${diffDays} day${diffDays === 1 ? \"\" : \"s\"} ago`;\n }\n\n return formatMessageTime(d);\n}\n","/**\n * Design tokens for the chat UI.\n * These map to CSS custom properties for easy theming.\n */\n\nexport const chatTokens = {\n spacing: {\n /** Vertical spacing between messages (16px) */\n messageBetween: \"1rem\",\n /** Message bubble horizontal padding (14px) */\n messagePx: \"0.875rem\",\n /** Message bubble vertical padding (10px) */\n messagePy: \"0.625rem\",\n /** Container padding (16px) */\n container: \"1rem\",\n /** Composer padding (16px) */\n composerPadding: \"1rem\",\n },\n\n typography: {\n message: {\n fontSize: \"1rem\",\n lineHeight: 1.5,\n letterSpacing: \"0px\",\n },\n caption: {\n fontSize: \"0.875rem\",\n lineHeight: 1.4,\n },\n small: {\n fontSize: \"0.8125rem\",\n lineHeight: 1.3,\n },\n },\n\n borderRadius: {\n message: \"0.5rem\",\n input: \"1rem\",\n panel: \"0.5rem\",\n button: \"0.5rem\",\n chip: \"0.25rem\",\n },\n\n colors: {\n // CSS custom property references\n primary: \"var(--chat-primary, #106997)\",\n secondary: \"var(--chat-secondary, #56C18A)\",\n error: \"var(--chat-error, #B1001B)\",\n warning: \"var(--chat-warning, #DD9652)\",\n\n // Message backgrounds\n messageBg: \"var(--chat-message-bg, rgba(0, 0, 0, 0.03))\",\n userMessageBg: \"var(--chat-user-message-bg, var(--chat-primary, #106997))\",\n userMessageText: \"var(--chat-user-message-text, #ffffff)\",\n\n // Panel backgrounds\n panelBg: \"var(--chat-panel-bg, rgba(0, 0, 0, 0.02))\",\n panelBorder: \"var(--chat-panel-border, rgba(0, 0, 0, 0.06))\",\n\n // Borders\n border: \"var(--chat-border, rgba(0, 0, 0, 0.06))\",\n borderHover: \"var(--chat-border-hover, rgba(0, 0, 0, 0.12))\",\n\n // Text\n text: \"var(--chat-text, #1D2033)\",\n subtle: \"var(--chat-text-subtle, rgba(0, 0, 0, 0.5))\",\n placeholder: \"var(--chat-placeholder, rgba(0, 0, 0, 0.4))\",\n\n // Status colors\n status: {\n pending: {\n main: \"rgba(0, 0, 0, 0.3)\",\n bg: \"rgba(0, 0, 0, 0.05)\",\n },\n running: {\n main: \"rgb(99, 102, 241)\",\n bg: \"rgba(99, 102, 241, 0.08)\",\n },\n completed: {\n main: \"rgb(16, 185, 129)\",\n bg: \"rgba(16, 185, 129, 0.08)\",\n },\n failed: {\n main: \"rgb(239, 68, 68)\",\n bg: \"rgba(239, 68, 68, 0.08)\",\n },\n },\n },\n\n shadows: {\n subtle: \"0 1px 2px rgba(0, 0, 0, 0.04)\",\n input: \"0 2px 8px rgba(0, 0, 0, 0.08)\",\n inputFocus: \"0 4px 16px rgba(0, 0, 0, 0.12)\",\n button: \"0 1px 3px rgba(0, 0, 0, 0.08)\",\n buttonHover: \"0 2px 6px rgba(0, 0, 0, 0.12)\",\n primary: \"0 2px 6px rgba(16, 105, 151, 0.3)\",\n primaryHover: \"0 4px 12px rgba(16, 105, 151, 0.4)\",\n },\n\n animations: {\n messageEntrance: {\n initial: { opacity: 0, y: 8 },\n animate: { opacity: 1, y: 0 },\n transition: { duration: 0.3, ease: [0.4, 0, 0.2, 1] },\n },\n fadeIn: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n transition: { duration: 0.2 },\n },\n },\n} as const;\n\nexport type ChatTokens = typeof chatTokens;\n"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{b as AttachmentPreview,c as Avatar,d as ChatContainer,Y as ChatLayout,f as MarkdownContent,S as Message,T as MessageComposer,U as MessageList,A as StreamingText,B as SuggestedActions,W as TypingIndicator,Z as WelcomeScreen,a as cn}from'./chunk-3GQNGDXX.mjs';export{q as ActionButton,l as AvatarPrimitive,g as ComposerContext,j as ComposerInput,k as ComposerSubmit,i as MessageComposerPrimitive,d as MessageContentPrimitive,a as MessageContext,f as MessageListPrimitive,c as MessagePrimitive,e as MessageTimestampPrimitive,m as StreamingTextPrimitive,n as SuggestedActionsContext,p as SuggestedActionsPrimitive,r as TypingIndicatorPrimitive,h as useComposer,b as useMessage,o as useSuggestedActions}from'./chunk-MFCWFFJV.mjs';export{b as useAttachments,a as useStreaming}from'./chunk-3E2HG62U.mjs';export{a as useAutoScroll,b as useMessageComposer}from'./chunk-KPGHBLGY.mjs';export{a as ChatContext,b as ChatProvider,c as useChatContext}from'./chunk-RTT6LULU.mjs';export{a as getContrastTextColor,b as useBrandingCSSVars}from'./chunk-CRNBTU42.mjs';var i={hour:"numeric",minute:"2-digit",hour12:true},m={month:"short",day:"numeric"},Q={...m,year:"numeric",...i};function p(t){let e=typeof t=="string"?new Date(t):t,a=new Date;return e.getDate()===a.getDate()&&e.getMonth()===a.getMonth()&&e.getFullYear()===a.getFullYear()?e.toLocaleTimeString("en-US",i):e.getFullYear()===a.getFullYear()?`${e.toLocaleDateString("en-US",m)}, ${e.toLocaleTimeString("en-US",i)}`:e.toLocaleDateString("en-US",Q)}function X(t){let e=typeof t=="string"?new Date(t):t,g=new Date().getTime()-e.getTime(),s=Math.floor(g/1e3),r=Math.floor(s/60),o=Math.floor(r/60),n=Math.floor(o/24);return s<60?"just now":r<60?`${r} minute${r===1?"":"s"} ago`:o<24?`${o} hour${o===1?"":"s"} ago`:n<7?`${n} day${n===1?"":"s"} ago`:p(e)}var Z={spacing:{messageBetween:"1rem",messagePx:"0.875rem",messagePy:"0.625rem",container:"1rem",composerPadding:"1rem"},typography:{message:{fontSize:"1rem",lineHeight:1.5,letterSpacing:"0px"},caption:{fontSize:"0.875rem",lineHeight:1.4},small:{fontSize:"0.8125rem",lineHeight:1.3}},borderRadius:{message:"0.5rem",input:"1rem",panel:"0.5rem",button:"0.5rem",chip:"0.25rem"},colors:{primary:"var(--chat-primary, #106997)",secondary:"var(--chat-secondary, #56C18A)",error:"var(--chat-error, #B1001B)",warning:"var(--chat-warning, #DD9652)",messageBg:"var(--chat-message-bg, rgba(0, 0, 0, 0.03))",userMessageBg:"var(--chat-user-message-bg, var(--chat-primary, #106997))",userMessageText:"var(--chat-user-message-text, #ffffff)",panelBg:"var(--chat-panel-bg, rgba(0, 0, 0, 0.02))",panelBorder:"var(--chat-panel-border, rgba(0, 0, 0, 0.06))",border:"var(--chat-border, rgba(0, 0, 0, 0.06))",borderHover:"var(--chat-border-hover, rgba(0, 0, 0, 0.12))",text:"var(--chat-text, #1D2033)",subtle:"var(--chat-text-subtle, rgba(0, 0, 0, 0.5))",placeholder:"var(--chat-placeholder, rgba(0, 0, 0, 0.4))",status:{pending:{main:"rgba(0, 0, 0, 0.3)",bg:"rgba(0, 0, 0, 0.05)"},running:{main:"rgb(99, 102, 241)",bg:"rgba(99, 102, 241, 0.08)"},completed:{main:"rgb(16, 185, 129)",bg:"rgba(16, 185, 129, 0.08)"},failed:{main:"rgb(239, 68, 68)",bg:"rgba(239, 68, 68, 0.08)"}}},shadows:{subtle:"0 1px 2px rgba(0, 0, 0, 0.04)",input:"0 2px 8px rgba(0, 0, 0, 0.08)",inputFocus:"0 4px 16px rgba(0, 0, 0, 0.12)",button:"0 1px 3px rgba(0, 0, 0, 0.08)",buttonHover:"0 2px 6px rgba(0, 0, 0, 0.12)",primary:"0 2px 6px rgba(16, 105, 151, 0.3)",primaryHover:"0 4px 12px rgba(16, 105, 151, 0.4)"},animations:{messageEntrance:{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3,ease:[.4,0,.2,1]}},fadeIn:{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2}}}};export{Z as chatTokens,p as formatMessageTime,X as formatRelativeTime};//# sourceMappingURL=index.mjs.map
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/format-date.ts","../src/styles/tokens.ts"],"names":["TIME_FORMAT","DATE_FORMAT","FULL_FORMAT","formatMessageTime","date","d","now","formatRelativeTime","diffMs","diffSeconds","diffMinutes","diffHours","diffDays","chatTokens"],"mappings":"8hCAIA,IAAMA,EAA0C,CAC9C,IAAA,CAAM,UACN,MAAA,CAAQ,SAAA,CAC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A,CACN,MAAA,CAAQ,8CACR,WAAA,CAAa,6CAAA,CAGb,OAAQ,CACN,OAAA,CAAS,CACP,IAAA,CAAM,oBAAA,CACN,GAAI,qBACN,CAAA,CACA,OAAA,CAAS,CACP,KAAM,mBAAA,CACN,EAAA,CAAI,0BACN,CAAA,CACA,SAAA,CAAW,CACT,IAAA,CAAM,mBAAA,CACN,EAAA,CAAI,0BACN,EACA,MAAA,CAAQ,CACN,KAAM,kBAAA,CACN,EAAA,CAAI,yBACN,CACF,CACF,CAAA,CAEA,OAAA,CAAS,CACP,MAAA,CAAQ,+BAAA,CACR,MAAO,+BAAA,CACP,UAAA,CAAY,iCACZ,MAAA,CAAQ,+BAAA,CACR,YAAa,+BAAA,CACb,OAAA,CAAS,oCACT,YAAA,CAAc,oCAChB,EAEA,UAAA,CAAY,CACV,gBAAiB,CACf,OAAA,CAAS,CAAE,OAAA,CAAS,EAAG,CAAA,CAAG,CAAE,EAC5B,OAAA,CAAS,CAAE,QAAS,CAAA,CAAG,CAAA,CAAG,CAAE,CAAA,CAC5B,UAAA,CAAY,CAAE,QAAA,CAAU,EAAA,CAAK,KAAM,CAAC,EAAA,CAAK,EAAG,EAAA,CAAK,CAAC,CAAE,CACtD,EACA,MAAA,CAAQ,CACN,QAAS,CAAE,OAAA,CAAS,CAAE,CAAA,CACtB,OAAA,CAAS,CAAE,OAAA,CAAS,CAAE,EACtB,UAAA,CAAY,CAAE,SAAU,EAAI,CAC9B,CACF,CACF","file":"index.mjs","sourcesContent":["/**\n * Format a date for display in chat messages.\n */\n\nconst TIME_FORMAT: Intl.DateTimeFormatOptions = {\n hour: \"numeric\",\n minute: \"2-digit\",\n hour12: true,\n};\n\nconst DATE_FORMAT: Intl.DateTimeFormatOptions = {\n month: \"short\",\n day: \"numeric\",\n};\n\nconst FULL_FORMAT: Intl.DateTimeFormatOptions = {\n ...DATE_FORMAT,\n year: \"numeric\",\n ...TIME_FORMAT,\n};\n\n/**\n * Format a timestamp for display.\n * - Today: \"2:30 PM\"\n * - This year: \"Dec 15, 2:30 PM\"\n * - Other years: \"Dec 15, 2024, 2:30 PM\"\n */\nexport function formatMessageTime(date: Date | string): string {\n const d = typeof date === \"string\" ? new Date(date) : date;\n const now = new Date();\n\n const isToday =\n d.getDate() === now.getDate() &&\n d.getMonth() === now.getMonth() &&\n d.getFullYear() === now.getFullYear();\n\n if (isToday) {\n return d.toLocaleTimeString(\"en-US\", TIME_FORMAT);\n }\n\n const isThisYear = d.getFullYear() === now.getFullYear();\n\n if (isThisYear) {\n return `${d.toLocaleDateString(\"en-US\", DATE_FORMAT)}, ${d.toLocaleTimeString(\"en-US\", TIME_FORMAT)}`;\n }\n\n return d.toLocaleDateString(\"en-US\", FULL_FORMAT);\n}\n\n/**\n * Format a relative time (e.g., \"2 minutes ago\").\n */\nexport function formatRelativeTime(date: Date | string): string {\n const d = typeof date === \"string\" ? new Date(date) : date;\n const now = new Date();\n const diffMs = now.getTime() - d.getTime();\n const diffSeconds = Math.floor(diffMs / 1000);\n const diffMinutes = Math.floor(diffSeconds / 60);\n const diffHours = Math.floor(diffMinutes / 60);\n const diffDays = Math.floor(diffHours / 24);\n\n if (diffSeconds < 60) {\n return \"just now\";\n }\n\n if (diffMinutes < 60) {\n return `${diffMinutes} minute${diffMinutes === 1 ? \"\" : \"s\"} ago`;\n }\n\n if (diffHours < 24) {\n return `${diffHours} hour${diffHours === 1 ? \"\" : \"s\"} ago`;\n }\n\n if (diffDays < 7) {\n return `${diffDays} day${diffDays === 1 ? \"\" : \"s\"} ago`;\n }\n\n return formatMessageTime(d);\n}\n","/**\n * Design tokens for the chat UI.\n * These map to CSS custom properties for easy theming.\n */\n\nexport const chatTokens = {\n spacing: {\n /** Vertical spacing between messages (16px) */\n messageBetween: \"1rem\",\n /** Message bubble horizontal padding (14px) */\n messagePx: \"0.875rem\",\n /** Message bubble vertical padding (10px) */\n messagePy: \"0.625rem\",\n /** Container padding (16px) */\n container: \"1rem\",\n /** Composer padding (16px) */\n composerPadding: \"1rem\",\n },\n\n typography: {\n message: {\n fontSize: \"1rem\",\n lineHeight: 1.5,\n letterSpacing: \"0px\",\n },\n caption: {\n fontSize: \"0.875rem\",\n lineHeight: 1.4,\n },\n small: {\n fontSize: \"0.8125rem\",\n lineHeight: 1.3,\n },\n },\n\n borderRadius: {\n message: \"0.5rem\",\n input: \"1rem\",\n panel: \"0.5rem\",\n button: \"0.5rem\",\n chip: \"0.25rem\",\n },\n\n colors: {\n // CSS custom property references\n primary: \"var(--chat-primary, #106997)\",\n secondary: \"var(--chat-secondary, #56C18A)\",\n error: \"var(--chat-error, #B1001B)\",\n warning: \"var(--chat-warning, #DD9652)\",\n\n // Message backgrounds\n messageBg: \"var(--chat-message-bg, rgba(0, 0, 0, 0.03))\",\n userMessageBg: \"var(--chat-user-message-bg, var(--chat-primary, #106997))\",\n userMessageText: \"var(--chat-user-message-text, #ffffff)\",\n\n // Panel backgrounds\n panelBg: \"var(--chat-panel-bg, rgba(0, 0, 0, 0.02))\",\n panelBorder: \"var(--chat-panel-border, rgba(0, 0, 0, 0.06))\",\n\n // Borders\n border: \"var(--chat-border, rgba(0, 0, 0, 0.06))\",\n borderHover: \"var(--chat-border-hover, rgba(0, 0, 0, 0.12))\",\n\n // Text\n text: \"var(--chat-text, #1D2033)\",\n subtle: \"var(--chat-text-subtle, rgba(0, 0, 0, 0.5))\",\n placeholder: \"var(--chat-placeholder, rgba(0, 0, 0, 0.4))\",\n\n // Status colors\n status: {\n pending: {\n main: \"rgba(0, 0, 0, 0.3)\",\n bg: \"rgba(0, 0, 0, 0.05)\",\n },\n running: {\n main: \"rgb(99, 102, 241)\",\n bg: \"rgba(99, 102, 241, 0.08)\",\n },\n completed: {\n main: \"rgb(16, 185, 129)\",\n bg: \"rgba(16, 185, 129, 0.08)\",\n },\n failed: {\n main: \"rgb(239, 68, 68)\",\n bg: \"rgba(239, 68, 68, 0.08)\",\n },\n },\n },\n\n shadows: {\n subtle: \"0 1px 2px rgba(0, 0, 0, 0.04)\",\n input: \"0 2px 8px rgba(0, 0, 0, 0.08)\",\n inputFocus: \"0 4px 16px rgba(0, 0, 0, 0.12)\",\n button: \"0 1px 3px rgba(0, 0, 0, 0.08)\",\n buttonHover: \"0 2px 6px rgba(0, 0, 0, 0.12)\",\n primary: \"0 2px 6px rgba(16, 105, 151, 0.3)\",\n primaryHover: \"0 4px 12px rgba(16, 105, 151, 0.4)\",\n },\n\n animations: {\n messageEntrance: {\n initial: { opacity: 0, y: 8 },\n animate: { opacity: 1, y: 0 },\n transition: { duration: 0.3, ease: [0.4, 0, 0.2, 1] },\n },\n fadeIn: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n transition: { duration: 0.2 },\n },\n },\n} as const;\n\nexport type ChatTokens = typeof chatTokens;\n"]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { S as StreamingChunk, C as ClarificationData } from './streaming-CF63E6iS.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Citation source types for AI-generated content.
|
|
5
|
+
*/
|
|
6
|
+
interface SourceReference {
|
|
7
|
+
index: number;
|
|
8
|
+
reference_label: string;
|
|
9
|
+
source_type: string;
|
|
10
|
+
tool_name: string;
|
|
11
|
+
title: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
document_id?: string;
|
|
15
|
+
tool_execution_id?: string;
|
|
16
|
+
query?: string;
|
|
17
|
+
snippet?: string;
|
|
18
|
+
full_content?: string;
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
interface SourceTypeConfig {
|
|
22
|
+
label: string;
|
|
23
|
+
color: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type ParticipantRole = "user" | "assistant" | "system";
|
|
27
|
+
interface Participant {
|
|
28
|
+
id: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
role: ParticipantRole;
|
|
31
|
+
avatarUrl?: string;
|
|
32
|
+
}
|
|
33
|
+
interface Attachment {
|
|
34
|
+
id: string;
|
|
35
|
+
filename: string;
|
|
36
|
+
mimeType: string;
|
|
37
|
+
size: number;
|
|
38
|
+
url?: string;
|
|
39
|
+
previewUrl?: string;
|
|
40
|
+
isImage?: boolean;
|
|
41
|
+
isVideo?: boolean;
|
|
42
|
+
isDocument?: boolean;
|
|
43
|
+
humanReadableSize?: string;
|
|
44
|
+
fileExtension?: string;
|
|
45
|
+
}
|
|
46
|
+
interface MessageData {
|
|
47
|
+
id: string;
|
|
48
|
+
textContent: string;
|
|
49
|
+
participant?: Participant;
|
|
50
|
+
createdAt: string | Date;
|
|
51
|
+
updatedAt?: string | Date;
|
|
52
|
+
attachments?: Attachment[];
|
|
53
|
+
isStreaming?: boolean;
|
|
54
|
+
metadata?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
type SuggestedActionType = "send_message" | "navigate" | "copy_text" | "compose_email" | "search_emails" | "open_modal" | "api_call";
|
|
57
|
+
interface SuggestedAction {
|
|
58
|
+
id: string;
|
|
59
|
+
label: string;
|
|
60
|
+
value: string;
|
|
61
|
+
icon?: string;
|
|
62
|
+
type?: SuggestedActionType;
|
|
63
|
+
context?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
interface ChatMessage extends MessageData {
|
|
66
|
+
suggestedActions?: SuggestedAction[];
|
|
67
|
+
reasoning?: StreamingChunk[];
|
|
68
|
+
citations?: SourceReference[];
|
|
69
|
+
pendingClarification?: ClarificationData;
|
|
70
|
+
}
|
|
71
|
+
interface ReasoningChunk {
|
|
72
|
+
id: string;
|
|
73
|
+
type: "thinking" | "planning" | "executing" | "complete";
|
|
74
|
+
content: string;
|
|
75
|
+
timestamp: string | Date;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type { Attachment as A, ChatMessage as C, MessageData as M, ParticipantRole as P, ReasoningChunk as R, SourceReference as S, Participant as a, SourceTypeConfig as b, SuggestedAction as c, SuggestedActionType as d };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { S as StreamingChunk, C as ClarificationData } from './streaming-CF63E6iS.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Citation source types for AI-generated content.
|
|
5
|
+
*/
|
|
6
|
+
interface SourceReference {
|
|
7
|
+
index: number;
|
|
8
|
+
reference_label: string;
|
|
9
|
+
source_type: string;
|
|
10
|
+
tool_name: string;
|
|
11
|
+
title: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
document_id?: string;
|
|
15
|
+
tool_execution_id?: string;
|
|
16
|
+
query?: string;
|
|
17
|
+
snippet?: string;
|
|
18
|
+
full_content?: string;
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
interface SourceTypeConfig {
|
|
22
|
+
label: string;
|
|
23
|
+
color: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type ParticipantRole = "user" | "assistant" | "system";
|
|
27
|
+
interface Participant {
|
|
28
|
+
id: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
role: ParticipantRole;
|
|
31
|
+
avatarUrl?: string;
|
|
32
|
+
}
|
|
33
|
+
interface Attachment {
|
|
34
|
+
id: string;
|
|
35
|
+
filename: string;
|
|
36
|
+
mimeType: string;
|
|
37
|
+
size: number;
|
|
38
|
+
url?: string;
|
|
39
|
+
previewUrl?: string;
|
|
40
|
+
isImage?: boolean;
|
|
41
|
+
isVideo?: boolean;
|
|
42
|
+
isDocument?: boolean;
|
|
43
|
+
humanReadableSize?: string;
|
|
44
|
+
fileExtension?: string;
|
|
45
|
+
}
|
|
46
|
+
interface MessageData {
|
|
47
|
+
id: string;
|
|
48
|
+
textContent: string;
|
|
49
|
+
participant?: Participant;
|
|
50
|
+
createdAt: string | Date;
|
|
51
|
+
updatedAt?: string | Date;
|
|
52
|
+
attachments?: Attachment[];
|
|
53
|
+
isStreaming?: boolean;
|
|
54
|
+
metadata?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
type SuggestedActionType = "send_message" | "navigate" | "copy_text" | "compose_email" | "search_emails" | "open_modal" | "api_call";
|
|
57
|
+
interface SuggestedAction {
|
|
58
|
+
id: string;
|
|
59
|
+
label: string;
|
|
60
|
+
value: string;
|
|
61
|
+
icon?: string;
|
|
62
|
+
type?: SuggestedActionType;
|
|
63
|
+
context?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
interface ChatMessage extends MessageData {
|
|
66
|
+
suggestedActions?: SuggestedAction[];
|
|
67
|
+
reasoning?: StreamingChunk[];
|
|
68
|
+
citations?: SourceReference[];
|
|
69
|
+
pendingClarification?: ClarificationData;
|
|
70
|
+
}
|
|
71
|
+
interface ReasoningChunk {
|
|
72
|
+
id: string;
|
|
73
|
+
type: "thinking" | "planning" | "executing" | "complete";
|
|
74
|
+
content: string;
|
|
75
|
+
timestamp: string | Date;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type { Attachment as A, ChatMessage as C, MessageData as M, ParticipantRole as P, ReasoningChunk as R, SourceReference as S, Participant as a, SourceTypeConfig as b, SuggestedAction as c, SuggestedActionType as d };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export { A as Avatar, h as AvatarProps, C as ComposerContext, a as ComposerInput, i as ComposerInputProps, b as ComposerSubmit, j as ComposerSubmitProps, e as Message, M as MessageComposer, k as MessageComposerProps, c as MessageContent, l as MessageContentProps, d as MessageContext, m as MessageProps, f as MessageTimestamp, n as MessageTimestampProps, u as useComposer, g as useMessage } from '../avatar-D5eHcfjf.mjs';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { HTMLAttributes, ReactNode, ButtonHTMLAttributes } from 'react';
|
|
4
|
+
import { c as SuggestedAction } from '../message-ufYsvKXP.mjs';
|
|
5
|
+
import '../streaming-CF63E6iS.mjs';
|
|
6
|
+
|
|
7
|
+
interface MessageListProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/** Messages to render */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/** Whether to auto-scroll to bottom on new messages */
|
|
11
|
+
autoScroll?: boolean;
|
|
12
|
+
/** Threshold from bottom to trigger auto-scroll (pixels) */
|
|
13
|
+
scrollThreshold?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Headless MessageList primitive.
|
|
17
|
+
* Provides a scrollable container with auto-scroll behavior.
|
|
18
|
+
*/
|
|
19
|
+
declare const MessageList: react.ForwardRefExoticComponent<MessageListProps & react.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
|
|
21
|
+
interface StreamingTextProps extends HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
/** The content to display */
|
|
23
|
+
content: string;
|
|
24
|
+
/** Whether the text is currently streaming */
|
|
25
|
+
isStreaming?: boolean;
|
|
26
|
+
/** Show a cursor indicator while streaming */
|
|
27
|
+
showCursor?: boolean;
|
|
28
|
+
/** Custom cursor element */
|
|
29
|
+
cursor?: ReactNode;
|
|
30
|
+
/** Children override (takes precedence over content) */
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Headless StreamingText primitive.
|
|
35
|
+
* Renders text with streaming indicator support.
|
|
36
|
+
*/
|
|
37
|
+
declare const StreamingText: react.ForwardRefExoticComponent<StreamingTextProps & react.RefAttributes<HTMLDivElement>>;
|
|
38
|
+
|
|
39
|
+
interface SuggestedActionsContextValue {
|
|
40
|
+
actions: SuggestedAction[];
|
|
41
|
+
onSelect: (action: SuggestedAction) => void;
|
|
42
|
+
}
|
|
43
|
+
declare const SuggestedActionsContext: react.Context<SuggestedActionsContextValue | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Hook to access suggested actions context.
|
|
46
|
+
*/
|
|
47
|
+
declare function useSuggestedActions(): SuggestedActionsContextValue;
|
|
48
|
+
interface SuggestedActionsProps {
|
|
49
|
+
/** List of suggested actions */
|
|
50
|
+
actions: SuggestedAction[];
|
|
51
|
+
/** Callback when an action is selected */
|
|
52
|
+
onSelect: (action: SuggestedAction) => void;
|
|
53
|
+
/** Children to render */
|
|
54
|
+
children: ReactNode;
|
|
55
|
+
/** Additional CSS classes */
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Headless SuggestedActions primitive.
|
|
60
|
+
* Provides context for rendering action buttons.
|
|
61
|
+
*/
|
|
62
|
+
declare const SuggestedActions: react.ForwardRefExoticComponent<SuggestedActionsProps & react.RefAttributes<HTMLDivElement>>;
|
|
63
|
+
interface ActionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
64
|
+
/** The action this button represents */
|
|
65
|
+
action: SuggestedAction;
|
|
66
|
+
/** Children to render inside button */
|
|
67
|
+
children?: ReactNode;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Button for a suggested action.
|
|
71
|
+
*/
|
|
72
|
+
declare const ActionButton: react.ForwardRefExoticComponent<ActionButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
73
|
+
|
|
74
|
+
interface TypingIndicatorProps extends HTMLAttributes<HTMLDivElement> {
|
|
75
|
+
/** Custom content to show while typing */
|
|
76
|
+
children?: ReactNode;
|
|
77
|
+
/** Number of dots to show */
|
|
78
|
+
dotCount?: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Headless TypingIndicator primitive.
|
|
82
|
+
* Shows animated dots or custom content.
|
|
83
|
+
*/
|
|
84
|
+
declare const TypingIndicator: react.ForwardRefExoticComponent<TypingIndicatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
85
|
+
|
|
86
|
+
export { ActionButton, type ActionButtonProps, MessageList, type MessageListProps, StreamingText, type StreamingTextProps, SuggestedActions, SuggestedActionsContext, type SuggestedActionsProps, TypingIndicator, type TypingIndicatorProps, useSuggestedActions };
|