@djangocfg/ui-tools 2.1.382 → 2.1.383
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/DictationField-U25MEYAL.mjs +4 -0
- package/dist/{DictationField-2ZLQWLYV.mjs.map → DictationField-U25MEYAL.mjs.map} +1 -1
- package/dist/DictationField-XWR5VOID.cjs +13 -0
- package/dist/{DictationField-IPPJ54CU.cjs.map → DictationField-XWR5VOID.cjs.map} +1 -1
- package/dist/{chunk-KMSBGNVC.cjs → chunk-4PFW7MIJ.cjs} +4 -2
- package/dist/chunk-4PFW7MIJ.cjs.map +1 -0
- package/dist/{chunk-4LXG3NBV.mjs → chunk-C2YN6WEO.mjs} +3 -3
- package/dist/chunk-C2YN6WEO.mjs.map +1 -0
- package/dist/index.cjs +139 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +68 -1
- package/dist/index.d.ts +68 -1
- package/dist/index.mjs +141 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -13
- package/src/tools/Chat/index.ts +15 -0
- package/dist/DictationField-2ZLQWLYV.mjs +0 -4
- package/dist/DictationField-IPPJ54CU.cjs +0 -13
- package/dist/chunk-4LXG3NBV.mjs.map +0 -1
- package/dist/chunk-KMSBGNVC.cjs.map +0 -1
- package/src/components/markdown/MarkdownMessage/MarkdownMessage.story.tsx +0 -771
- package/src/stories/index.ts +0 -63
- package/src/tools/AudioPlayer/AudioPlayer.story.tsx +0 -481
- package/src/tools/Chat/stories/01-basic.story.tsx +0 -64
- package/src/tools/Chat/stories/02-bubbles.story.tsx +0 -21
- package/src/tools/Chat/stories/03-tool-calls.story.tsx +0 -59
- package/src/tools/Chat/stories/04-personas.story.tsx +0 -78
- package/src/tools/Chat/stories/05-launcher.story.tsx +0 -321
- package/src/tools/Chat/stories/06-header.story.tsx +0 -147
- package/src/tools/Chat/stories/07-audio-actions.story.tsx +0 -112
- package/src/tools/Chat/stories/shared/Frame.tsx +0 -21
- package/src/tools/Chat/stories/shared/index.ts +0 -5
- package/src/tools/Chat/stories/shared/messages.ts +0 -39
- package/src/tools/Chat/stories/shared/personas.ts +0 -13
- package/src/tools/Chat/stories/shared/seeds.ts +0 -92
- package/src/tools/Chat/stories/shared/transports.ts +0 -36
- package/src/tools/CodeEditor/CodeEditor.story.tsx +0 -202
- package/src/tools/CronScheduler/CronScheduler.story.tsx +0 -300
- package/src/tools/Gallery/Gallery.story.tsx +0 -237
- package/src/tools/ImageViewer/ImageViewer.story.tsx +0 -85
- package/src/tools/JsonForm/JsonForm.story.tsx +0 -350
- package/src/tools/JsonTree/JsonTree.story.tsx +0 -141
- package/src/tools/LottiePlayer/LottiePlayer.story.tsx +0 -95
- package/src/tools/Map/Map.story.tsx +0 -458
- package/src/tools/MarkdownEditor/MarkdownEditor.story.tsx +0 -225
- package/src/tools/Mermaid/Mermaid.story.tsx +0 -251
- package/src/tools/OpenapiViewer/OpenapiViewer.story.tsx +0 -230
- package/src/tools/PrettyCode/PrettyCode.story.tsx +0 -304
- package/src/tools/SpeechRecognition/stories/01-basic.story.tsx +0 -32
- package/src/tools/SpeechRecognition/stories/02-dictation-field.story.tsx +0 -32
- package/src/tools/SpeechRecognition/stories/03-push-to-talk.story.tsx +0 -27
- package/src/tools/SpeechRecognition/stories/04-mic-meter.story.tsx +0 -35
- package/src/tools/SpeechRecognition/stories/05-custom-engine-http.story.tsx +0 -40
- package/src/tools/SpeechRecognition/stories/06-custom-engine-ws.story.tsx +0 -48
- package/src/tools/SpeechRecognition/stories/07-language-device.story.tsx +0 -57
- package/src/tools/SpeechRecognition/stories/08-errors-permissions.story.tsx +0 -25
- package/src/tools/SpeechRecognition/stories/09-chat-voice.story.tsx +0 -90
- package/src/tools/SpeechRecognition/stories/shared.tsx +0 -123
- package/src/tools/Tour/Tour.story.tsx +0 -279
- package/src/tools/Tree/Tree.story.tsx +0 -620
- package/src/tools/Uploader/Uploader.story.tsx +0 -415
- package/src/tools/VideoPlayer/VideoPlayer.story.tsx +0 -87
package/dist/index.d.cts
CHANGED
|
@@ -2801,6 +2801,31 @@ interface ChatHeaderResetButtonProps {
|
|
|
2801
2801
|
*/
|
|
2802
2802
|
declare function ChatHeaderResetButton({ onReset, onSuccess, onError, confirm, confirmTitle, confirmMessage, ariaLabel, }: ChatHeaderResetButtonProps): react_jsx_runtime.JSX.Element;
|
|
2803
2803
|
|
|
2804
|
+
interface ChatHeaderLanguageButtonProps {
|
|
2805
|
+
/** Override aria-label. Default "Speech language". */
|
|
2806
|
+
ariaLabel?: string;
|
|
2807
|
+
/**
|
|
2808
|
+
* Subset of BCP-47 tags to offer. Default: every entry from the
|
|
2809
|
+
* Web Speech catalogue (~66 tags incl. regional variants). Pass a
|
|
2810
|
+
* tighter list when your backend STT only supports a subset.
|
|
2811
|
+
*/
|
|
2812
|
+
allowedTags?: string[];
|
|
2813
|
+
/** Hide the globe-fallback icon when no flag resolves. */
|
|
2814
|
+
hideFallbackIcon?: boolean;
|
|
2815
|
+
className?: string;
|
|
2816
|
+
}
|
|
2817
|
+
/**
|
|
2818
|
+
* Compact flag-button language picker for the chat header. Built on
|
|
2819
|
+
* top of the ui-core `<Combobox>` — searchable autocomplete with
|
|
2820
|
+
* flags, ~66 BCP-47 tags from the official Chrome Web Speech demo, and
|
|
2821
|
+
* a custom 28×28 trigger via `renderTrigger`.
|
|
2822
|
+
*
|
|
2823
|
+
* The selection persists into `useSpeechPrefs` (zustand+localStorage)
|
|
2824
|
+
* so `useSpeechRecognition` picks it up as the second-priority resolver
|
|
2825
|
+
* value (above i18n locale, below an explicit `language` prop).
|
|
2826
|
+
*/
|
|
2827
|
+
declare function ChatHeaderLanguageButton({ ariaLabel, allowedTags, hideFallbackIcon, className, }: ChatHeaderLanguageButtonProps): react.ReactElement;
|
|
2828
|
+
|
|
2804
2829
|
interface ChatGreetingProps {
|
|
2805
2830
|
/** Controlled visibility — usually `!chatOpen && !userDismissed`. */
|
|
2806
2831
|
open: boolean;
|
|
@@ -3299,6 +3324,48 @@ interface UseFocusOnEmptyClickOptions {
|
|
|
3299
3324
|
*/
|
|
3300
3325
|
declare function useFocusOnEmptyClick(options?: UseFocusOnEmptyClickOptions): (event: MouseEvent<HTMLElement>) => void;
|
|
3301
3326
|
|
|
3327
|
+
interface UseChatUnreadOptions {
|
|
3328
|
+
/**
|
|
3329
|
+
* When true, unread state is auto-cleared (treated as "user is reading
|
|
3330
|
+
* the chat right now"). Pass your dock-open boolean here so the badge
|
|
3331
|
+
* resets the moment the user opens the chat.
|
|
3332
|
+
*/
|
|
3333
|
+
open?: boolean;
|
|
3334
|
+
/**
|
|
3335
|
+
* Which message roles count as "unread". Defaults to `['assistant']` —
|
|
3336
|
+
* we only count inbound replies, not the user's own messages.
|
|
3337
|
+
*/
|
|
3338
|
+
countRoles?: Array<ChatMessage['role']>;
|
|
3339
|
+
}
|
|
3340
|
+
interface UseChatUnreadReturn {
|
|
3341
|
+
/** Most-recent inbound message since the last mark-as-read. */
|
|
3342
|
+
unread: ChatMessage | null;
|
|
3343
|
+
/** Total inbound messages since the last mark-as-read. */
|
|
3344
|
+
count: number;
|
|
3345
|
+
/** Manually clear the unread state. */
|
|
3346
|
+
markRead: () => void;
|
|
3347
|
+
}
|
|
3348
|
+
/**
|
|
3349
|
+
* Track inbound chat messages while the user isn't watching.
|
|
3350
|
+
*
|
|
3351
|
+
* Must be called **inside** the chat's `<ChatProvider>` (i.e. inside the
|
|
3352
|
+
* `children` of `ChatLauncher`, alongside `ChatRoot`).
|
|
3353
|
+
*
|
|
3354
|
+
* @example
|
|
3355
|
+
* ```tsx
|
|
3356
|
+
* function ChatRootWithUnreadBadge({ open, onUnread }: { open: boolean; onUnread: (m: ChatMessage | null) => void }) {
|
|
3357
|
+
* const { unread, count, markRead } = useChatUnread({ open });
|
|
3358
|
+
* useEffect(() => onUnread(unread), [unread, onUnread]);
|
|
3359
|
+
* // pass `count` to your FAB badge via the host's state
|
|
3360
|
+
* return <ChatRoot transport={transport} />;
|
|
3361
|
+
* }
|
|
3362
|
+
* ```
|
|
3363
|
+
*
|
|
3364
|
+
* For end-to-end wiring with `<ChatLauncher unreadMessage onMarkRead>`,
|
|
3365
|
+
* see the `Launcher / WithLivePush` story.
|
|
3366
|
+
*/
|
|
3367
|
+
declare function useChatUnread(opts?: UseChatUnreadOptions): UseChatUnreadReturn;
|
|
3368
|
+
|
|
3302
3369
|
declare const useChatAudioPrefs: zustand.UseBoundStore<zustand.StoreApi<AudioPrefsState<ChatAudioEvent>>>;
|
|
3303
3370
|
|
|
3304
3371
|
/**
|
|
@@ -4817,4 +4884,4 @@ declare function useBlobUrlCleanup(key: string | null): void;
|
|
|
4817
4884
|
*/
|
|
4818
4885
|
declare function generateContentKey(content: ArrayBuffer): string;
|
|
4819
4886
|
|
|
4820
|
-
export { ANCHOR, type ApiKey, ArrayFieldItemTemplate, ArrayFieldTemplate, type AspectRatioValue, type AttachmentRenderer, type AttachmentRendererArgs, type AttachmentRendererMap, Attachments, AttachmentsGrid, type AttachmentsGridProps, AttachmentsList, type AttachmentsListProps, type AttachmentsProps, Player as AudioPlayer, type PlayerProps as AudioPlayerProps, AudioToggle, type AudioToggleProps, BUBBLE_SURFACE, BaseInputTemplate, type BlobSource, CHAT_EVENT_NAME, CSS_VARS, CardLoadingFallback, type ChatAction, type ChatAssistantContext, type ChatAttachment, type ChatAudioConfig, type ChatAudioEvent, type ChatAudioSounds, type ChatBubbleStyles, type ChatBubbleSurface, type ChatConfig, type ChatContextValue, type ChatDestructiveStyles, type ChatDisplayMode, ChatDock, type ChatDockMode, type ChatDockPrefs, type ChatDockProps, type ChatDockSide, type ChatEventDetail, ChatFAB, type ChatFABPosition, type ChatFABProps, type ChatFABSize, type ChatFABVariant, ChatGreeting, type ChatGreetingProps, ChatHeader, ChatHeaderActionButton, type ChatHeaderActionButtonProps, ChatHeaderAudioToggle, type ChatHeaderAudioToggleProps, ChatHeaderModeToggle, type ChatHeaderModeToggleProps, type ChatHeaderProps, ChatHeaderResetButton, type ChatHeaderResetButtonProps, type ChatLabels, ChatLauncher, type ChatLauncherGreeting, type ChatLauncherHotkey, type ChatLauncherProps, type ChatLightboxState, type ChatLogScope, type ChatLogger, type ChatMessage, type ChatPersona, type ChatPrefs, type ChatPresencePhase, ChatProvider, type ChatProviderProps, type ChatRole, type ChatRoleStyles, ChatRoot, type ChatRootProps, type ChatSource, type ChatState, type ChatStreamEvent, type ChatToolCall, type ChatTransport, ChatUnreadPreview, type ChatUnreadPreviewProps, type ChatUserContext, CheckboxWidget, ColorWidget, Composer, type ComposerProps, type CreateLazyComponentOptions, type CreateSessionOptions, type CreateVideoErrorFallbackOptions, CronScheduler, type CronSchedulerContextValue, type CronSchedulerProps, CronSchedulerProvider, type CronSchedulerState, CustomInput, type DASHSource, DEFAULT_CHAT_SOUNDS, DEFAULT_DOCK_PREFS, DEFAULT_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, DESTRUCTIVE_SURFACE, type DataUrlSource, DayChips, DiffEditor, type DiffEditorProps, type DisabledWhenRule, Editor, type EditorContextValue, type EditorFile, type EditorOptions, type EditorProps, EditorProvider, type EditorRef, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorFallbackProps, ErrorListTemplate, FieldTemplate, type Focusable, type HLSSource, HOTKEYS, type HistoryPage, type HttpTransportConfig, type ImageFile, ImageViewer, type ImageViewerProps, type JsonFormContext, type JsonFormDensity, JsonSchemaForm, type JsonSchemaFormProps, JsonTreeComponent as JsonTree, type JsonTreeConfig, type JsonTreeProps, JumpToLatest, type JumpToLatestProps, LIMITS, LazyPlayer as LazyAudioPlayer, LazyChat, type ChatRootProps as LazyChatProps, LazyCronScheduler, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyTree, TreeRootProps as LazyTreeProps, LazyVideoPlayer, LazyWrapper, type LazyWrapperProps, type LinkRule, LoadingFallback, type LoadingFallbackProps, type LottieDirection, LottiePlayer, type LottiePlayerProps, type LottieSize, type LottieSpeed, type MapContainerProps, MapLoadingFallback, type MapStyleKey, type MapViewport, MarkdownEditor, type MarkdownEditorProps, MarkdownMessage, type MarkdownMessageProps, type MarkerData, type MentionAttrs, type MentionConfig, type MentionItem, type MentionMarkdownRenderer, Mermaid, type MermaidProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageList, type MessageListHandle, type MessageListProps, type MockTransportOptions, type MonthDay, MonthDayGrid, NativeProvider, NumberWidget, ObjectFieldTemplate, Playground as OpenapiViewer, type ParseSSEOptions, type PlayerMode, type PlaygroundConfig, type PlaygroundProps$1 as PlaygroundProps, PrettyCode, type PrettyCodeProps$1 as PrettyCodeProps, type PydanticAIChatTransportOpts, type PydanticAIEvent, type ResolveFileSourceOptions, STORAGE_KEYS, SchedulePreview, type ScheduleType, ScheduleTypeSelector, type SchemaSource, SelectWidget, type SendOptions, type SessionInfo, type SimpleStreamSource, SliderWidget, Sources, type SourcesProps, Spinner, type StreamOptions, StreamProvider, type StreamSource, StreamingIndicator, type StreamingIndicatorProps, SwitchWidget, TOGGLE, TOOL_CALL, TextWidget, TimeSelector, type TokenBuffer, ToolCalls, type ToolCallsProps, type ToolIdQueue, type ToolPayloadFallback, type ToolPayloadKind, type ToolPayloadMatcher, TransportError, TreeRootProps, type UiGroup, type UrlSource, type UseAutoFocusOnStreamEndOptions, type UseChatAudioReturn, type UseChatComposerOptions, type UseChatComposerReturn, type UseChatConfig, type UseChatDockPrefsOptions, type UseChatDockPrefsReturn, type UseChatHistoryOptions, type UseChatLayoutConfig, type UseChatLayoutReturn, type UseChatLightboxReturn, type UseChatResetOptions, type UseChatResetReturn, type UseChatReturn, type UseChatScrollOptions, type UseChatScrollReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseFocusOnEmptyClickOptions, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, type UseVisitorFingerprintOptions, VideoControls, VideoErrorFallback, type VideoErrorFallbackProps, VideoPlayer, type VideoPlayerContextValue, type VideoPlayerProps, VideoPlayerProvider, type VideoPlayerProviderProps, type VideoPlayerRef, type VideoSourceUnion, VidstackProvider, type VimeoSource, type WeekDay, type YouTubeSource, buildCron, collectImageAttachments, createHttpTransport, createId, createLazyComponent, createMockTransport, createPydanticAIChatTransport, createPydanticAISSEMap, createTokenBuffer, createToolIdQueue, createVideoErrorFallback, deriveInitials, dispatchToolPayload, evaluateDisabledWhen, extractTextFromChildren, generateContentKey, getChatLogger, getRequiredFields, hasRequiredFields, humanizeCron, initialState, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isSimpleStreamSource, isStringValue, isSubmittableDraft, isValidCron, mapPydanticAIEvent, mentionPresets, mergeDefaults, normalizeFormData, parseCron, parseSSE, reducer, resolveFileSource, resolvePersona, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, sanitizeDraft, useAudioCache, useAutoFocusOnStreamEnd, useBlobUrlCleanup, useChat, useChatAudio, useChatAudioPrefs, useChatBubbleStyles, useChatComposer, useChatContext, useChatContextOptional, useChatDestructiveStyles, useChatDockPrefs, useChatHistory, useChatLayout, useChatLightbox, useChatPresence, useChatReset, useChatRoleStyles, useChatScroll, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useFocusOnEmptyClick, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useRegisterComposer, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, useVisitorFingerprint, validateRequiredFields, validateSchema };
|
|
4887
|
+
export { ANCHOR, type ApiKey, ArrayFieldItemTemplate, ArrayFieldTemplate, type AspectRatioValue, type AttachmentRenderer, type AttachmentRendererArgs, type AttachmentRendererMap, Attachments, AttachmentsGrid, type AttachmentsGridProps, AttachmentsList, type AttachmentsListProps, type AttachmentsProps, Player as AudioPlayer, type PlayerProps as AudioPlayerProps, AudioToggle, type AudioToggleProps, BUBBLE_SURFACE, BaseInputTemplate, type BlobSource, CHAT_EVENT_NAME, CSS_VARS, CardLoadingFallback, type ChatAction, type ChatAssistantContext, type ChatAttachment, type ChatAudioConfig, type ChatAudioEvent, type ChatAudioSounds, type ChatBubbleStyles, type ChatBubbleSurface, type ChatConfig, type ChatContextValue, type ChatDestructiveStyles, type ChatDisplayMode, ChatDock, type ChatDockMode, type ChatDockPrefs, type ChatDockProps, type ChatDockSide, type ChatEventDetail, ChatFAB, type ChatFABPosition, type ChatFABProps, type ChatFABSize, type ChatFABVariant, ChatGreeting, type ChatGreetingProps, ChatHeader, ChatHeaderActionButton, type ChatHeaderActionButtonProps, ChatHeaderAudioToggle, type ChatHeaderAudioToggleProps, ChatHeaderLanguageButton, type ChatHeaderLanguageButtonProps, ChatHeaderModeToggle, type ChatHeaderModeToggleProps, type ChatHeaderProps, ChatHeaderResetButton, type ChatHeaderResetButtonProps, type ChatLabels, ChatLauncher, type ChatLauncherGreeting, type ChatLauncherHotkey, type ChatLauncherProps, type ChatLightboxState, type ChatLogScope, type ChatLogger, type ChatMessage, type ChatPersona, type ChatPrefs, type ChatPresencePhase, ChatProvider, type ChatProviderProps, type ChatRole, type ChatRoleStyles, ChatRoot, type ChatRootProps, type ChatSource, type ChatState, type ChatStreamEvent, type ChatToolCall, type ChatTransport, ChatUnreadPreview, type ChatUnreadPreviewProps, type ChatUserContext, CheckboxWidget, ColorWidget, Composer, type ComposerProps, type CreateLazyComponentOptions, type CreateSessionOptions, type CreateVideoErrorFallbackOptions, CronScheduler, type CronSchedulerContextValue, type CronSchedulerProps, CronSchedulerProvider, type CronSchedulerState, CustomInput, type DASHSource, DEFAULT_CHAT_SOUNDS, DEFAULT_DOCK_PREFS, DEFAULT_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, DESTRUCTIVE_SURFACE, type DataUrlSource, DayChips, DiffEditor, type DiffEditorProps, type DisabledWhenRule, Editor, type EditorContextValue, type EditorFile, type EditorOptions, type EditorProps, EditorProvider, type EditorRef, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorFallbackProps, ErrorListTemplate, FieldTemplate, type Focusable, type HLSSource, HOTKEYS, type HistoryPage, type HttpTransportConfig, type ImageFile, ImageViewer, type ImageViewerProps, type JsonFormContext, type JsonFormDensity, JsonSchemaForm, type JsonSchemaFormProps, JsonTreeComponent as JsonTree, type JsonTreeConfig, type JsonTreeProps, JumpToLatest, type JumpToLatestProps, LIMITS, LazyPlayer as LazyAudioPlayer, LazyChat, type ChatRootProps as LazyChatProps, LazyCronScheduler, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyTree, TreeRootProps as LazyTreeProps, LazyVideoPlayer, LazyWrapper, type LazyWrapperProps, type LinkRule, LoadingFallback, type LoadingFallbackProps, type LottieDirection, LottiePlayer, type LottiePlayerProps, type LottieSize, type LottieSpeed, type MapContainerProps, MapLoadingFallback, type MapStyleKey, type MapViewport, MarkdownEditor, type MarkdownEditorProps, MarkdownMessage, type MarkdownMessageProps, type MarkerData, type MentionAttrs, type MentionConfig, type MentionItem, type MentionMarkdownRenderer, Mermaid, type MermaidProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageList, type MessageListHandle, type MessageListProps, type MockTransportOptions, type MonthDay, MonthDayGrid, NativeProvider, NumberWidget, ObjectFieldTemplate, Playground as OpenapiViewer, type ParseSSEOptions, type PlayerMode, type PlaygroundConfig, type PlaygroundProps$1 as PlaygroundProps, PrettyCode, type PrettyCodeProps$1 as PrettyCodeProps, type PydanticAIChatTransportOpts, type PydanticAIEvent, type ResolveFileSourceOptions, STORAGE_KEYS, SchedulePreview, type ScheduleType, ScheduleTypeSelector, type SchemaSource, SelectWidget, type SendOptions, type SessionInfo, type SimpleStreamSource, SliderWidget, Sources, type SourcesProps, Spinner, type StreamOptions, StreamProvider, type StreamSource, StreamingIndicator, type StreamingIndicatorProps, SwitchWidget, TOGGLE, TOOL_CALL, TextWidget, TimeSelector, type TokenBuffer, ToolCalls, type ToolCallsProps, type ToolIdQueue, type ToolPayloadFallback, type ToolPayloadKind, type ToolPayloadMatcher, TransportError, TreeRootProps, type UiGroup, type UrlSource, type UseAutoFocusOnStreamEndOptions, type UseChatAudioReturn, type UseChatComposerOptions, type UseChatComposerReturn, type UseChatConfig, type UseChatDockPrefsOptions, type UseChatDockPrefsReturn, type UseChatHistoryOptions, type UseChatLayoutConfig, type UseChatLayoutReturn, type UseChatLightboxReturn, type UseChatResetOptions, type UseChatResetReturn, type UseChatReturn, type UseChatScrollOptions, type UseChatScrollReturn, type UseChatUnreadOptions, type UseChatUnreadReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseFocusOnEmptyClickOptions, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, type UseVisitorFingerprintOptions, VideoControls, VideoErrorFallback, type VideoErrorFallbackProps, VideoPlayer, type VideoPlayerContextValue, type VideoPlayerProps, VideoPlayerProvider, type VideoPlayerProviderProps, type VideoPlayerRef, type VideoSourceUnion, VidstackProvider, type VimeoSource, type WeekDay, type YouTubeSource, buildCron, collectImageAttachments, createHttpTransport, createId, createLazyComponent, createMockTransport, createPydanticAIChatTransport, createPydanticAISSEMap, createTokenBuffer, createToolIdQueue, createVideoErrorFallback, deriveInitials, dispatchToolPayload, evaluateDisabledWhen, extractTextFromChildren, generateContentKey, getChatLogger, getRequiredFields, hasRequiredFields, humanizeCron, initialState, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isSimpleStreamSource, isStringValue, isSubmittableDraft, isValidCron, mapPydanticAIEvent, mentionPresets, mergeDefaults, normalizeFormData, parseCron, parseSSE, reducer, resolveFileSource, resolvePersona, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, sanitizeDraft, useAudioCache, useAutoFocusOnStreamEnd, useBlobUrlCleanup, useChat, useChatAudio, useChatAudioPrefs, useChatBubbleStyles, useChatComposer, useChatContext, useChatContextOptional, useChatDestructiveStyles, useChatDockPrefs, useChatHistory, useChatLayout, useChatLightbox, useChatPresence, useChatReset, useChatRoleStyles, useChatScroll, useChatUnread, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useFocusOnEmptyClick, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useRegisterComposer, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, useVisitorFingerprint, validateRequiredFields, validateSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -2801,6 +2801,31 @@ interface ChatHeaderResetButtonProps {
|
|
|
2801
2801
|
*/
|
|
2802
2802
|
declare function ChatHeaderResetButton({ onReset, onSuccess, onError, confirm, confirmTitle, confirmMessage, ariaLabel, }: ChatHeaderResetButtonProps): react_jsx_runtime.JSX.Element;
|
|
2803
2803
|
|
|
2804
|
+
interface ChatHeaderLanguageButtonProps {
|
|
2805
|
+
/** Override aria-label. Default "Speech language". */
|
|
2806
|
+
ariaLabel?: string;
|
|
2807
|
+
/**
|
|
2808
|
+
* Subset of BCP-47 tags to offer. Default: every entry from the
|
|
2809
|
+
* Web Speech catalogue (~66 tags incl. regional variants). Pass a
|
|
2810
|
+
* tighter list when your backend STT only supports a subset.
|
|
2811
|
+
*/
|
|
2812
|
+
allowedTags?: string[];
|
|
2813
|
+
/** Hide the globe-fallback icon when no flag resolves. */
|
|
2814
|
+
hideFallbackIcon?: boolean;
|
|
2815
|
+
className?: string;
|
|
2816
|
+
}
|
|
2817
|
+
/**
|
|
2818
|
+
* Compact flag-button language picker for the chat header. Built on
|
|
2819
|
+
* top of the ui-core `<Combobox>` — searchable autocomplete with
|
|
2820
|
+
* flags, ~66 BCP-47 tags from the official Chrome Web Speech demo, and
|
|
2821
|
+
* a custom 28×28 trigger via `renderTrigger`.
|
|
2822
|
+
*
|
|
2823
|
+
* The selection persists into `useSpeechPrefs` (zustand+localStorage)
|
|
2824
|
+
* so `useSpeechRecognition` picks it up as the second-priority resolver
|
|
2825
|
+
* value (above i18n locale, below an explicit `language` prop).
|
|
2826
|
+
*/
|
|
2827
|
+
declare function ChatHeaderLanguageButton({ ariaLabel, allowedTags, hideFallbackIcon, className, }: ChatHeaderLanguageButtonProps): react.ReactElement;
|
|
2828
|
+
|
|
2804
2829
|
interface ChatGreetingProps {
|
|
2805
2830
|
/** Controlled visibility — usually `!chatOpen && !userDismissed`. */
|
|
2806
2831
|
open: boolean;
|
|
@@ -3299,6 +3324,48 @@ interface UseFocusOnEmptyClickOptions {
|
|
|
3299
3324
|
*/
|
|
3300
3325
|
declare function useFocusOnEmptyClick(options?: UseFocusOnEmptyClickOptions): (event: MouseEvent<HTMLElement>) => void;
|
|
3301
3326
|
|
|
3327
|
+
interface UseChatUnreadOptions {
|
|
3328
|
+
/**
|
|
3329
|
+
* When true, unread state is auto-cleared (treated as "user is reading
|
|
3330
|
+
* the chat right now"). Pass your dock-open boolean here so the badge
|
|
3331
|
+
* resets the moment the user opens the chat.
|
|
3332
|
+
*/
|
|
3333
|
+
open?: boolean;
|
|
3334
|
+
/**
|
|
3335
|
+
* Which message roles count as "unread". Defaults to `['assistant']` —
|
|
3336
|
+
* we only count inbound replies, not the user's own messages.
|
|
3337
|
+
*/
|
|
3338
|
+
countRoles?: Array<ChatMessage['role']>;
|
|
3339
|
+
}
|
|
3340
|
+
interface UseChatUnreadReturn {
|
|
3341
|
+
/** Most-recent inbound message since the last mark-as-read. */
|
|
3342
|
+
unread: ChatMessage | null;
|
|
3343
|
+
/** Total inbound messages since the last mark-as-read. */
|
|
3344
|
+
count: number;
|
|
3345
|
+
/** Manually clear the unread state. */
|
|
3346
|
+
markRead: () => void;
|
|
3347
|
+
}
|
|
3348
|
+
/**
|
|
3349
|
+
* Track inbound chat messages while the user isn't watching.
|
|
3350
|
+
*
|
|
3351
|
+
* Must be called **inside** the chat's `<ChatProvider>` (i.e. inside the
|
|
3352
|
+
* `children` of `ChatLauncher`, alongside `ChatRoot`).
|
|
3353
|
+
*
|
|
3354
|
+
* @example
|
|
3355
|
+
* ```tsx
|
|
3356
|
+
* function ChatRootWithUnreadBadge({ open, onUnread }: { open: boolean; onUnread: (m: ChatMessage | null) => void }) {
|
|
3357
|
+
* const { unread, count, markRead } = useChatUnread({ open });
|
|
3358
|
+
* useEffect(() => onUnread(unread), [unread, onUnread]);
|
|
3359
|
+
* // pass `count` to your FAB badge via the host's state
|
|
3360
|
+
* return <ChatRoot transport={transport} />;
|
|
3361
|
+
* }
|
|
3362
|
+
* ```
|
|
3363
|
+
*
|
|
3364
|
+
* For end-to-end wiring with `<ChatLauncher unreadMessage onMarkRead>`,
|
|
3365
|
+
* see the `Launcher / WithLivePush` story.
|
|
3366
|
+
*/
|
|
3367
|
+
declare function useChatUnread(opts?: UseChatUnreadOptions): UseChatUnreadReturn;
|
|
3368
|
+
|
|
3302
3369
|
declare const useChatAudioPrefs: zustand.UseBoundStore<zustand.StoreApi<AudioPrefsState<ChatAudioEvent>>>;
|
|
3303
3370
|
|
|
3304
3371
|
/**
|
|
@@ -4817,4 +4884,4 @@ declare function useBlobUrlCleanup(key: string | null): void;
|
|
|
4817
4884
|
*/
|
|
4818
4885
|
declare function generateContentKey(content: ArrayBuffer): string;
|
|
4819
4886
|
|
|
4820
|
-
export { ANCHOR, type ApiKey, ArrayFieldItemTemplate, ArrayFieldTemplate, type AspectRatioValue, type AttachmentRenderer, type AttachmentRendererArgs, type AttachmentRendererMap, Attachments, AttachmentsGrid, type AttachmentsGridProps, AttachmentsList, type AttachmentsListProps, type AttachmentsProps, Player as AudioPlayer, type PlayerProps as AudioPlayerProps, AudioToggle, type AudioToggleProps, BUBBLE_SURFACE, BaseInputTemplate, type BlobSource, CHAT_EVENT_NAME, CSS_VARS, CardLoadingFallback, type ChatAction, type ChatAssistantContext, type ChatAttachment, type ChatAudioConfig, type ChatAudioEvent, type ChatAudioSounds, type ChatBubbleStyles, type ChatBubbleSurface, type ChatConfig, type ChatContextValue, type ChatDestructiveStyles, type ChatDisplayMode, ChatDock, type ChatDockMode, type ChatDockPrefs, type ChatDockProps, type ChatDockSide, type ChatEventDetail, ChatFAB, type ChatFABPosition, type ChatFABProps, type ChatFABSize, type ChatFABVariant, ChatGreeting, type ChatGreetingProps, ChatHeader, ChatHeaderActionButton, type ChatHeaderActionButtonProps, ChatHeaderAudioToggle, type ChatHeaderAudioToggleProps, ChatHeaderModeToggle, type ChatHeaderModeToggleProps, type ChatHeaderProps, ChatHeaderResetButton, type ChatHeaderResetButtonProps, type ChatLabels, ChatLauncher, type ChatLauncherGreeting, type ChatLauncherHotkey, type ChatLauncherProps, type ChatLightboxState, type ChatLogScope, type ChatLogger, type ChatMessage, type ChatPersona, type ChatPrefs, type ChatPresencePhase, ChatProvider, type ChatProviderProps, type ChatRole, type ChatRoleStyles, ChatRoot, type ChatRootProps, type ChatSource, type ChatState, type ChatStreamEvent, type ChatToolCall, type ChatTransport, ChatUnreadPreview, type ChatUnreadPreviewProps, type ChatUserContext, CheckboxWidget, ColorWidget, Composer, type ComposerProps, type CreateLazyComponentOptions, type CreateSessionOptions, type CreateVideoErrorFallbackOptions, CronScheduler, type CronSchedulerContextValue, type CronSchedulerProps, CronSchedulerProvider, type CronSchedulerState, CustomInput, type DASHSource, DEFAULT_CHAT_SOUNDS, DEFAULT_DOCK_PREFS, DEFAULT_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, DESTRUCTIVE_SURFACE, type DataUrlSource, DayChips, DiffEditor, type DiffEditorProps, type DisabledWhenRule, Editor, type EditorContextValue, type EditorFile, type EditorOptions, type EditorProps, EditorProvider, type EditorRef, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorFallbackProps, ErrorListTemplate, FieldTemplate, type Focusable, type HLSSource, HOTKEYS, type HistoryPage, type HttpTransportConfig, type ImageFile, ImageViewer, type ImageViewerProps, type JsonFormContext, type JsonFormDensity, JsonSchemaForm, type JsonSchemaFormProps, JsonTreeComponent as JsonTree, type JsonTreeConfig, type JsonTreeProps, JumpToLatest, type JumpToLatestProps, LIMITS, LazyPlayer as LazyAudioPlayer, LazyChat, type ChatRootProps as LazyChatProps, LazyCronScheduler, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyTree, TreeRootProps as LazyTreeProps, LazyVideoPlayer, LazyWrapper, type LazyWrapperProps, type LinkRule, LoadingFallback, type LoadingFallbackProps, type LottieDirection, LottiePlayer, type LottiePlayerProps, type LottieSize, type LottieSpeed, type MapContainerProps, MapLoadingFallback, type MapStyleKey, type MapViewport, MarkdownEditor, type MarkdownEditorProps, MarkdownMessage, type MarkdownMessageProps, type MarkerData, type MentionAttrs, type MentionConfig, type MentionItem, type MentionMarkdownRenderer, Mermaid, type MermaidProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageList, type MessageListHandle, type MessageListProps, type MockTransportOptions, type MonthDay, MonthDayGrid, NativeProvider, NumberWidget, ObjectFieldTemplate, Playground as OpenapiViewer, type ParseSSEOptions, type PlayerMode, type PlaygroundConfig, type PlaygroundProps$1 as PlaygroundProps, PrettyCode, type PrettyCodeProps$1 as PrettyCodeProps, type PydanticAIChatTransportOpts, type PydanticAIEvent, type ResolveFileSourceOptions, STORAGE_KEYS, SchedulePreview, type ScheduleType, ScheduleTypeSelector, type SchemaSource, SelectWidget, type SendOptions, type SessionInfo, type SimpleStreamSource, SliderWidget, Sources, type SourcesProps, Spinner, type StreamOptions, StreamProvider, type StreamSource, StreamingIndicator, type StreamingIndicatorProps, SwitchWidget, TOGGLE, TOOL_CALL, TextWidget, TimeSelector, type TokenBuffer, ToolCalls, type ToolCallsProps, type ToolIdQueue, type ToolPayloadFallback, type ToolPayloadKind, type ToolPayloadMatcher, TransportError, TreeRootProps, type UiGroup, type UrlSource, type UseAutoFocusOnStreamEndOptions, type UseChatAudioReturn, type UseChatComposerOptions, type UseChatComposerReturn, type UseChatConfig, type UseChatDockPrefsOptions, type UseChatDockPrefsReturn, type UseChatHistoryOptions, type UseChatLayoutConfig, type UseChatLayoutReturn, type UseChatLightboxReturn, type UseChatResetOptions, type UseChatResetReturn, type UseChatReturn, type UseChatScrollOptions, type UseChatScrollReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseFocusOnEmptyClickOptions, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, type UseVisitorFingerprintOptions, VideoControls, VideoErrorFallback, type VideoErrorFallbackProps, VideoPlayer, type VideoPlayerContextValue, type VideoPlayerProps, VideoPlayerProvider, type VideoPlayerProviderProps, type VideoPlayerRef, type VideoSourceUnion, VidstackProvider, type VimeoSource, type WeekDay, type YouTubeSource, buildCron, collectImageAttachments, createHttpTransport, createId, createLazyComponent, createMockTransport, createPydanticAIChatTransport, createPydanticAISSEMap, createTokenBuffer, createToolIdQueue, createVideoErrorFallback, deriveInitials, dispatchToolPayload, evaluateDisabledWhen, extractTextFromChildren, generateContentKey, getChatLogger, getRequiredFields, hasRequiredFields, humanizeCron, initialState, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isSimpleStreamSource, isStringValue, isSubmittableDraft, isValidCron, mapPydanticAIEvent, mentionPresets, mergeDefaults, normalizeFormData, parseCron, parseSSE, reducer, resolveFileSource, resolvePersona, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, sanitizeDraft, useAudioCache, useAutoFocusOnStreamEnd, useBlobUrlCleanup, useChat, useChatAudio, useChatAudioPrefs, useChatBubbleStyles, useChatComposer, useChatContext, useChatContextOptional, useChatDestructiveStyles, useChatDockPrefs, useChatHistory, useChatLayout, useChatLightbox, useChatPresence, useChatReset, useChatRoleStyles, useChatScroll, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useFocusOnEmptyClick, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useRegisterComposer, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, useVisitorFingerprint, validateRequiredFields, validateSchema };
|
|
4887
|
+
export { ANCHOR, type ApiKey, ArrayFieldItemTemplate, ArrayFieldTemplate, type AspectRatioValue, type AttachmentRenderer, type AttachmentRendererArgs, type AttachmentRendererMap, Attachments, AttachmentsGrid, type AttachmentsGridProps, AttachmentsList, type AttachmentsListProps, type AttachmentsProps, Player as AudioPlayer, type PlayerProps as AudioPlayerProps, AudioToggle, type AudioToggleProps, BUBBLE_SURFACE, BaseInputTemplate, type BlobSource, CHAT_EVENT_NAME, CSS_VARS, CardLoadingFallback, type ChatAction, type ChatAssistantContext, type ChatAttachment, type ChatAudioConfig, type ChatAudioEvent, type ChatAudioSounds, type ChatBubbleStyles, type ChatBubbleSurface, type ChatConfig, type ChatContextValue, type ChatDestructiveStyles, type ChatDisplayMode, ChatDock, type ChatDockMode, type ChatDockPrefs, type ChatDockProps, type ChatDockSide, type ChatEventDetail, ChatFAB, type ChatFABPosition, type ChatFABProps, type ChatFABSize, type ChatFABVariant, ChatGreeting, type ChatGreetingProps, ChatHeader, ChatHeaderActionButton, type ChatHeaderActionButtonProps, ChatHeaderAudioToggle, type ChatHeaderAudioToggleProps, ChatHeaderLanguageButton, type ChatHeaderLanguageButtonProps, ChatHeaderModeToggle, type ChatHeaderModeToggleProps, type ChatHeaderProps, ChatHeaderResetButton, type ChatHeaderResetButtonProps, type ChatLabels, ChatLauncher, type ChatLauncherGreeting, type ChatLauncherHotkey, type ChatLauncherProps, type ChatLightboxState, type ChatLogScope, type ChatLogger, type ChatMessage, type ChatPersona, type ChatPrefs, type ChatPresencePhase, ChatProvider, type ChatProviderProps, type ChatRole, type ChatRoleStyles, ChatRoot, type ChatRootProps, type ChatSource, type ChatState, type ChatStreamEvent, type ChatToolCall, type ChatTransport, ChatUnreadPreview, type ChatUnreadPreviewProps, type ChatUserContext, CheckboxWidget, ColorWidget, Composer, type ComposerProps, type CreateLazyComponentOptions, type CreateSessionOptions, type CreateVideoErrorFallbackOptions, CronScheduler, type CronSchedulerContextValue, type CronSchedulerProps, CronSchedulerProvider, type CronSchedulerState, CustomInput, type DASHSource, DEFAULT_CHAT_SOUNDS, DEFAULT_DOCK_PREFS, DEFAULT_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, DESTRUCTIVE_SURFACE, type DataUrlSource, DayChips, DiffEditor, type DiffEditorProps, type DisabledWhenRule, Editor, type EditorContextValue, type EditorFile, type EditorOptions, type EditorProps, EditorProvider, type EditorRef, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorFallbackProps, ErrorListTemplate, FieldTemplate, type Focusable, type HLSSource, HOTKEYS, type HistoryPage, type HttpTransportConfig, type ImageFile, ImageViewer, type ImageViewerProps, type JsonFormContext, type JsonFormDensity, JsonSchemaForm, type JsonSchemaFormProps, JsonTreeComponent as JsonTree, type JsonTreeConfig, type JsonTreeProps, JumpToLatest, type JumpToLatestProps, LIMITS, LazyPlayer as LazyAudioPlayer, LazyChat, type ChatRootProps as LazyChatProps, LazyCronScheduler, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyTree, TreeRootProps as LazyTreeProps, LazyVideoPlayer, LazyWrapper, type LazyWrapperProps, type LinkRule, LoadingFallback, type LoadingFallbackProps, type LottieDirection, LottiePlayer, type LottiePlayerProps, type LottieSize, type LottieSpeed, type MapContainerProps, MapLoadingFallback, type MapStyleKey, type MapViewport, MarkdownEditor, type MarkdownEditorProps, MarkdownMessage, type MarkdownMessageProps, type MarkerData, type MentionAttrs, type MentionConfig, type MentionItem, type MentionMarkdownRenderer, Mermaid, type MermaidProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageList, type MessageListHandle, type MessageListProps, type MockTransportOptions, type MonthDay, MonthDayGrid, NativeProvider, NumberWidget, ObjectFieldTemplate, Playground as OpenapiViewer, type ParseSSEOptions, type PlayerMode, type PlaygroundConfig, type PlaygroundProps$1 as PlaygroundProps, PrettyCode, type PrettyCodeProps$1 as PrettyCodeProps, type PydanticAIChatTransportOpts, type PydanticAIEvent, type ResolveFileSourceOptions, STORAGE_KEYS, SchedulePreview, type ScheduleType, ScheduleTypeSelector, type SchemaSource, SelectWidget, type SendOptions, type SessionInfo, type SimpleStreamSource, SliderWidget, Sources, type SourcesProps, Spinner, type StreamOptions, StreamProvider, type StreamSource, StreamingIndicator, type StreamingIndicatorProps, SwitchWidget, TOGGLE, TOOL_CALL, TextWidget, TimeSelector, type TokenBuffer, ToolCalls, type ToolCallsProps, type ToolIdQueue, type ToolPayloadFallback, type ToolPayloadKind, type ToolPayloadMatcher, TransportError, TreeRootProps, type UiGroup, type UrlSource, type UseAutoFocusOnStreamEndOptions, type UseChatAudioReturn, type UseChatComposerOptions, type UseChatComposerReturn, type UseChatConfig, type UseChatDockPrefsOptions, type UseChatDockPrefsReturn, type UseChatHistoryOptions, type UseChatLayoutConfig, type UseChatLayoutReturn, type UseChatLightboxReturn, type UseChatResetOptions, type UseChatResetReturn, type UseChatReturn, type UseChatScrollOptions, type UseChatScrollReturn, type UseChatUnreadOptions, type UseChatUnreadReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseFocusOnEmptyClickOptions, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, type UseVisitorFingerprintOptions, VideoControls, VideoErrorFallback, type VideoErrorFallbackProps, VideoPlayer, type VideoPlayerContextValue, type VideoPlayerProps, VideoPlayerProvider, type VideoPlayerProviderProps, type VideoPlayerRef, type VideoSourceUnion, VidstackProvider, type VimeoSource, type WeekDay, type YouTubeSource, buildCron, collectImageAttachments, createHttpTransport, createId, createLazyComponent, createMockTransport, createPydanticAIChatTransport, createPydanticAISSEMap, createTokenBuffer, createToolIdQueue, createVideoErrorFallback, deriveInitials, dispatchToolPayload, evaluateDisabledWhen, extractTextFromChildren, generateContentKey, getChatLogger, getRequiredFields, hasRequiredFields, humanizeCron, initialState, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isSimpleStreamSource, isStringValue, isSubmittableDraft, isValidCron, mapPydanticAIEvent, mentionPresets, mergeDefaults, normalizeFormData, parseCron, parseSSE, reducer, resolveFileSource, resolvePersona, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, sanitizeDraft, useAudioCache, useAutoFocusOnStreamEnd, useBlobUrlCleanup, useChat, useChatAudio, useChatAudioPrefs, useChatBubbleStyles, useChatComposer, useChatContext, useChatContextOptional, useChatDestructiveStyles, useChatDockPrefs, useChatHistory, useChatLayout, useChatLightbox, useChatPresence, useChatReset, useChatRoleStyles, useChatScroll, useChatUnread, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useFocusOnEmptyClick, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useRegisterComposer, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, useVisitorFingerprint, validateRequiredFields, validateSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './chunk-
|
|
1
|
+
import { useSpeechPrefs, useResolvedLanguage } from './chunk-C2YN6WEO.mjs';
|
|
2
2
|
export { ArrayFieldItemTemplate, ArrayFieldTemplate, BaseInputTemplate, CheckboxWidget, ColorWidget, ErrorListTemplate, FieldTemplate, JsonSchemaForm, NumberWidget, ObjectFieldTemplate, SelectWidget, SliderWidget, SwitchWidget, TextWidget, evaluateDisabledWhen, getRequiredFields, hasRequiredFields, mergeDefaults, normalizeFormData, safeJsonParse, safeJsonStringify, validateRequiredFields, validateSchema } from './chunk-GYIO7W7M.mjs';
|
|
3
3
|
export { useLottie } from './chunk-ODO4GMW7.mjs';
|
|
4
4
|
export { Player as AudioPlayer } from './chunk-VWQ5WOIL.mjs';
|
|
@@ -6,7 +6,7 @@ export { NativeProvider, StreamProvider, VideoControls, VideoErrorFallback, Vide
|
|
|
6
6
|
export { ImageViewer } from './chunk-OBRSGM64.mjs';
|
|
7
7
|
export { generateContentKey, useAudioCache, useBlobUrlCleanup, useImageCache, useMediaCacheStore, useVideoCache, useVideoPlayerSettings } from './chunk-C6GXVH5J.mjs';
|
|
8
8
|
export { CronSchedulerProvider, CustomInput, DayChips, MonthDayGrid, SchedulePreview, ScheduleTypeSelector, TimeSelector, buildCron, humanizeCron, isValidCron, parseCron, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays } from './chunk-PVAX67JG.mjs';
|
|
9
|
-
import { LIMITS, createId, useChatContextOptional } from './chunk-UWVP6LCW.mjs';
|
|
9
|
+
import { LIMITS, createId, useChatContext, useChatContextOptional } from './chunk-UWVP6LCW.mjs';
|
|
10
10
|
export { Attachments, AttachmentsGrid, AttachmentsList, CHAT_EVENT_NAME, CSS_VARS, ChatProvider, ChatRoot, Composer, DEFAULT_CHAT_SOUNDS, DEFAULT_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, EmptyState, ErrorBanner, HOTKEYS, JumpToLatest, LIMITS, MessageActions, MessageBubble, MessageList, STORAGE_KEYS, Sources, StreamingIndicator, ToolCalls, createId, createTokenBuffer, deriveInitials, getChatLogger, initialState, isSubmittableDraft, reducer, resolvePersona, sanitizeDraft, useAutoFocusOnStreamEnd, useChat, useChatAudio, useChatBubbleStyles, useChatComposer, useChatContext, useChatContextOptional, useChatDestructiveStyles, useChatLayout, useChatRoleStyles, useFocusOnEmptyClick, useRegisterComposer } from './chunk-UWVP6LCW.mjs';
|
|
11
11
|
export { TreeError, TreeSkeleton, createDemoTree } from './chunk-B6IR5KSC.mjs';
|
|
12
12
|
export { DEFAULT_TREE_APPEARANCE, DEFAULT_TREE_LABELS, TreeRoot as Tree, TreeChevron, TreeContent, TreeEmpty, TreeIcon, TreeIndentGuides, TreeLabel, TreeProvider, TreeRoot, TreeRow, TreeSearchInput, appearanceToStyle, clearTreeState, createChildCache, flattenTree, loadTreeState, resolveAppearance, resolveChildren, saveTreeState, useTreeActions, useTreeContext, useTreeExpansion, useTreeFocus, useTreeKeyboard, useTreeLabels, useTreeRows, useTreeSearch, useTreeSelection, useTreeTypeAhead } from './chunk-ZL7FH4NW.mjs';
|
|
@@ -20,9 +20,9 @@ import { forwardRef, createContext, lazy, useRef, useState, useCallback, useImpe
|
|
|
20
20
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
21
21
|
import { useAppT } from '@djangocfg/i18n';
|
|
22
22
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
23
|
-
import { Bold, Italic, Strikethrough, Code, Heading1, Heading2, Heading3, List, ListOrdered, Quote, Minus, Bot, X, PanelRightClose, PanelRightOpen, VolumeX, Volume2, RotateCcw } from 'lucide-react';
|
|
23
|
+
import { Bold, Italic, Strikethrough, Code, Heading1, Heading2, Heading3, List, ListOrdered, Quote, Minus, Bot, X, PanelRightClose, PanelRightOpen, VolumeX, Volume2, RotateCcw, Globe } from 'lucide-react';
|
|
24
24
|
import { createAudioPrefsStore, useIsPhone, useIsTabletOrBelow, useIsMobile, useHotkey, useLocalStorage, useResolvedTheme } from '@djangocfg/ui-core/hooks';
|
|
25
|
-
import { Button, Portal, Avatar, AvatarImage, AvatarFallback } from '@djangocfg/ui-core/components';
|
|
25
|
+
import { Button, Portal, Combobox, Flag, Avatar, AvatarImage, AvatarFallback } from '@djangocfg/ui-core/components';
|
|
26
26
|
import { useEditor as useEditor$1, EditorContent, ReactRenderer } from '@tiptap/react';
|
|
27
27
|
import StarterKit from '@tiptap/starter-kit';
|
|
28
28
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
@@ -1607,9 +1607,30 @@ var WEB_SPEECH_LANGUAGES = [
|
|
|
1607
1607
|
WEB_SPEECH_LANGUAGES.flatMap(
|
|
1608
1608
|
(l) => l.dialects.map((d) => d.code)
|
|
1609
1609
|
);
|
|
1610
|
+
function findSpeechLanguage(tag) {
|
|
1611
|
+
if (!tag) return null;
|
|
1612
|
+
const lower = tag.toLowerCase();
|
|
1613
|
+
for (const language of WEB_SPEECH_LANGUAGES) {
|
|
1614
|
+
for (const dialect of language.dialects) {
|
|
1615
|
+
if (dialect.code.toLowerCase() === lower) return { language, dialect };
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
return null;
|
|
1619
|
+
}
|
|
1620
|
+
__name(findSpeechLanguage, "findSpeechLanguage");
|
|
1621
|
+
function countryFromTag(tag) {
|
|
1622
|
+
if (!tag) return null;
|
|
1623
|
+
const parts = tag.split("-");
|
|
1624
|
+
for (let i = parts.length - 1; i >= 0; i -= 1) {
|
|
1625
|
+
const p = parts[i];
|
|
1626
|
+
if (p.length === 2 && /^[A-Za-z]{2}$/.test(p)) return p.toUpperCase();
|
|
1627
|
+
}
|
|
1628
|
+
return null;
|
|
1629
|
+
}
|
|
1630
|
+
__name(countryFromTag, "countryFromTag");
|
|
1610
1631
|
createContext(null);
|
|
1611
1632
|
createLazyComponent(
|
|
1612
|
-
() => import('./DictationField-
|
|
1633
|
+
() => import('./DictationField-U25MEYAL.mjs').then((mod) => ({
|
|
1613
1634
|
default: mod.DictationField
|
|
1614
1635
|
})),
|
|
1615
1636
|
{
|
|
@@ -1617,6 +1638,93 @@ createLazyComponent(
|
|
|
1617
1638
|
fallback: /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-border/60 bg-card px-3 py-2 text-xs text-muted-foreground", children: "Loading dictation\u2026" })
|
|
1618
1639
|
}
|
|
1619
1640
|
);
|
|
1641
|
+
function ChatHeaderLanguageButton({
|
|
1642
|
+
ariaLabel = "Speech language",
|
|
1643
|
+
allowedTags,
|
|
1644
|
+
hideFallbackIcon,
|
|
1645
|
+
className
|
|
1646
|
+
}) {
|
|
1647
|
+
const prefs = useSpeechPrefs();
|
|
1648
|
+
const active = useResolvedLanguage();
|
|
1649
|
+
const options = useMemo(() => {
|
|
1650
|
+
const allow = allowedTags ? new Set(allowedTags) : null;
|
|
1651
|
+
const out = [];
|
|
1652
|
+
for (const lang of WEB_SPEECH_LANGUAGES) {
|
|
1653
|
+
for (const d of lang.dialects) {
|
|
1654
|
+
if (allow && !allow.has(d.code)) continue;
|
|
1655
|
+
out.push({
|
|
1656
|
+
value: d.code,
|
|
1657
|
+
// "Русский" / "Español — Argentina" / "English — United States"
|
|
1658
|
+
label: lang.dialects.length === 1 ? lang.name : `${lang.name} \u2014 ${d.region}`,
|
|
1659
|
+
// Search-only index: English name, BCP-47 tag, ISO, region.
|
|
1660
|
+
// Lets users type "russian" / "ru-RU" / "ru" / "argentina"
|
|
1661
|
+
// and still find the row regardless of native script.
|
|
1662
|
+
description: `${lang.englishName} ${d.code} ${lang.iso} ${d.region}`.toLowerCase()
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
return out;
|
|
1667
|
+
}, [allowedTags]);
|
|
1668
|
+
return /* @__PURE__ */ jsx(
|
|
1669
|
+
Combobox,
|
|
1670
|
+
{
|
|
1671
|
+
options,
|
|
1672
|
+
value: prefs.language ?? active,
|
|
1673
|
+
onValueChange: (v) => prefs.setLanguage(v || null),
|
|
1674
|
+
placeholder: ariaLabel,
|
|
1675
|
+
searchPlaceholder: "Search language\u2026",
|
|
1676
|
+
filterFunction: (opt, search) => {
|
|
1677
|
+
const s = search.toLowerCase();
|
|
1678
|
+
return opt.label.toLowerCase().includes(s) || opt.value.toLowerCase().includes(s) || (opt.description?.includes(s) ?? false);
|
|
1679
|
+
},
|
|
1680
|
+
contentClassName: "w-[280px]",
|
|
1681
|
+
contentStyle: { zIndex: 10001 },
|
|
1682
|
+
renderOption: (option) => {
|
|
1683
|
+
const country = countryFromTag(option.value);
|
|
1684
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
1685
|
+
country ? /* @__PURE__ */ jsx(
|
|
1686
|
+
Flag,
|
|
1687
|
+
{
|
|
1688
|
+
countryCode: country,
|
|
1689
|
+
className: "h-4 w-5 shrink-0 overflow-hidden rounded-[2px] border border-border/60 ring-1 ring-black/5"
|
|
1690
|
+
}
|
|
1691
|
+
) : /* @__PURE__ */ jsx(Globe, { className: "h-4 w-4 shrink-0 text-muted-foreground", "aria-hidden": true }),
|
|
1692
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-sm", children: option.label })
|
|
1693
|
+
] });
|
|
1694
|
+
},
|
|
1695
|
+
renderTrigger: (selected, open) => {
|
|
1696
|
+
const tag = selected?.value ?? active;
|
|
1697
|
+
const country = countryFromTag(tag);
|
|
1698
|
+
const found = findSpeechLanguage(tag);
|
|
1699
|
+
const tooltipLabel = found ? `${found.language.name}${found.language.dialects.length > 1 ? ` \u2014 ${found.dialect.region}` : ""} \xB7 ${tag}` : tag;
|
|
1700
|
+
return /* @__PURE__ */ jsx(
|
|
1701
|
+
"button",
|
|
1702
|
+
{
|
|
1703
|
+
type: "button",
|
|
1704
|
+
"aria-label": `${ariaLabel}: ${tooltipLabel}`,
|
|
1705
|
+
"aria-expanded": open,
|
|
1706
|
+
title: tooltipLabel,
|
|
1707
|
+
className: cn(
|
|
1708
|
+
"inline-flex h-7 w-7 items-center justify-center rounded-md",
|
|
1709
|
+
"text-muted-foreground transition-colors",
|
|
1710
|
+
"hover:bg-accent hover:text-foreground",
|
|
1711
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1712
|
+
className
|
|
1713
|
+
),
|
|
1714
|
+
children: country ? /* @__PURE__ */ jsx(
|
|
1715
|
+
Flag,
|
|
1716
|
+
{
|
|
1717
|
+
countryCode: country,
|
|
1718
|
+
className: "h-4 w-5 overflow-hidden rounded-[2px] border border-border/60 ring-1 ring-black/5"
|
|
1719
|
+
}
|
|
1720
|
+
) : hideFallbackIcon ? null : /* @__PURE__ */ jsx(Globe, { className: "h-3.5 w-3.5", "aria-hidden": true })
|
|
1721
|
+
}
|
|
1722
|
+
);
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
);
|
|
1726
|
+
}
|
|
1727
|
+
__name(ChatHeaderLanguageButton, "ChatHeaderLanguageButton");
|
|
1620
1728
|
function anchorStyle(position, fabOffset, fabClearance) {
|
|
1621
1729
|
const [vert, horiz] = position.split("-");
|
|
1622
1730
|
return { [vert]: fabClearance, [horiz]: fabOffset };
|
|
@@ -2186,6 +2294,33 @@ function useChatDockPrefs(opts = {}) {
|
|
|
2186
2294
|
return { ...prefs, setPrefs, toggleMode, toggleSide, reset };
|
|
2187
2295
|
}
|
|
2188
2296
|
__name(useChatDockPrefs, "useChatDockPrefs");
|
|
2297
|
+
function useChatUnread(opts = {}) {
|
|
2298
|
+
const { open = false, countRoles = ["assistant"] } = opts;
|
|
2299
|
+
const ctx = useChatContext();
|
|
2300
|
+
const [lastSeenId, setLastSeenId] = useState(null);
|
|
2301
|
+
const initialized = useRef(false);
|
|
2302
|
+
useEffect(() => {
|
|
2303
|
+
if (initialized.current) return;
|
|
2304
|
+
initialized.current = true;
|
|
2305
|
+
const tail = ctx.messages[ctx.messages.length - 1];
|
|
2306
|
+
setLastSeenId(tail?.id ?? null);
|
|
2307
|
+
}, [ctx.messages]);
|
|
2308
|
+
useEffect(() => {
|
|
2309
|
+
if (!open) return;
|
|
2310
|
+
const tail = ctx.messages[ctx.messages.length - 1];
|
|
2311
|
+
setLastSeenId(tail?.id ?? null);
|
|
2312
|
+
}, [open, ctx.messages]);
|
|
2313
|
+
const seenIdx = lastSeenId ? ctx.messages.findIndex((m) => m.id === lastSeenId) : -1;
|
|
2314
|
+
const after = seenIdx === -1 ? ctx.messages : ctx.messages.slice(seenIdx + 1);
|
|
2315
|
+
const inbound = after.filter((m) => countRoles.includes(m.role));
|
|
2316
|
+
const unread = inbound.length > 0 ? inbound[inbound.length - 1] : null;
|
|
2317
|
+
const markRead = useCallback(() => {
|
|
2318
|
+
const tail = ctx.messages[ctx.messages.length - 1];
|
|
2319
|
+
setLastSeenId(tail?.id ?? null);
|
|
2320
|
+
}, [ctx.messages]);
|
|
2321
|
+
return { unread, count: inbound.length, markRead };
|
|
2322
|
+
}
|
|
2323
|
+
__name(useChatUnread, "useChatUnread");
|
|
2189
2324
|
var STORAGE_KEY = "djangocfg-chat-audio:prefs";
|
|
2190
2325
|
var useChatAudioPrefs = createAudioPrefsStore(STORAGE_KEY);
|
|
2191
2326
|
|
|
@@ -3342,6 +3477,6 @@ function MarkdownToolbar({ editor }) {
|
|
|
3342
3477
|
}
|
|
3343
3478
|
__name(MarkdownToolbar, "MarkdownToolbar");
|
|
3344
3479
|
|
|
3345
|
-
export { AudioToggle, CardLoadingFallback, ChatDock, ChatFAB, ChatGreeting, ChatHeader, ChatHeaderActionButton, ChatHeaderAudioToggle, ChatHeaderModeToggle, ChatHeaderResetButton, ChatLauncher, ChatUnreadPreview, CronScheduler, DEFAULT_DOCK_PREFS, DiffEditor, Editor, EditorProvider, LazyPlayer as LazyAudioPlayer, LazyChat, LazyCronScheduler, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyTree, LazyVideoPlayer, LazyWrapper, LoadingFallback, LottiePlayer, MapLoadingFallback, MarkdownEditor, OpenapiViewer_default as OpenapiViewer, Spinner, TransportError, collectImageAttachments, createHttpTransport, createLazyComponent, createMockTransport, createPydanticAIChatTransport, createPydanticAISSEMap, createToolIdQueue, dispatchToolPayload, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isStringValue, mapPydanticAIEvent, mentionPresets, parseSSE, useChatAudioPrefs, useChatDockPrefs, useChatHistory, useChatLightbox, useChatPresence, useChatReset, useChatScroll, useEditor, useEditorContext, useLanguage, useMonaco, useVisitorFingerprint };
|
|
3480
|
+
export { AudioToggle, CardLoadingFallback, ChatDock, ChatFAB, ChatGreeting, ChatHeader, ChatHeaderActionButton, ChatHeaderAudioToggle, ChatHeaderLanguageButton, ChatHeaderModeToggle, ChatHeaderResetButton, ChatLauncher, ChatUnreadPreview, CronScheduler, DEFAULT_DOCK_PREFS, DiffEditor, Editor, EditorProvider, LazyPlayer as LazyAudioPlayer, LazyChat, LazyCronScheduler, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyTree, LazyVideoPlayer, LazyWrapper, LoadingFallback, LottiePlayer, MapLoadingFallback, MarkdownEditor, OpenapiViewer_default as OpenapiViewer, Spinner, TransportError, collectImageAttachments, createHttpTransport, createLazyComponent, createMockTransport, createPydanticAIChatTransport, createPydanticAISSEMap, createToolIdQueue, dispatchToolPayload, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isStringValue, mapPydanticAIEvent, mentionPresets, parseSSE, useChatAudioPrefs, useChatDockPrefs, useChatHistory, useChatLightbox, useChatPresence, useChatReset, useChatScroll, useChatUnread, useEditor, useEditorContext, useLanguage, useMonaco, useVisitorFingerprint };
|
|
3346
3481
|
//# sourceMappingURL=index.mjs.map
|
|
3347
3482
|
//# sourceMappingURL=index.mjs.map
|