@djangocfg/ui-tools 2.1.376 → 2.1.378
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/ChatRoot-EJC5Y2YM.cjs +14 -0
- package/dist/{ChatRoot-F5XXERXU.cjs.map → ChatRoot-EJC5Y2YM.cjs.map} +1 -1
- package/dist/ChatRoot-QOSKJPM6.mjs +5 -0
- package/dist/{ChatRoot-T7D7QRCH.mjs.map → ChatRoot-QOSKJPM6.mjs.map} +1 -1
- package/dist/{chunk-JXBEKSNT.mjs → chunk-QLMKCSR6.mjs} +50 -26
- package/dist/chunk-QLMKCSR6.mjs.map +1 -0
- package/dist/{chunk-UVIFD3TH.cjs → chunk-SI5RD2GD.cjs} +51 -25
- package/dist/chunk-SI5RD2GD.cjs.map +1 -0
- package/dist/index.cjs +102 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +103 -3
- package/dist/index.d.ts +103 -3
- package/dist/index.mjs +48 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/tools/Chat/Chat.story.tsx +101 -0
- package/src/tools/Chat/README.md +116 -1
- package/src/tools/Chat/components/ToolCalls.tsx +39 -12
- package/src/tools/Chat/hooks/useChatComposer.ts +41 -9
- package/src/tools/Chat/index.ts +5 -0
- package/src/tools/Chat/utils/sanitizeDraft.ts +72 -0
- package/src/tools/MarkdownEditor/MarkdownEditor.tsx +40 -0
- package/src/tools/MarkdownEditor/README.md +34 -0
- package/src/tools/MarkdownEditor/submitOnEnter.ts +67 -0
- package/dist/ChatRoot-F5XXERXU.cjs +0 -14
- package/dist/ChatRoot-T7D7QRCH.mjs +0 -5
- package/dist/chunk-JXBEKSNT.mjs.map +0 -1
- package/dist/chunk-UVIFD3TH.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1927,6 +1927,14 @@ interface UseChatComposerOptions {
|
|
|
1927
1927
|
* exactly as before. Plan64.
|
|
1928
1928
|
*/
|
|
1929
1929
|
persistKey?: string;
|
|
1930
|
+
/**
|
|
1931
|
+
* Skip pre-submit draft sanitation (trim + line-ending normalise +
|
|
1932
|
+
* zero-width strip). Default `false` — sanitation matches what
|
|
1933
|
+
* ChatGPT / Claude / Telegram ship and is what consumers want 99% of
|
|
1934
|
+
* the time. Set to `true` for niche flows that need byte-perfect
|
|
1935
|
+
* passthrough (clipboard inspector, raw-prompt debug tool).
|
|
1936
|
+
*/
|
|
1937
|
+
preserveExactValue?: boolean;
|
|
1930
1938
|
}
|
|
1931
1939
|
interface UseChatComposerReturn {
|
|
1932
1940
|
value: string;
|
|
@@ -2034,9 +2042,28 @@ interface ToolCallsProps {
|
|
|
2034
2042
|
renderStreaming?: (text: string, call: ChatToolCall) => ReactNode;
|
|
2035
2043
|
/** Single override for all three; specific renderers above take precedence. */
|
|
2036
2044
|
renderPayload?: (value: unknown, kind: ToolPayloadKind, call: ChatToolCall) => ReactNode;
|
|
2045
|
+
/**
|
|
2046
|
+
* Rendered once **after** all tool-call panels — always visible, outside
|
|
2047
|
+
* the collapsible panels. Use for rich UI derived from tool outputs (e.g.
|
|
2048
|
+
* vehicle cards, map pins, tax breakdowns). Receives the full calls array
|
|
2049
|
+
* so the renderer can aggregate across multiple tool calls.
|
|
2050
|
+
*/
|
|
2051
|
+
renderAfterCalls?: (calls: ChatToolCall[]) => ReactNode;
|
|
2052
|
+
/**
|
|
2053
|
+
* Custom renderer for each individual tool-call panel. When provided,
|
|
2054
|
+
* replaces the default collapsible `<ToolCallItem>`. Return `null` to
|
|
2055
|
+
* suppress a specific call while still letting others render.
|
|
2056
|
+
*/
|
|
2057
|
+
renderToolCall?: (call: ChatToolCall) => ReactNode;
|
|
2058
|
+
/**
|
|
2059
|
+
* When `true`, the collapsible tool-call panels are not rendered at all.
|
|
2060
|
+
* `renderAfterCalls` still runs — use together to show only rich UI with
|
|
2061
|
+
* no raw accordion panels visible.
|
|
2062
|
+
*/
|
|
2063
|
+
hideToolCalls?: boolean;
|
|
2037
2064
|
className?: string;
|
|
2038
2065
|
}
|
|
2039
|
-
declare function ToolCalls({ calls, defaultExpanded, expandWhileStreaming, renderInput, renderOutput, renderStreaming, renderPayload, className, }: ToolCallsProps): react_jsx_runtime.JSX.Element;
|
|
2066
|
+
declare function ToolCalls({ calls, defaultExpanded, expandWhileStreaming, renderInput, renderOutput, renderStreaming, renderPayload, renderAfterCalls, renderToolCall, hideToolCalls, className, }: ToolCallsProps): react_jsx_runtime.JSX.Element;
|
|
2040
2067
|
|
|
2041
2068
|
interface ChatRootProps {
|
|
2042
2069
|
transport: ChatTransport;
|
|
@@ -2425,6 +2452,60 @@ declare function isStringValue(v: unknown): v is string;
|
|
|
2425
2452
|
/** Walk the conversation and collect image attachments in chronological order. */
|
|
2426
2453
|
declare function collectImageAttachments(messages: ChatMessage[]): ChatAttachment[];
|
|
2427
2454
|
|
|
2455
|
+
/**
|
|
2456
|
+
* sanitizeDraft — minimal pre-submit cleanup for chat-composer drafts.
|
|
2457
|
+
*
|
|
2458
|
+
* Mirrors the conservative behaviour ChatGPT / Claude / Telegram
|
|
2459
|
+
* actually ship: clean the obvious junk the user didn't intend to
|
|
2460
|
+
* send, touch nothing that *could* be intentional.
|
|
2461
|
+
*
|
|
2462
|
+
* **What we DO touch:**
|
|
2463
|
+
*
|
|
2464
|
+
* 1. Trim leading/trailing whitespace (spaces, tabs, newlines,
|
|
2465
|
+
* NBSP). The user typing `\n\n hello \n` meant `hello`.
|
|
2466
|
+
* 2. Normalise line endings — `\r\n` / `\r` → `\n`. Pasted Windows
|
|
2467
|
+
* / old-mac text gets the same internal shape, so the LLM
|
|
2468
|
+
* tokeniser and markdown renderer see one canonical form.
|
|
2469
|
+
* 3. Strip zero-width / invisible characters that web-paste
|
|
2470
|
+
* smuggles in: ZWSP (U+200B), ZWNJ (U+200C), ZWJ (U+200D),
|
|
2471
|
+
* BOM / ZWNBSP (U+FEFF). They're invisible, break LLM
|
|
2472
|
+
* tokenisation, and the user never meant to type them.
|
|
2473
|
+
*
|
|
2474
|
+
* **What we DO NOT touch (and why):**
|
|
2475
|
+
*
|
|
2476
|
+
* - **Internal whitespace runs** (3+ spaces, tabs, blank lines).
|
|
2477
|
+
* Code indentation depends on these. ChatGPT preserves them as
|
|
2478
|
+
* typed — " if (x):\n return" stays four-space-indented.
|
|
2479
|
+
* Collapsing them is the path to subtly broken code snippets.
|
|
2480
|
+
*
|
|
2481
|
+
* - **Bidi override marks** (U+200E LRM, U+200F RLM, U+202A..U+202E).
|
|
2482
|
+
* Legitimately used in Arabic / Hebrew / mixed-direction text.
|
|
2483
|
+
* Stripping silently breaks RTL users. If a specific deployment
|
|
2484
|
+
* wants to block them as a security measure, do it at that layer
|
|
2485
|
+
* with explicit user-visible feedback.
|
|
2486
|
+
*
|
|
2487
|
+
* - **Tabs vs spaces** beyond rule 1. Could be either code or
|
|
2488
|
+
* prose; without parsing markdown we can't tell.
|
|
2489
|
+
*
|
|
2490
|
+
* - **Emoji, mentions, URLs, code spans** — passthrough text.
|
|
2491
|
+
*
|
|
2492
|
+
* The function is intentionally tiny — every rule earns its keep
|
|
2493
|
+
* with a concrete "user pasted X from Y, got nonsense" story.
|
|
2494
|
+
*
|
|
2495
|
+
* **Idempotent**: `sanitizeDraft(sanitizeDraft(x)) === sanitizeDraft(x)`.
|
|
2496
|
+
*/
|
|
2497
|
+
declare function sanitizeDraft(input: string): string;
|
|
2498
|
+
/**
|
|
2499
|
+
* Convenience predicate: true when the draft is non-empty AFTER
|
|
2500
|
+
* sanitation. Use to gate Send buttons / Enter submits so an empty
|
|
2501
|
+
* or whitespace-only draft never produces a real message.
|
|
2502
|
+
*
|
|
2503
|
+
* Cheaper than sanitizeDraft(input).length > 0 only marginally —
|
|
2504
|
+
* we still allocate the cleaned string. Kept as a named helper for
|
|
2505
|
+
* call-site clarity.
|
|
2506
|
+
*/
|
|
2507
|
+
declare function isSubmittableDraft(input: string): boolean;
|
|
2508
|
+
|
|
2428
2509
|
/**
|
|
2429
2510
|
* Chat dev logger.
|
|
2430
2511
|
*
|
|
@@ -3466,8 +3547,27 @@ interface MarkdownEditorProps {
|
|
|
3466
3547
|
mentions?: MentionConfig;
|
|
3467
3548
|
/** Called when mentioned IDs change */
|
|
3468
3549
|
onMentionIdsChange?: (ids: string[]) => void;
|
|
3550
|
+
/**
|
|
3551
|
+
* Called when the user presses Enter (without Shift, no IME
|
|
3552
|
+
* composition, no mention popover open). When set, Enter submits
|
|
3553
|
+
* and Shift+Enter inserts a newline — ChatGPT / Telegram chat
|
|
3554
|
+
* behaviour. When omitted, Enter behaves as Tiptap default
|
|
3555
|
+
* (HardBreak).
|
|
3556
|
+
*
|
|
3557
|
+
* Implementation lives in `submitOnEnter.ts` — it's a Tiptap
|
|
3558
|
+
* keymap extension, NOT a React wrapper handler. Wrapper-level
|
|
3559
|
+
* onKeyDown fires AFTER ProseMirror's keymap commits HardBreak in
|
|
3560
|
+
* the same tick; routing through the extension lets us intercept
|
|
3561
|
+
* before HardBreak runs.
|
|
3562
|
+
*
|
|
3563
|
+
* Return value (optional): truthy / undefined = consume the key
|
|
3564
|
+
* (default). Return `false` from onSubmit to let Tiptap fall
|
|
3565
|
+
* through to HardBreak — useful for guards like "don't submit an
|
|
3566
|
+
* empty draft".
|
|
3567
|
+
*/
|
|
3568
|
+
onSubmit?: () => boolean | void;
|
|
3469
3569
|
}
|
|
3470
|
-
declare function MarkdownEditor({ value, onChange, placeholder, minHeight, className, disabled, showToolbar, mentions, onMentionIdsChange, }: MarkdownEditorProps): react_jsx_runtime.JSX.Element;
|
|
3570
|
+
declare function MarkdownEditor({ value, onChange, placeholder, minHeight, className, disabled, showToolbar, mentions, onMentionIdsChange, onSubmit, }: MarkdownEditorProps): react_jsx_runtime.JSX.Element;
|
|
3471
3571
|
|
|
3472
3572
|
/**
|
|
3473
3573
|
* Built-in serializers for the `MentionConfig.renderMarkdown` callback.
|
|
@@ -3676,4 +3776,4 @@ declare function useBlobUrlCleanup(key: string | null): void;
|
|
|
3676
3776
|
*/
|
|
3677
3777
|
declare function generateContentKey(content: ArrayBuffer): string;
|
|
3678
3778
|
|
|
3679
|
-
export { 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, BaseInputTemplate, type BlobSource, CHAT_EVENT_NAME, CSS_VARS, CardLoadingFallback, type ChatAction, type ChatAssistantContext, type ChatAttachment, type ChatAudioConfig, type ChatAudioEvent, type ChatAudioSounds, type ChatConfig, type ChatContextValue, type ChatDisplayMode, type ChatEventDetail, type ChatLabels, type ChatLightboxState, type ChatLogScope, type ChatLogger, type ChatMessage, type ChatPersona, type ChatPrefs, ChatProvider, type ChatProviderProps, type ChatRole, ChatRoot, type ChatRootProps, type ChatSource, type ChatState, type ChatStreamEvent, type ChatToolCall, type ChatTransport, 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_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, 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 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, TextWidget, TimeSelector, type TokenBuffer, ToolCalls, type ToolCallsProps, type ToolPayloadFallback, type ToolPayloadKind, type ToolPayloadMatcher, TransportError, TreeRootProps, type UiGroup, type UrlSource, type UseAutoFocusOnStreamEndOptions, type UseChatAudioReturn, type UseChatComposerOptions, type UseChatComposerReturn, type UseChatConfig, type UseChatHistoryOptions, type UseChatLayoutConfig, type UseChatLayoutReturn, type UseChatLightboxReturn, type UseChatReturn, type UseChatScrollOptions, type UseChatScrollReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, 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, createTokenBuffer, createVideoErrorFallback, deriveInitials, dispatchToolPayload, evaluateDisabledWhen, extractTextFromChildren, generateContentKey, getChatLogger, getRequiredFields, hasRequiredFields, humanizeCron, initialState, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isSimpleStreamSource, isStringValue, isValidCron, mentionPresets, mergeDefaults, normalizeFormData, parseCron, parseSSE, reducer, resolveFileSource, resolvePersona, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, useAudioCache, useAutoFocusOnStreamEnd, useBlobUrlCleanup, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatHistory, useChatLayout, useChatLightbox, useChatScroll, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useRegisterComposer, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, validateRequiredFields, validateSchema };
|
|
3779
|
+
export { 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, BaseInputTemplate, type BlobSource, CHAT_EVENT_NAME, CSS_VARS, CardLoadingFallback, type ChatAction, type ChatAssistantContext, type ChatAttachment, type ChatAudioConfig, type ChatAudioEvent, type ChatAudioSounds, type ChatConfig, type ChatContextValue, type ChatDisplayMode, type ChatEventDetail, type ChatLabels, type ChatLightboxState, type ChatLogScope, type ChatLogger, type ChatMessage, type ChatPersona, type ChatPrefs, ChatProvider, type ChatProviderProps, type ChatRole, ChatRoot, type ChatRootProps, type ChatSource, type ChatState, type ChatStreamEvent, type ChatToolCall, type ChatTransport, 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_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, 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 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, TextWidget, TimeSelector, type TokenBuffer, ToolCalls, type ToolCallsProps, type ToolPayloadFallback, type ToolPayloadKind, type ToolPayloadMatcher, TransportError, TreeRootProps, type UiGroup, type UrlSource, type UseAutoFocusOnStreamEndOptions, type UseChatAudioReturn, type UseChatComposerOptions, type UseChatComposerReturn, type UseChatConfig, type UseChatHistoryOptions, type UseChatLayoutConfig, type UseChatLayoutReturn, type UseChatLightboxReturn, type UseChatReturn, type UseChatScrollOptions, type UseChatScrollReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, 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, createTokenBuffer, createVideoErrorFallback, deriveInitials, dispatchToolPayload, evaluateDisabledWhen, extractTextFromChildren, generateContentKey, getChatLogger, getRequiredFields, hasRequiredFields, humanizeCron, initialState, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isSimpleStreamSource, isStringValue, isSubmittableDraft, isValidCron, mentionPresets, mergeDefaults, normalizeFormData, parseCron, parseSSE, reducer, resolveFileSource, resolvePersona, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, sanitizeDraft, useAudioCache, useAutoFocusOnStreamEnd, useBlobUrlCleanup, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatHistory, useChatLayout, useChatLightbox, useChatScroll, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useRegisterComposer, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, validateRequiredFields, validateSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -1927,6 +1927,14 @@ interface UseChatComposerOptions {
|
|
|
1927
1927
|
* exactly as before. Plan64.
|
|
1928
1928
|
*/
|
|
1929
1929
|
persistKey?: string;
|
|
1930
|
+
/**
|
|
1931
|
+
* Skip pre-submit draft sanitation (trim + line-ending normalise +
|
|
1932
|
+
* zero-width strip). Default `false` — sanitation matches what
|
|
1933
|
+
* ChatGPT / Claude / Telegram ship and is what consumers want 99% of
|
|
1934
|
+
* the time. Set to `true` for niche flows that need byte-perfect
|
|
1935
|
+
* passthrough (clipboard inspector, raw-prompt debug tool).
|
|
1936
|
+
*/
|
|
1937
|
+
preserveExactValue?: boolean;
|
|
1930
1938
|
}
|
|
1931
1939
|
interface UseChatComposerReturn {
|
|
1932
1940
|
value: string;
|
|
@@ -2034,9 +2042,28 @@ interface ToolCallsProps {
|
|
|
2034
2042
|
renderStreaming?: (text: string, call: ChatToolCall) => ReactNode;
|
|
2035
2043
|
/** Single override for all three; specific renderers above take precedence. */
|
|
2036
2044
|
renderPayload?: (value: unknown, kind: ToolPayloadKind, call: ChatToolCall) => ReactNode;
|
|
2045
|
+
/**
|
|
2046
|
+
* Rendered once **after** all tool-call panels — always visible, outside
|
|
2047
|
+
* the collapsible panels. Use for rich UI derived from tool outputs (e.g.
|
|
2048
|
+
* vehicle cards, map pins, tax breakdowns). Receives the full calls array
|
|
2049
|
+
* so the renderer can aggregate across multiple tool calls.
|
|
2050
|
+
*/
|
|
2051
|
+
renderAfterCalls?: (calls: ChatToolCall[]) => ReactNode;
|
|
2052
|
+
/**
|
|
2053
|
+
* Custom renderer for each individual tool-call panel. When provided,
|
|
2054
|
+
* replaces the default collapsible `<ToolCallItem>`. Return `null` to
|
|
2055
|
+
* suppress a specific call while still letting others render.
|
|
2056
|
+
*/
|
|
2057
|
+
renderToolCall?: (call: ChatToolCall) => ReactNode;
|
|
2058
|
+
/**
|
|
2059
|
+
* When `true`, the collapsible tool-call panels are not rendered at all.
|
|
2060
|
+
* `renderAfterCalls` still runs — use together to show only rich UI with
|
|
2061
|
+
* no raw accordion panels visible.
|
|
2062
|
+
*/
|
|
2063
|
+
hideToolCalls?: boolean;
|
|
2037
2064
|
className?: string;
|
|
2038
2065
|
}
|
|
2039
|
-
declare function ToolCalls({ calls, defaultExpanded, expandWhileStreaming, renderInput, renderOutput, renderStreaming, renderPayload, className, }: ToolCallsProps): react_jsx_runtime.JSX.Element;
|
|
2066
|
+
declare function ToolCalls({ calls, defaultExpanded, expandWhileStreaming, renderInput, renderOutput, renderStreaming, renderPayload, renderAfterCalls, renderToolCall, hideToolCalls, className, }: ToolCallsProps): react_jsx_runtime.JSX.Element;
|
|
2040
2067
|
|
|
2041
2068
|
interface ChatRootProps {
|
|
2042
2069
|
transport: ChatTransport;
|
|
@@ -2425,6 +2452,60 @@ declare function isStringValue(v: unknown): v is string;
|
|
|
2425
2452
|
/** Walk the conversation and collect image attachments in chronological order. */
|
|
2426
2453
|
declare function collectImageAttachments(messages: ChatMessage[]): ChatAttachment[];
|
|
2427
2454
|
|
|
2455
|
+
/**
|
|
2456
|
+
* sanitizeDraft — minimal pre-submit cleanup for chat-composer drafts.
|
|
2457
|
+
*
|
|
2458
|
+
* Mirrors the conservative behaviour ChatGPT / Claude / Telegram
|
|
2459
|
+
* actually ship: clean the obvious junk the user didn't intend to
|
|
2460
|
+
* send, touch nothing that *could* be intentional.
|
|
2461
|
+
*
|
|
2462
|
+
* **What we DO touch:**
|
|
2463
|
+
*
|
|
2464
|
+
* 1. Trim leading/trailing whitespace (spaces, tabs, newlines,
|
|
2465
|
+
* NBSP). The user typing `\n\n hello \n` meant `hello`.
|
|
2466
|
+
* 2. Normalise line endings — `\r\n` / `\r` → `\n`. Pasted Windows
|
|
2467
|
+
* / old-mac text gets the same internal shape, so the LLM
|
|
2468
|
+
* tokeniser and markdown renderer see one canonical form.
|
|
2469
|
+
* 3. Strip zero-width / invisible characters that web-paste
|
|
2470
|
+
* smuggles in: ZWSP (U+200B), ZWNJ (U+200C), ZWJ (U+200D),
|
|
2471
|
+
* BOM / ZWNBSP (U+FEFF). They're invisible, break LLM
|
|
2472
|
+
* tokenisation, and the user never meant to type them.
|
|
2473
|
+
*
|
|
2474
|
+
* **What we DO NOT touch (and why):**
|
|
2475
|
+
*
|
|
2476
|
+
* - **Internal whitespace runs** (3+ spaces, tabs, blank lines).
|
|
2477
|
+
* Code indentation depends on these. ChatGPT preserves them as
|
|
2478
|
+
* typed — " if (x):\n return" stays four-space-indented.
|
|
2479
|
+
* Collapsing them is the path to subtly broken code snippets.
|
|
2480
|
+
*
|
|
2481
|
+
* - **Bidi override marks** (U+200E LRM, U+200F RLM, U+202A..U+202E).
|
|
2482
|
+
* Legitimately used in Arabic / Hebrew / mixed-direction text.
|
|
2483
|
+
* Stripping silently breaks RTL users. If a specific deployment
|
|
2484
|
+
* wants to block them as a security measure, do it at that layer
|
|
2485
|
+
* with explicit user-visible feedback.
|
|
2486
|
+
*
|
|
2487
|
+
* - **Tabs vs spaces** beyond rule 1. Could be either code or
|
|
2488
|
+
* prose; without parsing markdown we can't tell.
|
|
2489
|
+
*
|
|
2490
|
+
* - **Emoji, mentions, URLs, code spans** — passthrough text.
|
|
2491
|
+
*
|
|
2492
|
+
* The function is intentionally tiny — every rule earns its keep
|
|
2493
|
+
* with a concrete "user pasted X from Y, got nonsense" story.
|
|
2494
|
+
*
|
|
2495
|
+
* **Idempotent**: `sanitizeDraft(sanitizeDraft(x)) === sanitizeDraft(x)`.
|
|
2496
|
+
*/
|
|
2497
|
+
declare function sanitizeDraft(input: string): string;
|
|
2498
|
+
/**
|
|
2499
|
+
* Convenience predicate: true when the draft is non-empty AFTER
|
|
2500
|
+
* sanitation. Use to gate Send buttons / Enter submits so an empty
|
|
2501
|
+
* or whitespace-only draft never produces a real message.
|
|
2502
|
+
*
|
|
2503
|
+
* Cheaper than sanitizeDraft(input).length > 0 only marginally —
|
|
2504
|
+
* we still allocate the cleaned string. Kept as a named helper for
|
|
2505
|
+
* call-site clarity.
|
|
2506
|
+
*/
|
|
2507
|
+
declare function isSubmittableDraft(input: string): boolean;
|
|
2508
|
+
|
|
2428
2509
|
/**
|
|
2429
2510
|
* Chat dev logger.
|
|
2430
2511
|
*
|
|
@@ -3466,8 +3547,27 @@ interface MarkdownEditorProps {
|
|
|
3466
3547
|
mentions?: MentionConfig;
|
|
3467
3548
|
/** Called when mentioned IDs change */
|
|
3468
3549
|
onMentionIdsChange?: (ids: string[]) => void;
|
|
3550
|
+
/**
|
|
3551
|
+
* Called when the user presses Enter (without Shift, no IME
|
|
3552
|
+
* composition, no mention popover open). When set, Enter submits
|
|
3553
|
+
* and Shift+Enter inserts a newline — ChatGPT / Telegram chat
|
|
3554
|
+
* behaviour. When omitted, Enter behaves as Tiptap default
|
|
3555
|
+
* (HardBreak).
|
|
3556
|
+
*
|
|
3557
|
+
* Implementation lives in `submitOnEnter.ts` — it's a Tiptap
|
|
3558
|
+
* keymap extension, NOT a React wrapper handler. Wrapper-level
|
|
3559
|
+
* onKeyDown fires AFTER ProseMirror's keymap commits HardBreak in
|
|
3560
|
+
* the same tick; routing through the extension lets us intercept
|
|
3561
|
+
* before HardBreak runs.
|
|
3562
|
+
*
|
|
3563
|
+
* Return value (optional): truthy / undefined = consume the key
|
|
3564
|
+
* (default). Return `false` from onSubmit to let Tiptap fall
|
|
3565
|
+
* through to HardBreak — useful for guards like "don't submit an
|
|
3566
|
+
* empty draft".
|
|
3567
|
+
*/
|
|
3568
|
+
onSubmit?: () => boolean | void;
|
|
3469
3569
|
}
|
|
3470
|
-
declare function MarkdownEditor({ value, onChange, placeholder, minHeight, className, disabled, showToolbar, mentions, onMentionIdsChange, }: MarkdownEditorProps): react_jsx_runtime.JSX.Element;
|
|
3570
|
+
declare function MarkdownEditor({ value, onChange, placeholder, minHeight, className, disabled, showToolbar, mentions, onMentionIdsChange, onSubmit, }: MarkdownEditorProps): react_jsx_runtime.JSX.Element;
|
|
3471
3571
|
|
|
3472
3572
|
/**
|
|
3473
3573
|
* Built-in serializers for the `MentionConfig.renderMarkdown` callback.
|
|
@@ -3676,4 +3776,4 @@ declare function useBlobUrlCleanup(key: string | null): void;
|
|
|
3676
3776
|
*/
|
|
3677
3777
|
declare function generateContentKey(content: ArrayBuffer): string;
|
|
3678
3778
|
|
|
3679
|
-
export { 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, BaseInputTemplate, type BlobSource, CHAT_EVENT_NAME, CSS_VARS, CardLoadingFallback, type ChatAction, type ChatAssistantContext, type ChatAttachment, type ChatAudioConfig, type ChatAudioEvent, type ChatAudioSounds, type ChatConfig, type ChatContextValue, type ChatDisplayMode, type ChatEventDetail, type ChatLabels, type ChatLightboxState, type ChatLogScope, type ChatLogger, type ChatMessage, type ChatPersona, type ChatPrefs, ChatProvider, type ChatProviderProps, type ChatRole, ChatRoot, type ChatRootProps, type ChatSource, type ChatState, type ChatStreamEvent, type ChatToolCall, type ChatTransport, 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_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, 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 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, TextWidget, TimeSelector, type TokenBuffer, ToolCalls, type ToolCallsProps, type ToolPayloadFallback, type ToolPayloadKind, type ToolPayloadMatcher, TransportError, TreeRootProps, type UiGroup, type UrlSource, type UseAutoFocusOnStreamEndOptions, type UseChatAudioReturn, type UseChatComposerOptions, type UseChatComposerReturn, type UseChatConfig, type UseChatHistoryOptions, type UseChatLayoutConfig, type UseChatLayoutReturn, type UseChatLightboxReturn, type UseChatReturn, type UseChatScrollOptions, type UseChatScrollReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, 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, createTokenBuffer, createVideoErrorFallback, deriveInitials, dispatchToolPayload, evaluateDisabledWhen, extractTextFromChildren, generateContentKey, getChatLogger, getRequiredFields, hasRequiredFields, humanizeCron, initialState, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isSimpleStreamSource, isStringValue, isValidCron, mentionPresets, mergeDefaults, normalizeFormData, parseCron, parseSSE, reducer, resolveFileSource, resolvePersona, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, useAudioCache, useAutoFocusOnStreamEnd, useBlobUrlCleanup, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatHistory, useChatLayout, useChatLightbox, useChatScroll, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useRegisterComposer, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, validateRequiredFields, validateSchema };
|
|
3779
|
+
export { 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, BaseInputTemplate, type BlobSource, CHAT_EVENT_NAME, CSS_VARS, CardLoadingFallback, type ChatAction, type ChatAssistantContext, type ChatAttachment, type ChatAudioConfig, type ChatAudioEvent, type ChatAudioSounds, type ChatConfig, type ChatContextValue, type ChatDisplayMode, type ChatEventDetail, type ChatLabels, type ChatLightboxState, type ChatLogScope, type ChatLogger, type ChatMessage, type ChatPersona, type ChatPrefs, ChatProvider, type ChatProviderProps, type ChatRole, ChatRoot, type ChatRootProps, type ChatSource, type ChatState, type ChatStreamEvent, type ChatToolCall, type ChatTransport, 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_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, 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 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, TextWidget, TimeSelector, type TokenBuffer, ToolCalls, type ToolCallsProps, type ToolPayloadFallback, type ToolPayloadKind, type ToolPayloadMatcher, TransportError, TreeRootProps, type UiGroup, type UrlSource, type UseAutoFocusOnStreamEndOptions, type UseChatAudioReturn, type UseChatComposerOptions, type UseChatComposerReturn, type UseChatConfig, type UseChatHistoryOptions, type UseChatLayoutConfig, type UseChatLayoutReturn, type UseChatLightboxReturn, type UseChatReturn, type UseChatScrollOptions, type UseChatScrollReturn, type UseCollapsibleContentOptions, type UseCollapsibleContentResult, type UseEditorReturn, type UseLottieOptions, type UseLottieReturn, type UseMonacoReturn, 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, createTokenBuffer, createVideoErrorFallback, deriveInitials, dispatchToolPayload, evaluateDisabledWhen, extractTextFromChildren, generateContentKey, getChatLogger, getRequiredFields, hasRequiredFields, humanizeCron, initialState, isGeoJSONFeatureCollection, isLatLng, isPlainObject, isSimpleStreamSource, isStringValue, isSubmittableDraft, isValidCron, mentionPresets, mergeDefaults, normalizeFormData, parseCron, parseSSE, reducer, resolveFileSource, resolvePersona, resolvePlayerMode, resolveStreamSource, safeJsonParse, safeJsonStringify, sanitizeDraft, useAudioCache, useAutoFocusOnStreamEnd, useBlobUrlCleanup, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatHistory, useChatLayout, useChatLightbox, useChatScroll, useCollapsibleContent, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays, useEditor, useEditorContext, useImageCache, useLanguage, useLottie, useMediaCacheStore, useMonaco, useRegisterComposer, useVideoCache, useVideoPlayerContext, useVideoPlayerSettings, validateRequiredFields, validateSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -5,8 +5,8 @@ export { NativeProvider, StreamProvider, VideoControls, VideoErrorFallback, Vide
|
|
|
5
5
|
export { ImageViewer } from './chunk-OBRSGM64.mjs';
|
|
6
6
|
export { generateContentKey, useAudioCache, useBlobUrlCleanup, useImageCache, useMediaCacheStore, useVideoCache, useVideoPlayerSettings } from './chunk-C6GXVH5J.mjs';
|
|
7
7
|
export { CronSchedulerProvider, CustomInput, DayChips, MonthDayGrid, SchedulePreview, ScheduleTypeSelector, TimeSelector, buildCron, humanizeCron, isValidCron, parseCron, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays } from './chunk-PVAX67JG.mjs';
|
|
8
|
-
import { LIMITS, createId, useChatContextOptional, useChatAudioPrefs } from './chunk-
|
|
9
|
-
export { Attachments, AttachmentsGrid, AttachmentsList, CHAT_EVENT_NAME, CSS_VARS, ChatProvider, ChatRoot, Composer, 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, reducer, resolvePersona, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatLayout } from './chunk-
|
|
8
|
+
import { LIMITS, createId, useChatContextOptional, useChatAudioPrefs } from './chunk-QLMKCSR6.mjs';
|
|
9
|
+
export { Attachments, AttachmentsGrid, AttachmentsList, CHAT_EVENT_NAME, CSS_VARS, ChatProvider, ChatRoot, Composer, 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, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatLayout } from './chunk-QLMKCSR6.mjs';
|
|
10
10
|
export { TreeError, TreeSkeleton, createDemoTree } from './chunk-B6IR5KSC.mjs';
|
|
11
11
|
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';
|
|
12
12
|
import { PlaygroundProvider } from './chunk-Y6UTOBF6.mjs';
|
|
@@ -28,6 +28,7 @@ import Placeholder from '@tiptap/extension-placeholder';
|
|
|
28
28
|
import Mention from '@tiptap/extension-mention';
|
|
29
29
|
import { Markdown } from '@tiptap/markdown';
|
|
30
30
|
import { autoUpdate, computePosition, offset, flip, shift } from '@floating-ui/dom';
|
|
31
|
+
import { Extension } from '@tiptap/core';
|
|
31
32
|
|
|
32
33
|
function Spinner({ className }) {
|
|
33
34
|
const t = useAppT();
|
|
@@ -348,7 +349,7 @@ var LazyTree = createLazyComponent(
|
|
|
348
349
|
}
|
|
349
350
|
);
|
|
350
351
|
var LazyChat = createLazyComponent(
|
|
351
|
-
() => import('./ChatRoot-
|
|
352
|
+
() => import('./ChatRoot-QOSKJPM6.mjs').then((m) => ({ default: m.ChatRoot })),
|
|
352
353
|
{
|
|
353
354
|
displayName: "LazyChat",
|
|
354
355
|
fallback: /* @__PURE__ */ jsx(LoadingFallback, { minHeight: 320, text: "Loading chat\u2026" })
|
|
@@ -1805,6 +1806,33 @@ var mentionPresets = {
|
|
|
1805
1806
|
/** Inline HTML span — for products that consume markdown with raw HTML allowed. */
|
|
1806
1807
|
htmlSpan: /* @__PURE__ */ __name((className = "mention") => ({ label, id }) => `<span class="${className}" data-mention-id="${encodeURIComponent(id)}">@${escapeMd(label || id)}</span>`, "htmlSpan")
|
|
1807
1808
|
};
|
|
1809
|
+
var SubmitOnEnter = Extension.create({
|
|
1810
|
+
name: "submitOnEnter",
|
|
1811
|
+
addOptions() {
|
|
1812
|
+
return {
|
|
1813
|
+
// Default no-op — explicit consumer must override. We never
|
|
1814
|
+
// intercept Enter unless an onSubmit is wired, so leaving the
|
|
1815
|
+
// extension installed with no handler is safe.
|
|
1816
|
+
onSubmit: /* @__PURE__ */ __name(() => false, "onSubmit")
|
|
1817
|
+
};
|
|
1818
|
+
},
|
|
1819
|
+
addKeyboardShortcuts() {
|
|
1820
|
+
return {
|
|
1821
|
+
Enter: /* @__PURE__ */ __name(() => {
|
|
1822
|
+
if (typeof document !== "undefined" && document.querySelector(".markdown-mention-list")) {
|
|
1823
|
+
return false;
|
|
1824
|
+
}
|
|
1825
|
+
const result = this.options.onSubmit();
|
|
1826
|
+
return result !== false;
|
|
1827
|
+
}, "Enter"),
|
|
1828
|
+
// Shift+Enter — always insert a newline. Tiptap's StarterKit
|
|
1829
|
+
// already binds this to HardBreak; we re-bind to `false` (not
|
|
1830
|
+
// handled) so the chain falls through cleanly even if other
|
|
1831
|
+
// extensions try to grab Shift+Enter.
|
|
1832
|
+
"Shift-Enter": /* @__PURE__ */ __name(() => false, "Shift-Enter")
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1808
1836
|
function getMarkdown(editor) {
|
|
1809
1837
|
const storage = editor.storage.markdown;
|
|
1810
1838
|
if (!storage?.manager) return editor.getText();
|
|
@@ -1830,8 +1858,11 @@ function MarkdownEditor({
|
|
|
1830
1858
|
disabled = false,
|
|
1831
1859
|
showToolbar = true,
|
|
1832
1860
|
mentions,
|
|
1833
|
-
onMentionIdsChange
|
|
1861
|
+
onMentionIdsChange,
|
|
1862
|
+
onSubmit
|
|
1834
1863
|
}) {
|
|
1864
|
+
const onSubmitRef = useRef(onSubmit);
|
|
1865
|
+
onSubmitRef.current = onSubmit;
|
|
1835
1866
|
const isExternalUpdate = useRef(false);
|
|
1836
1867
|
const initialMentionsDefinedRef = useRef(mentions !== void 0);
|
|
1837
1868
|
const warnedRef = useRef(false);
|
|
@@ -1845,7 +1876,19 @@ function MarkdownEditor({
|
|
|
1845
1876
|
const exts = [
|
|
1846
1877
|
StarterKit.configure({ heading: { levels: [1, 2, 3] } }),
|
|
1847
1878
|
Placeholder.configure({ placeholder }),
|
|
1848
|
-
Markdown
|
|
1879
|
+
Markdown,
|
|
1880
|
+
// SubmitOnEnter — when the consumer wired an onSubmit, intercept
|
|
1881
|
+
// Enter at the keymap level (before StarterKit's HardBreak).
|
|
1882
|
+
// The extension calls through `onSubmitRef.current` so handler
|
|
1883
|
+
// identity changes don't require an editor rebuild. See
|
|
1884
|
+
// submitOnEnter.ts for the keymap-vs-wrapper-handler rationale.
|
|
1885
|
+
SubmitOnEnter.configure({
|
|
1886
|
+
onSubmit: /* @__PURE__ */ __name(() => {
|
|
1887
|
+
const h = onSubmitRef.current;
|
|
1888
|
+
if (!h) return false;
|
|
1889
|
+
return h();
|
|
1890
|
+
}, "onSubmit")
|
|
1891
|
+
})
|
|
1849
1892
|
];
|
|
1850
1893
|
if (mentions) {
|
|
1851
1894
|
const renderMarkdown = mentions.renderMarkdown ?? mentionPresets.plainAt;
|