@assistant-ui/react-native 0.1.27 → 0.1.29
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/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +8 -0
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/thread.d.ts +3 -3
- package/dist/primitives/thread.js +4 -3
- package/dist/primitives/thread.js.map +1 -1
- package/package.json +11 -7
- package/src/index.ts +32 -0
- package/src/primitives/attachment/AttachmentName.test.tsx +55 -0
- package/src/primitives/attachment/AttachmentRemove.test.tsx +81 -0
- package/src/primitives/attachment/AttachmentThumb.test.tsx +75 -0
- package/src/primitives/branchPicker/BranchPickerCount.test.tsx +55 -0
- package/src/primitives/branchPicker/BranchPickerNext.test.tsx +97 -0
- package/src/primitives/branchPicker/BranchPickerNumber.test.tsx +56 -0
- package/src/primitives/branchPicker/BranchPickerPrevious.test.tsx +100 -0
- package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.test.tsx +85 -0
- package/src/primitives/composer/ComposerAddAttachment.test.tsx +136 -0
- package/src/primitives/composer/ComposerCancel.test.tsx +116 -0
- package/src/primitives/composer/ComposerInput.test.tsx +253 -0
- package/src/primitives/composer/ComposerInput.tsx +12 -0
- package/src/primitives/composer/ComposerSend.test.tsx +116 -0
- package/src/primitives/error/ErrorMessage.test.tsx +64 -0
- package/src/primitives/error/ErrorRoot.test.tsx +65 -0
- package/src/primitives/message/MessageContent.test.tsx +278 -0
- package/src/primitives/message/MessageIf.test.tsx +156 -0
- package/src/primitives/suggestion/SuggestionDescription.test.tsx +61 -0
- package/src/primitives/suggestion/SuggestionTitle.test.tsx +61 -0
- package/src/primitives/suggestion/SuggestionTrigger.test.tsx +144 -0
- package/src/primitives/thread/ThreadEmpty.test.tsx +56 -0
- package/src/primitives/thread/ThreadIf.test.tsx +121 -0
- package/src/primitives/thread/ThreadMessages.test.tsx +192 -0
- package/src/primitives/thread.ts +1 -0
- package/src/primitives/threadList/ThreadListNew.test.tsx +72 -0
- package/src/primitives/threadListItem/ThreadListItemArchive.test.tsx +72 -0
- package/src/primitives/threadListItem/ThreadListItemDelete.test.tsx +72 -0
- package/src/primitives/threadListItem/ThreadListItemTrigger.test.tsx +72 -0
- package/src/primitives/threadListItem/ThreadListItemUnarchive.test.tsx +72 -0
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ import { threadListItem_d_exports } from "./primitives/threadListItem.js";
|
|
|
13
13
|
import { chainOfThought_d_exports } from "./primitives/chainOfThought.js";
|
|
14
14
|
import { suggestion_d_exports } from "./primitives/suggestion.js";
|
|
15
15
|
import { index_d_exports } from "./primitives/error/index.js";
|
|
16
|
-
import { AppendMessage, AssistantRuntime, Attachment, AttachmentAdapter, AttachmentRuntime, ChatModelAdapter, ChatModelRunOptions, ChatModelRunResult, CompleteAttachment, ComposerRuntime, CompositeAttachmentAdapter, CreateAttachment, DataMessagePart, EditComposerRuntime, ExportedMessageRepository, ExportedMessageRepositoryItem, FeedbackAdapter, FileMessagePart, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, MessageRole, MessageRuntime, MessageStatus, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PendingAttachment, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, RemoteThreadListOptions, RespondToToolApprovalOptions, RunConfig, RuntimeCapabilities, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SourceMessagePart, SuggestionAdapter, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadComposerRuntime, ThreadHistoryAdapter, ThreadListItemRuntime, ThreadListRuntime, ThreadMessage, ThreadMessageLike, ThreadRuntime, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolApprovalOption, ToolApprovalOptionKind, ToolApprovalResponse, ToolCallMessagePart, ToolCallTiming, ToolModelContentPart, Unstable_AudioMessagePart, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, createVoiceSession, fromThreadMessageLike, generateId, mergeModelContexts, tool } from "@assistant-ui/core";
|
|
16
|
+
import { AppendMessage, AssistantRuntime, Attachment, AttachmentAdapter, AttachmentRuntime, ChatModelAdapter, ChatModelRunOptions, ChatModelRunResult, CompleteAttachment, ComposerRuntime, CompositeAttachmentAdapter, CreateAttachment, DataMessagePart, EditComposerRuntime, ExportedMessageRepository, ExportedMessageRepositoryItem, FeedbackAdapter, FileMessagePart, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, MessageRole, MessageRuntime, MessageStatus, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PendingAttachment, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, RemoteThreadListOptions, RespondToToolApprovalOptions, RunConfig, RuntimeCapabilities, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SourceMessagePart, SuggestionAdapter, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadComposerRuntime, ThreadHistoryAdapter, ThreadListItemRuntime, ThreadListRuntime, ThreadMessage, ThreadMessageLike, ThreadRuntime, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolApprovalOption, ToolApprovalOptionKind, ToolApprovalResponse, ToolCallMessagePart, ToolCallTiming, ToolModelContentPart, Unstable_AudioMessagePart, Unstable_InteractableSnapshotEntry, Unstable_InteractableVersion, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, createVoiceSession, fromThreadMessageLike, generateId, mergeModelContexts, tool, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
|
|
17
17
|
import { AssistantClient, AssistantEventCallback, AssistantEventName, AssistantEventPayload, AssistantEventScope, AssistantEventSelector, AssistantState, AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
|
|
18
|
-
import { AssistantContextConfig, AssistantDataUI, AssistantDataUIProps, AssistantInteractableProps, AssistantTool, AssistantToolProps, AssistantToolUI, AssistantToolUIProps, ChainOfThoughtByIndicesProvider, ChainOfThoughtPartByIndexProvider, DataMessagePartComponent, DataMessagePartProps, DataRenderers, EmptyMessagePartComponent, EmptyMessagePartProps, FileMessagePartComponent, FileMessagePartProps, GroupByContext, ImageMessagePartComponent, ImageMessagePartProps, Interactables, McpToolkitDefinition, MessageByIndexProvider, PartByIndexProvider, ProviderToolConfig, ReasoningGroupComponent, ReasoningGroupProps, ReasoningMessagePartComponent, ReasoningMessagePartProps, RuntimeAdapterProvider, RuntimeAdapters, SourceMessagePartComponent, SourceMessagePartProps, SuggestionByIndexProvider, TextMessagePartComponent, TextMessagePartProps, TextMessagePartProvider, ThreadListItemByIndexProvider, ToolArgsStatus, ToolCallMessagePartComponent, ToolCallMessagePartProps, ToolCallText, ToolDefinition, Toolkit, ToolkitDefinition, ToolkitDefinitionEntry, Tools, Unstable_AudioMessagePartComponent, Unstable_AudioMessagePartProps, defineMcpToolkit, defineToolkit, externalTool, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, providerTool, stubTool, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
|
|
18
|
+
import { AssistantContextConfig, AssistantDataUI, AssistantDataUIProps, AssistantInteractableProps, AssistantTool, AssistantToolProps, AssistantToolUI, AssistantToolUIProps, ChainOfThoughtByIndicesProvider, ChainOfThoughtPartByIndexProvider, ComposerAttachmentByIndexProvider, DataMessagePartComponent, DataMessagePartProps, DataRenderers, EmptyMessagePartComponent, EmptyMessagePartProps, FileMessagePartComponent, FileMessagePartProps, GroupByContext, ImageMessagePartComponent, ImageMessagePartProps, Interactables, McpToolkitDefinition, MessageAttachmentByIndexProvider, MessageByIndexProvider, PartByIndexProvider, ProviderToolConfig, ReasoningGroupComponent, ReasoningGroupProps, ReasoningMessagePartComponent, ReasoningMessagePartProps, RuntimeAdapterProvider, RuntimeAdapters, SourceMessagePartComponent, SourceMessagePartProps, SuggestionByIndexProvider, TextMessagePartComponent, TextMessagePartProps, TextMessagePartProvider, ThreadListItemByIndexProvider, ThreadListItemRuntimeProvider, ToolArgsStatus, ToolCallMessagePartComponent, ToolCallMessagePartProps, ToolCallText, ToolDefinition, Toolkit, ToolkitDefinition, ToolkitDefinitionEntry, Tools, Unstable_AudioMessagePartComponent, Unstable_AudioMessagePartProps, Unstable_InferInteractableState, Unstable_InteractableConfig, Unstable_InteractableDefinition, Unstable_InteractablePersistedState, Unstable_InteractablePersistenceAdapter, Unstable_InteractablePersistenceStatus, Unstable_InteractableRegistration, Unstable_InteractableStateSchema, Unstable_InteractableToolConfig, Unstable_InteractableToolRenderProps, Unstable_InteractableVersionInfo, Unstable_InteractablesClientSchema, Unstable_InteractablesConfig, Unstable_InteractablesMethods, Unstable_InteractablesState, defineMcpToolkit, defineToolkit, externalTool, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, providerTool, stubTool, unstable_Interactables, unstable_interactableTool, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useThreadMessageIds, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
|
|
19
19
|
import { AttachmentState, ChainOfThoughtClient, ComposerState, MessageState, ModelContext as ModelContextClient, SuggestionConfig, Suggestions, ThreadListItemState, ThreadState, ThreadsState } from "@assistant-ui/core/store";
|
|
20
20
|
import { Tool } from "assistant-stream";
|
|
21
|
-
export { actionBar_d_exports as ActionBarPrimitive, type AppendMessage, type AssistantClient, type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantEventCallback, type AssistantEventName, type AssistantEventPayload, type AssistantEventScope, type AssistantEventSelector, type AssistantInteractableProps, type AssistantRuntime, AssistantRuntimeProvider, type AssistantState, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type Attachment, type AttachmentAdapter, attachment_d_exports as AttachmentPrimitive, type AttachmentRuntime, type AttachmentState, AuiIf, AuiProvider, branchPicker_d_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, ChainOfThoughtPartByIndexProvider, chainOfThought_d_exports as ChainOfThoughtPrimitive, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type CompleteAttachment, composer_d_exports as ComposerPrimitive, type ComposerRuntime, type ComposerState, CompositeAttachmentAdapter, type CreateAttachment, type DataMessagePart, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, type EditComposerRuntime, type EmptyMessagePartComponent, type EmptyMessagePartProps, index_d_exports as ErrorPrimitive, ExportedMessageRepository, type ExportedMessageRepositoryItem, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type GroupByContext, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadListAdapter, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type McpToolkitDefinition, MessageByIndexProvider, message_d_exports as MessagePrimitive, type MessageRole, type MessageRuntime, type MessageState, type MessageStatus, type ModelContext, ModelContextClient, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, PartByIndexProvider, type PendingAttachment, type ProviderToolConfig, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, type RemoteThreadListAdapter, type RemoteThreadListOptions, type RespondToToolApprovalOptions, type RunConfig, RuntimeAdapterProvider, type RuntimeAdapters, type RuntimeCapabilities, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SuggestionAdapter, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, type ThreadListItemState, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadsState, type Tool, type ToolApprovalOption, type ToolApprovalOptionKind, type ToolApprovalResponse, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartProps, type ToolCallText, type ToolCallTiming, type ToolDefinition, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, mergeModelContexts, providerTool, stubTool, tool, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useInlineRender, useInteractableState, useLocalRuntime, useRemoteThreadListRuntime, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
|
|
21
|
+
export { actionBar_d_exports as ActionBarPrimitive, type AppendMessage, type AssistantClient, type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantEventCallback, type AssistantEventName, type AssistantEventPayload, type AssistantEventScope, type AssistantEventSelector, type AssistantInteractableProps, type AssistantRuntime, AssistantRuntimeProvider, type AssistantState, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type Attachment, type AttachmentAdapter, attachment_d_exports as AttachmentPrimitive, type AttachmentRuntime, type AttachmentState, AuiIf, AuiProvider, branchPicker_d_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, ChainOfThoughtPartByIndexProvider, chainOfThought_d_exports as ChainOfThoughtPrimitive, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type CompleteAttachment, ComposerAttachmentByIndexProvider, composer_d_exports as ComposerPrimitive, type ComposerRuntime, type ComposerState, CompositeAttachmentAdapter, type CreateAttachment, type DataMessagePart, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, type EditComposerRuntime, type EmptyMessagePartComponent, type EmptyMessagePartProps, index_d_exports as ErrorPrimitive, ExportedMessageRepository, type ExportedMessageRepositoryItem, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type GroupByContext, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadListAdapter, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type McpToolkitDefinition, MessageAttachmentByIndexProvider, MessageByIndexProvider, message_d_exports as MessagePrimitive, type MessageRole, type MessageRuntime, type MessageState, type MessageStatus, type ModelContext, ModelContextClient, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, PartByIndexProvider, type PendingAttachment, type ProviderToolConfig, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, type RemoteThreadListAdapter, type RemoteThreadListOptions, type RespondToToolApprovalOptions, type RunConfig, RuntimeAdapterProvider, type RuntimeAdapters, type RuntimeCapabilities, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SuggestionAdapter, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, ThreadListItemRuntimeProvider, type ThreadListItemState, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadsState, type Tool, type ToolApprovalOption, type ToolApprovalOptionKind, type ToolApprovalResponse, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartProps, type ToolCallText, type ToolCallTiming, type ToolDefinition, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_InferInteractableState, type Unstable_InteractableConfig, type Unstable_InteractableDefinition, type Unstable_InteractablePersistedState, type Unstable_InteractablePersistenceAdapter, type Unstable_InteractablePersistenceStatus, type Unstable_InteractableRegistration, type Unstable_InteractableSnapshotEntry, type Unstable_InteractableStateSchema, type Unstable_InteractableToolConfig, type Unstable_InteractableToolRenderProps, type Unstable_InteractableVersion, type Unstable_InteractableVersionInfo, type Unstable_InteractablesClientSchema, type Unstable_InteractablesConfig, type Unstable_InteractablesMethods, type Unstable_InteractablesState, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, mergeModelContexts, providerTool, stubTool, tool, unstable_Interactables, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions, unstable_interactableTool, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useThreadMessageIds, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useInlineRender, useInteractableState, useLocalRuntime, useRemoteThreadListRuntime, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ import { threadListItem_exports } from "./primitives/threadListItem.js";
|
|
|
12
12
|
import { chainOfThought_exports } from "./primitives/chainOfThought.js";
|
|
13
13
|
import { suggestion_exports } from "./primitives/suggestion.js";
|
|
14
14
|
import { error_exports } from "./primitives/error/index.js";
|
|
15
|
-
import { CompositeAttachmentAdapter, ExportedMessageRepository, InMemoryThreadListAdapter, ModelContextRegistry, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, createVoiceSession, fromThreadMessageLike, generateId, mergeModelContexts, tool } from "@assistant-ui/core";
|
|
15
|
+
import { CompositeAttachmentAdapter, ExportedMessageRepository, InMemoryThreadListAdapter, ModelContextRegistry, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, createVoiceSession, fromThreadMessageLike, generateId, mergeModelContexts, tool, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions } from "@assistant-ui/core";
|
|
16
16
|
import { AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
|
|
17
|
-
import { ChainOfThoughtByIndicesProvider, ChainOfThoughtPartByIndexProvider, DataRenderers, Interactables, MessageByIndexProvider, PartByIndexProvider, RuntimeAdapterProvider, SuggestionByIndexProvider, TextMessagePartProvider, ThreadListItemByIndexProvider, Tools, defineMcpToolkit, defineToolkit, externalTool, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, providerTool, stubTool, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
|
|
17
|
+
import { ChainOfThoughtByIndicesProvider, ChainOfThoughtPartByIndexProvider, ComposerAttachmentByIndexProvider, DataRenderers, Interactables, MessageAttachmentByIndexProvider, MessageByIndexProvider, PartByIndexProvider, RuntimeAdapterProvider, SuggestionByIndexProvider, TextMessagePartProvider, ThreadListItemByIndexProvider, ThreadListItemRuntimeProvider, Tools, defineMcpToolkit, defineToolkit, externalTool, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, providerTool, stubTool, unstable_Interactables, unstable_interactableTool, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useThreadMessageIds, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
|
|
18
18
|
import { ChainOfThoughtClient, ModelContext as ModelContextClient, Suggestions } from "@assistant-ui/core/store";
|
|
19
|
-
export { actionBar_exports as ActionBarPrimitive, AssistantRuntimeProvider, attachment_exports as AttachmentPrimitive, AuiIf, AuiProvider, branchPicker_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, ChainOfThoughtPartByIndexProvider, chainOfThought_exports as ChainOfThoughtPrimitive, composer_exports as ComposerPrimitive, CompositeAttachmentAdapter, DataRenderers, error_exports as ErrorPrimitive, ExportedMessageRepository, InMemoryThreadListAdapter, Interactables, MessageByIndexProvider, message_exports as MessagePrimitive, ModelContextClient, ModelContextRegistry, PartByIndexProvider, RuntimeAdapterProvider, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SuggestionByIndexProvider, suggestion_exports as SuggestionPrimitive, Suggestions, TextMessagePartProvider, ThreadListItemByIndexProvider, threadListItem_exports as ThreadListItemPrimitive, threadList_exports as ThreadListPrimitive, thread_exports as ThreadPrimitive, Tools, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, mergeModelContexts, providerTool, stubTool, tool, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useInlineRender, useInteractableState, useLocalRuntime, useRemoteThreadListRuntime, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
|
|
19
|
+
export { actionBar_exports as ActionBarPrimitive, AssistantRuntimeProvider, attachment_exports as AttachmentPrimitive, AuiIf, AuiProvider, branchPicker_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, ChainOfThoughtPartByIndexProvider, chainOfThought_exports as ChainOfThoughtPrimitive, ComposerAttachmentByIndexProvider, composer_exports as ComposerPrimitive, CompositeAttachmentAdapter, DataRenderers, error_exports as ErrorPrimitive, ExportedMessageRepository, InMemoryThreadListAdapter, Interactables, MessageAttachmentByIndexProvider, MessageByIndexProvider, message_exports as MessagePrimitive, ModelContextClient, ModelContextRegistry, PartByIndexProvider, RuntimeAdapterProvider, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SuggestionByIndexProvider, suggestion_exports as SuggestionPrimitive, Suggestions, TextMessagePartProvider, ThreadListItemByIndexProvider, threadListItem_exports as ThreadListItemPrimitive, ThreadListItemRuntimeProvider, threadList_exports as ThreadListPrimitive, thread_exports as ThreadPrimitive, Tools, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, fromThreadMessageLike, generateId, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, mergeModelContexts, providerTool, stubTool, tool, unstable_Interactables, unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions, unstable_interactableTool, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions, unstable_useThreadMessageIds, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useInlineRender, useInteractableState, useLocalRuntime, useRemoteThreadListRuntime, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerInput.d.ts","names":[],"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ComposerInput.d.ts","names":[],"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"mappings":";;;KAWY,kBAAA,GAAqB,IAAI,CACnC,cAAA;;AADF;;;;;EAUE,UAAA;AAAA;AAAA,cAeW,aAAA;EAAiB,UAAA;EAAA,UAAA,EAAA,cAAA;EAAA,aAAA;EAAA,KAAA;EAAA,GAAA;AAAA,GAM3B,kBAAA,qBAAkB,GAAA,CAAA,OAAA"}
|
|
@@ -3,6 +3,7 @@ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
|
3
3
|
import { Platform, TextInput } from "react-native";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useEffect, useRef } from "@assistant-ui/tap/react-shim";
|
|
6
|
+
import { flushTapSync } from "@assistant-ui/tap";
|
|
6
7
|
//#region src/primitives/composer/ComposerInput.tsx
|
|
7
8
|
const adjustWebTextareaHeight = (ref) => {
|
|
8
9
|
if (Platform.OS !== "web") return;
|
|
@@ -42,6 +43,12 @@ const ComposerInput = (t0) => {
|
|
|
42
43
|
let t2;
|
|
43
44
|
if ($[6] !== aui) {
|
|
44
45
|
t2 = (value) => {
|
|
46
|
+
if (Platform.OS === "web") {
|
|
47
|
+
flushTapSync(() => {
|
|
48
|
+
aui.composer().setText(value);
|
|
49
|
+
});
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
45
52
|
aui.composer().setText(value);
|
|
46
53
|
};
|
|
47
54
|
$[6] = aui;
|
|
@@ -69,6 +76,7 @@ const ComposerInput = (t0) => {
|
|
|
69
76
|
if (Platform.OS !== "web") return;
|
|
70
77
|
if (submitMode !== "enter") return;
|
|
71
78
|
const nativeEvent = e.nativeEvent;
|
|
79
|
+
if (nativeEvent.isComposing || nativeEvent.keyCode === 229) return;
|
|
72
80
|
if (nativeEvent.key === "Enter" && !nativeEvent.shiftKey) {
|
|
73
81
|
e.preventDefault?.();
|
|
74
82
|
aui.composer().send();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerInput.js","names":["useCallback","useEffect","useRef","Platform","TextInput","NativeSyntheticEvent","TextInputKeyPressEventData","TextInputProps","useAui","useAuiState","ComposerInputProps","Omit","submitMode","adjustWebTextareaHeight","ref","React","RefObject","OS","el","current","HTMLTextAreaElement","rows","style","overflow","height","scrollHeight","ComposerInput","t0","$","_c","numberOfLines","onKeyPressProp","props","t1","onKeyPress","undefined","aui","text","_temp","inputRef","t2","value","composer","setText","onChangeText","t3","Symbol","for","t4","t5","e","nativeEvent","shiftKey","key","Event","preventDefault","send","t6","t7","s"],"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef } from \"react\";\nimport {\n Platform,\n TextInput,\n type NativeSyntheticEvent,\n type TextInputKeyPressEventData,\n type TextInputProps,\n} from \"react-native\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport type ComposerInputProps = Omit<\n TextInputProps,\n \"value\" | \"onChangeText\"\n> & {\n /**\n * Controls how the Enter key submits messages (web only).\n * - \"enter\": Plain Enter submits (Shift+Enter for newline)\n * - \"none\": Enter inserts newline (no keyboard submission)\n * @default \"enter\"\n */\n submitMode?: \"enter\" | \"none\";\n};\n\nconst adjustWebTextareaHeight = (ref: React.RefObject<TextInput | null>) => {\n if (Platform.OS !== \"web\") return;\n // On web, the TextInput ref IS the DOM element\n const el = ref.current as unknown as HTMLTextAreaElement | null;\n if (!el) return;\n // Ensure rows=1 so scrollHeight reflects actual content\n if (el.rows !== 1) el.rows = 1;\n el.style.overflow = \"hidden\";\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight}px`;\n};\n\nexport const ComposerInput = ({\n submitMode = \"enter\",\n onKeyPress: onKeyPressProp,\n numberOfLines,\n style,\n ...props\n}: ComposerInputProps) => {\n const aui = useAui();\n const text = useAuiState((s) => s.composer.text);\n const inputRef = useRef<TextInput>(null);\n\n const onChangeText = useCallback(\n (value: string) => {\n aui.composer().setText(value);\n },\n [aui],\n );\n\n // Auto-resize textarea on web when text changes\n useEffect(() => {\n void text; // trigger re-run when text changes\n adjustWebTextareaHeight(inputRef);\n }, [text]);\n\n const onKeyPress = useCallback(\n (e: NativeSyntheticEvent<TextInputKeyPressEventData>) => {\n onKeyPressProp?.(e);\n\n if (Platform.OS !== \"web\") return;\n if (submitMode !== \"enter\") return;\n\n const nativeEvent = e.nativeEvent as TextInputKeyPressEventData & {\n shiftKey?: boolean;\n };\n if (nativeEvent.key === \"Enter\" && !nativeEvent.shiftKey) {\n (e as unknown as Event).preventDefault?.();\n aui.composer().send();\n }\n },\n [aui, submitMode, onKeyPressProp],\n );\n\n return (\n <TextInput\n ref={inputRef}\n value={text}\n onChangeText={onChangeText}\n onKeyPress={onKeyPress}\n numberOfLines={numberOfLines ?? (Platform.OS === \"web\" ? 1 : undefined)}\n style={style}\n {...props}\n />\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComposerInput.js","names":["useCallback","useEffect","useRef","Platform","TextInput","NativeSyntheticEvent","TextInputKeyPressEventData","TextInputProps","useAui","useAuiState","flushTapSync","ComposerInputProps","Omit","submitMode","adjustWebTextareaHeight","ref","React","RefObject","OS","el","current","HTMLTextAreaElement","rows","style","overflow","height","scrollHeight","ComposerInput","t0","$","_c","numberOfLines","onKeyPressProp","props","t1","onKeyPress","undefined","aui","text","_temp","inputRef","t2","value","composer","setText","onChangeText","t3","Symbol","for","t4","t5","e","nativeEvent","shiftKey","isComposing","keyCode","key","Event","preventDefault","send","t6","t7","s"],"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef } from \"react\";\nimport {\n Platform,\n TextInput,\n type NativeSyntheticEvent,\n type TextInputKeyPressEventData,\n type TextInputProps,\n} from \"react-native\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\nimport { flushTapSync } from \"@assistant-ui/tap\";\n\nexport type ComposerInputProps = Omit<\n TextInputProps,\n \"value\" | \"onChangeText\"\n> & {\n /**\n * Controls how the Enter key submits messages (web only).\n * - \"enter\": Plain Enter submits (Shift+Enter for newline)\n * - \"none\": Enter inserts newline (no keyboard submission)\n * @default \"enter\"\n */\n submitMode?: \"enter\" | \"none\";\n};\n\nconst adjustWebTextareaHeight = (ref: React.RefObject<TextInput | null>) => {\n if (Platform.OS !== \"web\") return;\n // On web, the TextInput ref IS the DOM element\n const el = ref.current as unknown as HTMLTextAreaElement | null;\n if (!el) return;\n // Ensure rows=1 so scrollHeight reflects actual content\n if (el.rows !== 1) el.rows = 1;\n el.style.overflow = \"hidden\";\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight}px`;\n};\n\nexport const ComposerInput = ({\n submitMode = \"enter\",\n onKeyPress: onKeyPressProp,\n numberOfLines,\n style,\n ...props\n}: ComposerInputProps) => {\n const aui = useAui();\n const text = useAuiState((s) => s.composer.text);\n const inputRef = useRef<TextInput>(null);\n\n const onChangeText = useCallback(\n (value: string) => {\n if (Platform.OS === \"web\") {\n // Keep the controlled value in sync mid-IME so react-dom does not reset the textarea to a stale value\n flushTapSync(() => {\n aui.composer().setText(value);\n });\n return;\n }\n aui.composer().setText(value);\n },\n [aui],\n );\n\n // Auto-resize textarea on web when text changes\n useEffect(() => {\n void text; // trigger re-run when text changes\n adjustWebTextareaHeight(inputRef);\n }, [text]);\n\n const onKeyPress = useCallback(\n (e: NativeSyntheticEvent<TextInputKeyPressEventData>) => {\n onKeyPressProp?.(e);\n\n if (Platform.OS !== \"web\") return;\n if (submitMode !== \"enter\") return;\n\n const nativeEvent = e.nativeEvent as TextInputKeyPressEventData & {\n shiftKey?: boolean;\n isComposing?: boolean;\n keyCode?: number;\n };\n // react-native-web forwards the raw DOM keydown before its own composition guard, so re-check it here (mirrors isEventComposing)\n if (nativeEvent.isComposing || nativeEvent.keyCode === 229) return;\n if (nativeEvent.key === \"Enter\" && !nativeEvent.shiftKey) {\n (e as unknown as Event).preventDefault?.();\n aui.composer().send();\n }\n },\n [aui, submitMode, onKeyPressProp],\n );\n\n return (\n <TextInput\n ref={inputRef}\n value={text}\n onChangeText={onChangeText}\n onKeyPress={onKeyPress}\n numberOfLines={numberOfLines ?? (Platform.OS === \"web\" ? 1 : undefined)}\n style={style}\n {...props}\n />\n );\n};\n"],"mappings":";;;;;;;AAwBA,MAAMc,2BAA2BC,QAA2C;CAC1E,IAAIZ,SAASe,OAAO,OAAO;CAE3B,MAAMC,KAAKJ,IAAIK;CACf,IAAI,CAACD,IAAI;CAET,IAAIA,GAAGG,SAAS,GAAGH,GAAGG,OAAO;CAC7BH,GAAGI,MAAMC,WAAW;CACpBL,GAAGI,MAAME,SAAS;CAClBN,GAAGI,MAAME,SAAS,GAAGN,GAAGO,aAAY;AACtC;AAEA,MAAaC,iBAAgBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAV;CAAA,IAAAW;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAf,YAAAqB,IAAAC,YAAAH,gBAAAD,eAAAR,UAAAU,SAAAL;EAMTC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAN;EAAAM,EAAA,KAAAK;CAAA,OAAA;EAAAH,gBAAAF,EAAA;EAAAG,iBAAAH,EAAA;EAAAI,QAAAJ,EAAA;EAAAN,QAAAM,EAAA;EAAAK,KAAAL,EAAA;CAAA;CALnB,MAAAhB,aAAAqB,OAAAE,KAAAA,IAAA,UAAAF;CAMA,MAAAG,MAAY7B,OAAO;CACnB,MAAA8B,OAAa7B,YAAY8B,KAAsB;CAC/C,MAAAC,WAAiBtC,OAAkB,IAAI;CAAE,IAAAuC;CAAA,IAAAZ,EAAA,OAAAQ,KAAA;EAGvCI,MAAAC,UAAA;GACE,IAAIvC,SAAQe,OAAQ,OAAK;IAEvBR,mBAAa;KACX2B,IAAGM,SAAU,CAAC,CAAAC,QAASF,KAAK;IAAC,CAC9B;IAAC;GAAA;GAGJL,IAAGM,SAAU,CAAC,CAAAC,QAASF,KAAK;EAAC;EAC9Bb,EAAA,KAAAQ;EAAAR,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAVH,MAAAgB,eAAqBJ;CAYnB,IAAAK;CAAA,IAAAjB,EAAA,OAAAkB,OAAAC,IAAA,2BAAA,GAAA;EAGQF,WAAA;GAERhC,wBAAwB0B,QAAQ;EAAC;EAClCX,EAAA,KAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,IAAAoB;CAAA,IAAApB,EAAA,OAAAS,MAAA;EAAEW,KAAA,CAACX,IAAI;EAACT,EAAA,KAAAS;EAAAT,EAAA,MAAAoB;CAAA,OAAAA,KAAApB,EAAA;CAHT5B,UAAU6C,IAGPG,EAAM;CAAC,IAAAC;CAAA,IAAArB,EAAA,QAAAQ,OAAAR,EAAA,QAAAG,kBAAAH,EAAA,QAAAhB,YAAA;EAGRqC,MAAAC,MAAA;GACEnB,iBAAiBmB,CAAC;GAElB,IAAIhD,SAAQe,OAAQ,OAAK;GACzB,IAAIL,eAAe,SAAO;GAE1B,MAAAuC,cAAoBD,EAACC;GAMrB,IAAIA,YAAWE,eAAgBF,YAAWG,YAAa,KAAG;GAC1D,IAAIH,YAAWI,QAAS,WAApB,CAAgCJ,YAAWC,UAAS;IACtD,EAAsBK,iBAAmB;IACzCrB,IAAGM,SAAU,CAAC,CAAAgB,KAAM;GAAC;EACtB;EACF9B,EAAA,MAAAQ;EAAAR,EAAA,MAAAG;EAAAH,EAAA,MAAAhB;EAAAgB,EAAA,MAAAqB;CAAA,OAAAA,KAAArB,EAAA;CAlBH,MAAAM,aAAmBe;CA4BA,MAAAU,KAAA7B,kBAAkB5B,SAAQe,OAAQ,QAAhB,IAAAkB,KAAAA;CAAsC,IAAAyB;CAAA,IAAAhC,EAAA,QAAAgB,gBAAAhB,EAAA,QAAAM,cAAAN,EAAA,QAAAI,SAAAJ,EAAA,QAAAN,SAAAM,EAAA,QAAA+B,MAAA/B,EAAA,QAAAS,MAAA;EALzEuB,KAAA,oBAAC,WAAD;GACOrB,KAAAA;GACEF,OAAAA;GACOO;GACFV;GACG,eAAAyB;GACRrC;GAAK,GACRU;EAAK,CAAA;EACTJ,EAAA,MAAAgB;EAAAhB,EAAA,MAAAM;EAAAN,EAAA,MAAAI;EAAAJ,EAAA,MAAAN;EAAAM,EAAA,MAAA+B;EAAA/B,EAAA,MAAAS;EAAAT,EAAA,MAAAgC;CAAA,OAAAA,KAAAhC,EAAA;CAAA,OARFgC;AAQE;AA9DuB,SAAAtB,MAAAuB,GAAA;CAAA,OAQKA,EAACnB,SAASL;AAAK"}
|
|
@@ -3,12 +3,12 @@ import { ThreadMessages, ThreadMessagesProps } from "./thread/ThreadMessages.js"
|
|
|
3
3
|
import { ThreadEmpty, ThreadEmptyProps } from "./thread/ThreadEmpty.js";
|
|
4
4
|
import { ThreadIf, ThreadIfProps } from "./thread/ThreadIf.js";
|
|
5
5
|
import { ThreadSuggestion, ThreadSuggestionProps } from "./thread/ThreadSuggestion.js";
|
|
6
|
-
import { ThreadPrimitiveMessageByIndex as MessageByIndex, ThreadPrimitiveSuggestionByIndex as SuggestionByIndex, ThreadPrimitiveSuggestions as Suggestions } from "@assistant-ui/core/react";
|
|
6
|
+
import { ThreadPrimitiveMessageByIndex as MessageByIndex, ThreadPrimitiveSuggestionByIndex as SuggestionByIndex, ThreadPrimitiveSuggestions as Suggestions, ThreadPrimitiveUnstable_MessageById as Unstable_MessageById } from "@assistant-ui/core/react";
|
|
7
7
|
|
|
8
8
|
//#region src/primitives/thread.d.ts
|
|
9
9
|
declare namespace thread_d_exports {
|
|
10
|
-
export { ThreadEmpty as Empty, ThreadEmptyProps as EmptyProps, ThreadIf as If, ThreadIfProps as IfProps, MessageByIndex, ThreadMessages as Messages, ThreadMessagesProps as MessagesProps, ThreadRoot as Root, ThreadRootProps as RootProps, ThreadSuggestion as Suggestion, SuggestionByIndex, ThreadSuggestionProps as SuggestionProps, Suggestions };
|
|
10
|
+
export { ThreadEmpty as Empty, ThreadEmptyProps as EmptyProps, ThreadIf as If, ThreadIfProps as IfProps, MessageByIndex, ThreadMessages as Messages, ThreadMessagesProps as MessagesProps, ThreadRoot as Root, ThreadRootProps as RootProps, ThreadSuggestion as Suggestion, SuggestionByIndex, ThreadSuggestionProps as SuggestionProps, Suggestions, Unstable_MessageById };
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
|
-
export { ThreadEmpty as Empty, type ThreadEmptyProps as EmptyProps, ThreadIf as If, type ThreadIfProps as IfProps, MessageByIndex, ThreadMessages as Messages, type ThreadMessagesProps as MessagesProps, ThreadRoot as Root, type ThreadRootProps as RootProps, ThreadSuggestion as Suggestion, SuggestionByIndex, type ThreadSuggestionProps as SuggestionProps, Suggestions, thread_d_exports };
|
|
13
|
+
export { ThreadEmpty as Empty, type ThreadEmptyProps as EmptyProps, ThreadIf as If, type ThreadIfProps as IfProps, MessageByIndex, ThreadMessages as Messages, type ThreadMessagesProps as MessagesProps, ThreadRoot as Root, type ThreadRootProps as RootProps, ThreadSuggestion as Suggestion, SuggestionByIndex, type ThreadSuggestionProps as SuggestionProps, Suggestions, Unstable_MessageById, thread_d_exports };
|
|
14
14
|
//# sourceMappingURL=thread.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { ThreadMessages } from "./thread/ThreadMessages.js";
|
|
|
4
4
|
import { ThreadEmpty } from "./thread/ThreadEmpty.js";
|
|
5
5
|
import { ThreadIf } from "./thread/ThreadIf.js";
|
|
6
6
|
import { ThreadSuggestion } from "./thread/ThreadSuggestion.js";
|
|
7
|
-
import { ThreadPrimitiveMessageByIndex as MessageByIndex, ThreadPrimitiveSuggestionByIndex as SuggestionByIndex, ThreadPrimitiveSuggestions as Suggestions } from "@assistant-ui/core/react";
|
|
7
|
+
import { ThreadPrimitiveMessageByIndex as MessageByIndex, ThreadPrimitiveSuggestionByIndex as SuggestionByIndex, ThreadPrimitiveSuggestions as Suggestions, ThreadPrimitiveUnstable_MessageById as Unstable_MessageById } from "@assistant-ui/core/react";
|
|
8
8
|
//#region src/primitives/thread.ts
|
|
9
9
|
var thread_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
Empty: () => ThreadEmpty,
|
|
@@ -14,9 +14,10 @@ var thread_exports = /* @__PURE__ */ __exportAll({
|
|
|
14
14
|
Root: () => ThreadRoot,
|
|
15
15
|
Suggestion: () => ThreadSuggestion,
|
|
16
16
|
SuggestionByIndex: () => SuggestionByIndex,
|
|
17
|
-
Suggestions: () => Suggestions
|
|
17
|
+
Suggestions: () => Suggestions,
|
|
18
|
+
Unstable_MessageById: () => Unstable_MessageById
|
|
18
19
|
});
|
|
19
20
|
//#endregion
|
|
20
|
-
export { ThreadEmpty as Empty, ThreadIf as If, MessageByIndex, ThreadMessages as Messages, ThreadRoot as Root, ThreadSuggestion as Suggestion, SuggestionByIndex, Suggestions, thread_exports };
|
|
21
|
+
export { ThreadEmpty as Empty, ThreadIf as If, MessageByIndex, ThreadMessages as Messages, ThreadRoot as Root, ThreadSuggestion as Suggestion, SuggestionByIndex, Suggestions, Unstable_MessageById, thread_exports };
|
|
21
22
|
|
|
22
23
|
//# sourceMappingURL=thread.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread.js","names":["ThreadRoot","Root","ThreadRootProps","RootProps","ThreadMessages","Messages","ThreadMessagesProps","MessagesProps","ThreadPrimitiveMessageByIndex","MessageByIndex","ThreadEmpty","Empty","ThreadEmptyProps","EmptyProps","ThreadIf","If","ThreadIfProps","IfProps","ThreadSuggestion","Suggestion","ThreadSuggestionProps","SuggestionProps","ThreadPrimitiveSuggestions","Suggestions","ThreadPrimitiveSuggestionByIndex","SuggestionByIndex"],"sources":["../../src/primitives/thread.ts"],"sourcesContent":["export {\n ThreadRoot as Root,\n type ThreadRootProps as RootProps,\n} from \"./thread/ThreadRoot\";\nexport {\n ThreadMessages as Messages,\n type ThreadMessagesProps as MessagesProps,\n} from \"./thread/ThreadMessages\";\nexport { ThreadPrimitiveMessageByIndex as MessageByIndex } from \"@assistant-ui/core/react\";\nexport {\n ThreadEmpty as Empty,\n type ThreadEmptyProps as EmptyProps,\n} from \"./thread/ThreadEmpty\";\nexport {\n ThreadIf as If,\n type ThreadIfProps as IfProps,\n} from \"./thread/ThreadIf\";\nexport {\n ThreadSuggestion as Suggestion,\n type ThreadSuggestionProps as SuggestionProps,\n} from \"./thread/ThreadSuggestion\";\nexport {\n ThreadPrimitiveSuggestions as Suggestions,\n ThreadPrimitiveSuggestionByIndex as SuggestionByIndex,\n} from \"@assistant-ui/core/react\";\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"thread.js","names":["ThreadRoot","Root","ThreadRootProps","RootProps","ThreadMessages","Messages","ThreadMessagesProps","MessagesProps","ThreadPrimitiveMessageByIndex","MessageByIndex","ThreadPrimitiveUnstable_MessageById","Unstable_MessageById","ThreadEmpty","Empty","ThreadEmptyProps","EmptyProps","ThreadIf","If","ThreadIfProps","IfProps","ThreadSuggestion","Suggestion","ThreadSuggestionProps","SuggestionProps","ThreadPrimitiveSuggestions","Suggestions","ThreadPrimitiveSuggestionByIndex","SuggestionByIndex"],"sources":["../../src/primitives/thread.ts"],"sourcesContent":["export {\n ThreadRoot as Root,\n type ThreadRootProps as RootProps,\n} from \"./thread/ThreadRoot\";\nexport {\n ThreadMessages as Messages,\n type ThreadMessagesProps as MessagesProps,\n} from \"./thread/ThreadMessages\";\nexport { ThreadPrimitiveMessageByIndex as MessageByIndex } from \"@assistant-ui/core/react\";\nexport { ThreadPrimitiveUnstable_MessageById as Unstable_MessageById } from \"@assistant-ui/core/react\";\nexport {\n ThreadEmpty as Empty,\n type ThreadEmptyProps as EmptyProps,\n} from \"./thread/ThreadEmpty\";\nexport {\n ThreadIf as If,\n type ThreadIfProps as IfProps,\n} from \"./thread/ThreadIf\";\nexport {\n ThreadSuggestion as Suggestion,\n type ThreadSuggestionProps as SuggestionProps,\n} from \"./thread/ThreadSuggestion\";\nexport {\n ThreadPrimitiveSuggestions as Suggestions,\n ThreadPrimitiveSuggestionByIndex as SuggestionByIndex,\n} from \"@assistant-ui/core/react\";\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"description": "React Native bindings for assistant-ui",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assistant",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
],
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@assistant-ui/core": "^0.2.
|
|
35
|
-
"@assistant-ui/store": "^0.2.
|
|
36
|
-
"@assistant-ui/tap": "^0.9.
|
|
37
|
-
"assistant-stream": "^0.3.
|
|
34
|
+
"@assistant-ui/core": "^0.2.19",
|
|
35
|
+
"@assistant-ui/store": "^0.2.19",
|
|
36
|
+
"@assistant-ui/tap": "^0.9.3",
|
|
37
|
+
"assistant-stream": "^0.3.24",
|
|
38
38
|
"zustand": "^5.0.14"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -49,10 +49,14 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/react": "^19.2.17",
|
|
52
|
+
"@types/react-dom": "^19.2.3",
|
|
53
|
+
"jsdom": "^29.1.1",
|
|
52
54
|
"react": "^19.2.7",
|
|
55
|
+
"react-dom": "^19.2.7",
|
|
53
56
|
"react-native": "^0.86.0",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
57
|
+
"react-native-web": "^0.21.2",
|
|
58
|
+
"vitest": "^4.1.9",
|
|
59
|
+
"@assistant-ui/x-buildutils": "0.0.17"
|
|
56
60
|
},
|
|
57
61
|
"publishConfig": {
|
|
58
62
|
"access": "public",
|
package/src/index.ts
CHANGED
|
@@ -132,12 +132,16 @@ export * as SuggestionPrimitive from "./primitives/suggestion";
|
|
|
132
132
|
export * as ErrorPrimitive from "./primitives/error";
|
|
133
133
|
|
|
134
134
|
export { groupPartByType, type GroupByContext } from "@assistant-ui/core/react";
|
|
135
|
+
export { unstable_useThreadMessageIds } from "@assistant-ui/core/react";
|
|
135
136
|
|
|
136
137
|
// Re-export shared providers from core/react
|
|
137
138
|
export {
|
|
138
139
|
ThreadListItemByIndexProvider,
|
|
140
|
+
ThreadListItemRuntimeProvider,
|
|
139
141
|
ChainOfThoughtByIndicesProvider,
|
|
140
142
|
MessageByIndexProvider,
|
|
143
|
+
MessageAttachmentByIndexProvider,
|
|
144
|
+
ComposerAttachmentByIndexProvider,
|
|
141
145
|
PartByIndexProvider,
|
|
142
146
|
TextMessagePartProvider,
|
|
143
147
|
ChainOfThoughtPartByIndexProvider,
|
|
@@ -184,6 +188,26 @@ export {
|
|
|
184
188
|
useAssistantInteractable,
|
|
185
189
|
type AssistantInteractableProps,
|
|
186
190
|
useInteractableState,
|
|
191
|
+
unstable_Interactables,
|
|
192
|
+
unstable_useInteractable,
|
|
193
|
+
type Unstable_InteractableConfig,
|
|
194
|
+
type Unstable_InferInteractableState,
|
|
195
|
+
type Unstable_InteractableVersionInfo,
|
|
196
|
+
unstable_useInteractableState,
|
|
197
|
+
unstable_useInteractableVersions,
|
|
198
|
+
unstable_interactableTool,
|
|
199
|
+
type Unstable_InteractableToolConfig,
|
|
200
|
+
type Unstable_InteractableToolRenderProps,
|
|
201
|
+
type Unstable_InteractableStateSchema,
|
|
202
|
+
type Unstable_InteractablesState,
|
|
203
|
+
type Unstable_InteractableDefinition,
|
|
204
|
+
type Unstable_InteractableRegistration,
|
|
205
|
+
type Unstable_InteractablesMethods,
|
|
206
|
+
type Unstable_InteractablePersistedState,
|
|
207
|
+
type Unstable_InteractablePersistenceAdapter,
|
|
208
|
+
type Unstable_InteractablePersistenceStatus,
|
|
209
|
+
type Unstable_InteractablesClientSchema,
|
|
210
|
+
type Unstable_InteractablesConfig,
|
|
187
211
|
useToolArgsStatus,
|
|
188
212
|
type ToolArgsStatus,
|
|
189
213
|
} from "@assistant-ui/core/react";
|
|
@@ -197,6 +221,14 @@ export type {
|
|
|
197
221
|
|
|
198
222
|
export { mergeModelContexts } from "@assistant-ui/core";
|
|
199
223
|
|
|
224
|
+
export {
|
|
225
|
+
unstable_getInteractableSnapshots,
|
|
226
|
+
unstable_formatInteractableSnapshot,
|
|
227
|
+
unstable_getInteractableVersions,
|
|
228
|
+
type Unstable_InteractableSnapshotEntry,
|
|
229
|
+
type Unstable_InteractableVersion,
|
|
230
|
+
} from "@assistant-ui/core";
|
|
231
|
+
|
|
200
232
|
export type { ExportedMessageRepositoryItem } from "@assistant-ui/core";
|
|
201
233
|
export { ExportedMessageRepository } from "@assistant-ui/core";
|
|
202
234
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { act } from "react";
|
|
2
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { AttachmentName } from "./AttachmentName";
|
|
5
|
+
|
|
6
|
+
const h = vi.hoisted(() => ({
|
|
7
|
+
state: { attachment: { name: "" } },
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
vi.mock("@assistant-ui/store", () => ({
|
|
11
|
+
useAuiState: <T,>(selector: (s: { attachment: { name: string } }) => T) =>
|
|
12
|
+
selector(h.state),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
(globalThis as Record<string, unknown>).IS_REACT_ACT_ENVIRONMENT = true;
|
|
16
|
+
|
|
17
|
+
describe("AttachmentName", () => {
|
|
18
|
+
let container: HTMLDivElement;
|
|
19
|
+
let root: Root;
|
|
20
|
+
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
h.state.attachment.name = "";
|
|
23
|
+
container = document.createElement("div");
|
|
24
|
+
document.body.appendChild(container);
|
|
25
|
+
root = createRoot(container);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
afterEach(async () => {
|
|
29
|
+
await act(async () => {
|
|
30
|
+
root.unmount();
|
|
31
|
+
});
|
|
32
|
+
container.remove();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const mount = async () => {
|
|
36
|
+
await act(async () => {
|
|
37
|
+
root.render(<AttachmentName testID="name" />);
|
|
38
|
+
});
|
|
39
|
+
const el = container.querySelector('[data-testid="name"]');
|
|
40
|
+
expect(el).not.toBeNull();
|
|
41
|
+
return el as HTMLElement;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
it("renders the attachment name from store state", async () => {
|
|
45
|
+
h.state.attachment.name = "report.pdf";
|
|
46
|
+
const el = await mount();
|
|
47
|
+
expect(el.textContent).toBe("report.pdf");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("renders a different attachment name", async () => {
|
|
51
|
+
h.state.attachment.name = "photo.png";
|
|
52
|
+
const el = await mount();
|
|
53
|
+
expect(el.textContent).toBe("photo.png");
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { act } from "react";
|
|
2
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { AttachmentRemove } from "./AttachmentRemove";
|
|
5
|
+
|
|
6
|
+
const h = vi.hoisted(() => ({
|
|
7
|
+
remove: vi.fn<() => void>(),
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
vi.mock("@assistant-ui/store", () => {
|
|
11
|
+
const aui = {
|
|
12
|
+
attachment: () => ({ remove: h.remove }),
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
useAui: () => aui,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
(globalThis as Record<string, unknown>).IS_REACT_ACT_ENVIRONMENT = true;
|
|
20
|
+
|
|
21
|
+
describe("AttachmentRemove", () => {
|
|
22
|
+
let container: HTMLDivElement;
|
|
23
|
+
let root: Root;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
h.remove.mockReset();
|
|
27
|
+
container = document.createElement("div");
|
|
28
|
+
document.body.appendChild(container);
|
|
29
|
+
root = createRoot(container);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(async () => {
|
|
33
|
+
await act(async () => {
|
|
34
|
+
root.unmount();
|
|
35
|
+
});
|
|
36
|
+
container.remove();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const mount = async (
|
|
40
|
+
props: Partial<Parameters<typeof AttachmentRemove>[0]> = {},
|
|
41
|
+
) => {
|
|
42
|
+
await act(async () => {
|
|
43
|
+
root.render(
|
|
44
|
+
<AttachmentRemove testID="remove" {...props}>
|
|
45
|
+
x
|
|
46
|
+
</AttachmentRemove>,
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
return container.querySelector('[data-testid="remove"]') as HTMLElement;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const press = async (el: HTMLElement) => {
|
|
53
|
+
await act(async () => {
|
|
54
|
+
el.dispatchEvent(
|
|
55
|
+
new MouseEvent("click", { bubbles: true, cancelable: true }),
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
it("calls attachment().remove when pressed", async () => {
|
|
61
|
+
const el = await mount();
|
|
62
|
+
await press(el);
|
|
63
|
+
expect(h.remove).toHaveBeenCalledTimes(1);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("does not call remove before any press", async () => {
|
|
67
|
+
await mount();
|
|
68
|
+
expect(h.remove).not.toHaveBeenCalled();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("renders its children", async () => {
|
|
72
|
+
const el = await mount();
|
|
73
|
+
expect(el.textContent).toBe("x");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("does not fire remove when the Pressable is disabled", async () => {
|
|
77
|
+
const el = await mount({ disabled: true });
|
|
78
|
+
await press(el);
|
|
79
|
+
expect(h.remove).not.toHaveBeenCalled();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { act } from "react";
|
|
2
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { AttachmentThumb } from "./AttachmentThumb";
|
|
5
|
+
|
|
6
|
+
const h = vi.hoisted(() => ({
|
|
7
|
+
attachment: { name: "" },
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
vi.mock("@assistant-ui/store", () => ({
|
|
11
|
+
useAuiState: <T,>(selector: (s: { attachment: typeof h.attachment }) => T) =>
|
|
12
|
+
selector({ attachment: h.attachment }),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
(globalThis as Record<string, unknown>).IS_REACT_ACT_ENVIRONMENT = true;
|
|
16
|
+
|
|
17
|
+
describe("AttachmentThumb", () => {
|
|
18
|
+
let container: HTMLDivElement;
|
|
19
|
+
let root: Root;
|
|
20
|
+
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
h.attachment.name = "";
|
|
23
|
+
container = document.createElement("div");
|
|
24
|
+
document.body.appendChild(container);
|
|
25
|
+
root = createRoot(container);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
afterEach(async () => {
|
|
29
|
+
await act(async () => {
|
|
30
|
+
root.unmount();
|
|
31
|
+
});
|
|
32
|
+
container.remove();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const mount = async (name: string) => {
|
|
36
|
+
h.attachment.name = name;
|
|
37
|
+
await act(async () => {
|
|
38
|
+
root.render(<AttachmentThumb testID="thumb" />);
|
|
39
|
+
});
|
|
40
|
+
return container.querySelector('[data-testid="thumb"]') as HTMLElement;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
it("renders the dotted extension for a single-extension name", async () => {
|
|
44
|
+
const el = await mount("photo.png");
|
|
45
|
+
expect(el.textContent).toBe(".png");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("takes only the last segment for a multi-extension name", async () => {
|
|
49
|
+
const el = await mount("archive.tar.gz");
|
|
50
|
+
expect(el.textContent).toBe(".gz");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("renders just a dot when the name has no extension", async () => {
|
|
54
|
+
const el = await mount("noext");
|
|
55
|
+
expect(el.textContent).toBe(".");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("renders just a dot for an empty name", async () => {
|
|
59
|
+
const el = await mount("");
|
|
60
|
+
expect(el.textContent).toBe(".");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("treats a leading-dot name as an extension", async () => {
|
|
64
|
+
const el = await mount(".gitignore");
|
|
65
|
+
expect(el.textContent).toBe(".gitignore");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("forwards props to the underlying Text", async () => {
|
|
69
|
+
h.attachment.name = "photo.png";
|
|
70
|
+
await act(async () => {
|
|
71
|
+
root.render(<AttachmentThumb testID="forwarded" />);
|
|
72
|
+
});
|
|
73
|
+
expect(container.querySelector('[data-testid="forwarded"]')).not.toBeNull();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { act } from "react";
|
|
2
|
+
import { createRoot, type Root } from "react-dom/client";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { BranchPickerCount } from "./BranchPickerCount";
|
|
5
|
+
|
|
6
|
+
const h = vi.hoisted(() => ({
|
|
7
|
+
state: { message: { branchCount: 0 } },
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
vi.mock("@assistant-ui/store", () => ({
|
|
11
|
+
useAuiState: <T,>(selector: (s: { message: { branchCount: number } }) => T) =>
|
|
12
|
+
selector(h.state),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
(globalThis as Record<string, unknown>).IS_REACT_ACT_ENVIRONMENT = true;
|
|
16
|
+
|
|
17
|
+
describe("BranchPickerCount", () => {
|
|
18
|
+
let container: HTMLDivElement;
|
|
19
|
+
let root: Root;
|
|
20
|
+
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
h.state.message.branchCount = 0;
|
|
23
|
+
container = document.createElement("div");
|
|
24
|
+
document.body.appendChild(container);
|
|
25
|
+
root = createRoot(container);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
afterEach(async () => {
|
|
29
|
+
await act(async () => {
|
|
30
|
+
root.unmount();
|
|
31
|
+
});
|
|
32
|
+
container.remove();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const mount = async () => {
|
|
36
|
+
await act(async () => {
|
|
37
|
+
root.render(<BranchPickerCount testID="count" />);
|
|
38
|
+
});
|
|
39
|
+
const el = container.querySelector('[data-testid="count"]');
|
|
40
|
+
expect(el).not.toBeNull();
|
|
41
|
+
return el as HTMLElement;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
it("renders the branchCount from store state", async () => {
|
|
45
|
+
h.state.message.branchCount = 3;
|
|
46
|
+
const el = await mount();
|
|
47
|
+
expect(el.textContent).toBe("3");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("renders a different branchCount value", async () => {
|
|
51
|
+
h.state.message.branchCount = 12;
|
|
52
|
+
const el = await mount();
|
|
53
|
+
expect(el.textContent).toBe("12");
|
|
54
|
+
});
|
|
55
|
+
});
|