@assistant-ui/react 0.8.5 → 0.8.7
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/api/MessageRuntime.js +1 -1
- package/dist/api/MessageRuntime.js.map +1 -1
- package/dist/api/MessageRuntime.mjs +1 -1
- package/dist/api/MessageRuntime.mjs.map +1 -1
- package/dist/api/subscribable/NestedSubscriptionSubject.d.ts.map +1 -1
- package/dist/api/subscribable/NestedSubscriptionSubject.js.map +1 -1
- package/dist/api/subscribable/NestedSubscriptionSubject.mjs.map +1 -1
- package/dist/cloud/auiV0.d.ts.map +1 -1
- package/dist/cloud/auiV0.js +9 -2
- package/dist/cloud/auiV0.js.map +1 -1
- package/dist/cloud/auiV0.mjs +9 -2
- package/dist/cloud/auiV0.mjs.map +1 -1
- package/dist/context/react/utils/createStateHookForRuntime.d.ts.map +1 -1
- package/dist/context/react/utils/createStateHookForRuntime.js.map +1 -1
- package/dist/context/react/utils/createStateHookForRuntime.mjs.map +1 -1
- package/dist/context/react/utils/ensureBinding.js.map +1 -1
- package/dist/context/react/utils/ensureBinding.mjs.map +1 -1
- package/dist/model-context/makeAssistantVisible.d.ts.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +2 -1
- package/dist/model-context/makeAssistantVisible.js.map +1 -1
- package/dist/model-context/makeAssistantVisible.mjs +2 -1
- package/dist/model-context/makeAssistantVisible.mjs.map +1 -1
- package/dist/model-context/useAssistantInstructions.js +1 -1
- package/dist/model-context/useAssistantInstructions.js.map +1 -1
- package/dist/model-context/useAssistantInstructions.mjs +1 -1
- package/dist/model-context/useAssistantInstructions.mjs.map +1 -1
- package/dist/model-context/useAssistantToolUI.js +1 -1
- package/dist/model-context/useAssistantToolUI.js.map +1 -1
- package/dist/model-context/useAssistantToolUI.mjs +1 -1
- package/dist/model-context/useAssistantToolUI.mjs.map +1 -1
- package/dist/model-context/useInlineRender.d.ts.map +1 -1
- package/dist/model-context/useInlineRender.js +8 -5
- package/dist/model-context/useInlineRender.js.map +1 -1
- package/dist/model-context/useInlineRender.mjs +8 -5
- package/dist/model-context/useInlineRender.mjs.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js +6 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.mjs +6 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.mjs.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +7 -2
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.mjs +7 -2
- package/dist/primitives/composer/ComposerInput.mjs.map +1 -1
- package/dist/primitives/contentPart/useContentPartFile.d.ts +5 -0
- package/dist/primitives/contentPart/useContentPartFile.d.ts.map +1 -0
- package/dist/{runtimes/edge/streams/utils/index.js → primitives/contentPart/useContentPartFile.js} +18 -12
- package/dist/primitives/contentPart/useContentPartFile.js.map +1 -0
- package/dist/primitives/contentPart/useContentPartFile.mjs +18 -0
- package/dist/primitives/contentPart/useContentPartFile.mjs.map +1 -0
- package/dist/primitives/contentPart/useContentPartSource.d.ts +5 -0
- package/dist/primitives/contentPart/useContentPartSource.d.ts.map +1 -0
- package/dist/{runtimes/edge/streams/utils/PipeableTransformStream.js → primitives/contentPart/useContentPartSource.js} +18 -16
- package/dist/primitives/contentPart/useContentPartSource.js.map +1 -0
- package/dist/primitives/contentPart/useContentPartSource.mjs +18 -0
- package/dist/primitives/contentPart/useContentPartSource.mjs.map +1 -0
- package/dist/primitives/index.d.ts +3 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +7 -1
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/index.mjs +5 -1
- package/dist/primitives/index.mjs.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.mjs +4 -1
- package/dist/primitives/thread/ThreadScrollToBottom.mjs.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.js +1 -0
- package/dist/primitives/thread/ThreadViewport.js.map +1 -1
- package/dist/primitives/thread/ThreadViewport.mjs +1 -0
- package/dist/primitives/thread/ThreadViewport.mjs.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.mjs +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.mjs.map +1 -1
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.d.ts +5 -1
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.js.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js +3 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs +3 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.d.ts +1 -1
- package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.d.ts.map +1 -1
- package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.js +2 -2
- package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.js.map +1 -1
- package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.mjs +2 -2
- package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.mjs.map +1 -1
- package/dist/runtimes/edge/EdgeChatAdapter.d.ts +8 -3
- package/dist/runtimes/edge/EdgeChatAdapter.d.ts.map +1 -1
- package/dist/runtimes/edge/EdgeChatAdapter.js +8 -9
- package/dist/runtimes/edge/EdgeChatAdapter.js.map +1 -1
- package/dist/runtimes/edge/EdgeChatAdapter.mjs +11 -9
- package/dist/runtimes/edge/EdgeChatAdapter.mjs.map +1 -1
- package/dist/runtimes/edge/converters/fromLanguageModelMessages.d.ts +2 -2
- package/dist/runtimes/edge/converters/fromLanguageModelMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/fromLanguageModelMessages.js +5 -2
- package/dist/runtimes/edge/converters/fromLanguageModelMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/fromLanguageModelMessages.mjs +5 -2
- package/dist/runtimes/edge/converters/fromLanguageModelMessages.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.js +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.mjs +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js +2 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs +2 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs.map +1 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts +2 -2
- package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts.map +1 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.js +17 -34
- package/dist/runtimes/edge/createEdgeRuntimeAPI.js.map +1 -1
- package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs +21 -37
- package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs.map +1 -1
- package/dist/runtimes/edge/index.d.ts +0 -1
- package/dist/runtimes/edge/index.d.ts.map +1 -1
- package/dist/runtimes/edge/index.js +1 -3
- package/dist/runtimes/edge/index.js.map +1 -1
- package/dist/runtimes/edge/index.mjs +0 -1
- package/dist/runtimes/edge/index.mjs.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.d.ts +2 -33
- package/dist/runtimes/edge/streams/toolResultStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.js +19 -96
- package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.mjs +19 -86
- package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.js +1 -0
- package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.mjs +1 -0
- package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
- package/dist/runtimes/external-store/external-message-converter.js +1 -1
- package/dist/runtimes/external-store/external-message-converter.js.map +1 -1
- package/dist/runtimes/external-store/external-message-converter.mjs +1 -1
- package/dist/runtimes/external-store/external-message-converter.mjs.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.d.ts +2 -2
- package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
- package/dist/runtimes/local/LocalRuntimeOptions.d.ts +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +3 -2
- package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.js +22 -7
- package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +22 -7
- package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.d.ts.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.js +3 -1
- package/dist/runtimes/local/useLocalRuntime.js.map +1 -1
- package/dist/runtimes/local/useLocalRuntime.mjs +3 -1
- package/dist/runtimes/local/useLocalRuntime.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.mjs +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +2 -2
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +2 -2
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.js +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.mjs +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.mjs.map +1 -1
- package/dist/runtimes/utils/MessageRepository.d.ts +1 -0
- package/dist/runtimes/utils/MessageRepository.d.ts.map +1 -1
- package/dist/runtimes/utils/MessageRepository.js +3 -0
- package/dist/runtimes/utils/MessageRepository.js.map +1 -1
- package/dist/runtimes/utils/MessageRepository.mjs +3 -0
- package/dist/runtimes/utils/MessageRepository.mjs.map +1 -1
- package/dist/types/AssistantTypes.d.ts +1 -1
- package/dist/types/AssistantTypes.d.ts.map +1 -1
- package/dist/types/AssistantTypes.js.map +1 -1
- package/dist/utils/json/is-json.d.ts +1 -1
- package/dist/utils/json/is-json.d.ts.map +1 -1
- package/dist/utils/json/is-json.js +10 -4
- package/dist/utils/json/is-json.js.map +1 -1
- package/dist/utils/json/is-json.mjs +10 -4
- package/dist/utils/json/is-json.mjs.map +1 -1
- package/package.json +3 -3
- package/src/api/MessageRuntime.ts +1 -1
- package/src/api/subscribable/NestedSubscriptionSubject.ts +7 -2
- package/src/cloud/auiV0.ts +9 -2
- package/src/context/react/utils/createStateHookForRuntime.ts +3 -0
- package/src/context/react/utils/ensureBinding.ts +1 -1
- package/src/model-context/makeAssistantVisible.tsx +3 -1
- package/src/model-context/useAssistantInstructions.tsx +1 -1
- package/src/model-context/useAssistantToolUI.tsx +1 -1
- package/src/model-context/useInlineRender.tsx +8 -5
- package/src/primitives/assistantModal/AssistantModalRoot.tsx +6 -1
- package/src/primitives/composer/ComposerInput.tsx +7 -2
- package/src/primitives/contentPart/useContentPartFile.tsx +18 -0
- package/src/primitives/contentPart/useContentPartSource.tsx +18 -0
- package/src/primitives/index.ts +3 -1
- package/src/primitives/thread/ThreadScrollToBottom.tsx +4 -1
- package/src/primitives/thread/ThreadViewport.tsx +3 -0
- package/src/primitives/thread/useThreadViewportAutoScroll.tsx +1 -1
- package/src/runtimes/adapters/thread-history/ThreadHistoryAdapter.ts +5 -1
- package/src/runtimes/composer/BaseComposerRuntimeCore.tsx +3 -1
- package/src/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.ts +2 -2
- package/src/runtimes/edge/EdgeChatAdapter.ts +26 -15
- package/src/runtimes/edge/converters/fromLanguageModelMessages.ts +24 -14
- package/src/runtimes/edge/converters/toCoreMessages.ts +6 -2
- package/src/runtimes/edge/converters/toLanguageModelMessages.ts +3 -2
- package/src/runtimes/edge/createEdgeRuntimeAPI.ts +31 -48
- package/src/runtimes/edge/index.ts +0 -2
- package/src/runtimes/edge/streams/toolResultStream.ts +28 -152
- package/src/runtimes/external-store/ThreadMessageLike.tsx +2 -1
- package/src/runtimes/external-store/external-message-converter.tsx +1 -1
- package/src/runtimes/local/ChatModelAdapter.tsx +2 -0
- package/src/runtimes/local/LocalThreadRuntimeCore.tsx +31 -7
- package/src/runtimes/local/useLocalRuntime.tsx +3 -1
- package/src/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.tsx +1 -1
- package/src/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +2 -3
- package/src/runtimes/remote-thread-list/adapter/cloud.tsx +1 -1
- package/src/runtimes/utils/MessageRepository.tsx +4 -0
- package/src/types/AssistantTypes.ts +2 -1
- package/src/utils/json/is-json.ts +17 -4
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.d.ts +0 -62
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.js +0 -46
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.js.map +0 -1
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.mjs +0 -21
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.mjs.map +0 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.d.ts +0 -5
- package/dist/runtimes/edge/streams/assistantDecoderStream.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.js +0 -170
- package/dist/runtimes/edge/streams/assistantDecoderStream.js.map +0 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.mjs +0 -147
- package/dist/runtimes/edge/streams/assistantDecoderStream.mjs.map +0 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.d.ts +0 -5
- package/dist/runtimes/edge/streams/assistantEncoderStream.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.js +0 -137
- package/dist/runtimes/edge/streams/assistantEncoderStream.js.map +0 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.mjs +0 -114
- package/dist/runtimes/edge/streams/assistantEncoderStream.mjs.map +0 -1
- package/dist/runtimes/edge/streams/runResultStream.d.ts +0 -4
- package/dist/runtimes/edge/streams/runResultStream.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/runResultStream.js +0 -313
- package/dist/runtimes/edge/streams/runResultStream.js.map +0 -1
- package/dist/runtimes/edge/streams/runResultStream.mjs +0 -288
- package/dist/runtimes/edge/streams/runResultStream.mjs.map +0 -1
- package/dist/runtimes/edge/streams/utils/PipeableTransformStream.d.ts +0 -4
- package/dist/runtimes/edge/streams/utils/PipeableTransformStream.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/utils/PipeableTransformStream.js.map +0 -1
- package/dist/runtimes/edge/streams/utils/PipeableTransformStream.mjs +0 -15
- package/dist/runtimes/edge/streams/utils/PipeableTransformStream.mjs.map +0 -1
- package/dist/runtimes/edge/streams/utils/StreamPart.d.ts +0 -7
- package/dist/runtimes/edge/streams/utils/StreamPart.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/utils/StreamPart.js +0 -19
- package/dist/runtimes/edge/streams/utils/StreamPart.js.map +0 -1
- package/dist/runtimes/edge/streams/utils/StreamPart.mjs +0 -1
- package/dist/runtimes/edge/streams/utils/StreamPart.mjs.map +0 -1
- package/dist/runtimes/edge/streams/utils/chunkByLineStream.d.ts +0 -2
- package/dist/runtimes/edge/streams/utils/chunkByLineStream.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/utils/chunkByLineStream.js +0 -48
- package/dist/runtimes/edge/streams/utils/chunkByLineStream.js.map +0 -1
- package/dist/runtimes/edge/streams/utils/chunkByLineStream.mjs +0 -23
- package/dist/runtimes/edge/streams/utils/chunkByLineStream.mjs.map +0 -1
- package/dist/runtimes/edge/streams/utils/index.d.ts +0 -14
- package/dist/runtimes/edge/streams/utils/index.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/utils/index.js.map +0 -1
- package/dist/runtimes/edge/streams/utils/index.mjs +0 -11
- package/dist/runtimes/edge/streams/utils/index.mjs.map +0 -1
- package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.d.ts +0 -4
- package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.js +0 -50
- package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.js.map +0 -1
- package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.mjs +0 -25
- package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.mjs.map +0 -1
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.d.ts +0 -3
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.d.ts.map +0 -1
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.js +0 -48
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.js.map +0 -1
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.mjs +0 -23
- package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.mjs.map +0 -1
- package/src/runtimes/edge/streams/AssistantStreamChunkType.ts +0 -73
- package/src/runtimes/edge/streams/assistantDecoderStream.ts +0 -170
- package/src/runtimes/edge/streams/assistantEncoderStream.ts +0 -126
- package/src/runtimes/edge/streams/runResultStream.ts +0 -360
- package/src/runtimes/edge/streams/utils/PipeableTransformStream.ts +0 -10
- package/src/runtimes/edge/streams/utils/StreamPart.ts +0 -3
- package/src/runtimes/edge/streams/utils/chunkByLineStream.ts +0 -24
- package/src/runtimes/edge/streams/utils/index.ts +0 -15
- package/src/runtimes/edge/streams/utils/streamPartDecoderStream.ts +0 -29
- package/src/runtimes/edge/streams/utils/streamPartEncoderStream.ts +0 -23
@@ -30,11 +30,14 @@ var useInlineRender = (toolUI) => {
|
|
30
30
|
const [useToolUI] = (0, import_react.useState)(() => (0, import_zustand.create)(() => toolUI));
|
31
31
|
(0, import_react.useEffect)(() => {
|
32
32
|
useToolUI.setState(toolUI);
|
33
|
-
});
|
34
|
-
return (0, import_react.useCallback)(
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
}, [toolUI, useToolUI]);
|
34
|
+
return (0, import_react.useCallback)(
|
35
|
+
function ToolUI(args) {
|
36
|
+
const toolUI2 = useToolUI();
|
37
|
+
return toolUI2(args);
|
38
|
+
},
|
39
|
+
[useToolUI]
|
40
|
+
);
|
38
41
|
};
|
39
42
|
// Annotate the CommonJS export names for ESM import in node:
|
40
43
|
0 && (module.exports = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/model-context/useInlineRender.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useCallback, useEffect, useState } from \"react\";\nimport { ToolCallContentPartProps } from \"../types\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallContentPartProps<TArgs, TResult>>,\n): FC<ToolCallContentPartProps<TArgs, TResult>> => {\n const [useToolUI] = useState(() => create(() => toolUI));\n\n useEffect(() => {\n useToolUI.setState(toolUI);\n });\n\n return useCallback((args)
|
1
|
+
{"version":3,"sources":["../../src/model-context/useInlineRender.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useCallback, useEffect, useState } from \"react\";\nimport { ToolCallContentPartProps } from \"../types\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallContentPartProps<TArgs, TResult>>,\n): FC<ToolCallContentPartProps<TArgs, TResult>> => {\n const [useToolUI] = useState(() => create(() => toolUI));\n\n useEffect(() => {\n useToolUI.setState(toolUI);\n }, [toolUI, useToolUI]);\n\n return useCallback(\n function ToolUI(args) {\n const toolUI = useToolUI();\n return toolUI(args);\n },\n [useToolUI],\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAqD;AAErD,qBAAuB;AAEhB,IAAM,kBAAkB,CAC7B,WACiD;AACjD,QAAM,CAAC,SAAS,QAAI,uBAAS,UAAM,uBAAO,MAAM,MAAM,CAAC;AAEvD,8BAAU,MAAM;AACd,cAAU,SAAS,MAAM;AAAA,EAC3B,GAAG,CAAC,QAAQ,SAAS,CAAC;AAEtB,aAAO;AAAA,IACL,SAAS,OAAO,MAAM;AACpB,YAAMA,UAAS,UAAU;AACzB,aAAOA,QAAO,IAAI;AAAA,IACpB;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AACF;","names":["toolUI"]}
|
@@ -7,11 +7,14 @@ var useInlineRender = (toolUI) => {
|
|
7
7
|
const [useToolUI] = useState(() => create(() => toolUI));
|
8
8
|
useEffect(() => {
|
9
9
|
useToolUI.setState(toolUI);
|
10
|
-
});
|
11
|
-
return useCallback(
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
}, [toolUI, useToolUI]);
|
11
|
+
return useCallback(
|
12
|
+
function ToolUI(args) {
|
13
|
+
const toolUI2 = useToolUI();
|
14
|
+
return toolUI2(args);
|
15
|
+
},
|
16
|
+
[useToolUI]
|
17
|
+
);
|
15
18
|
};
|
16
19
|
export {
|
17
20
|
useInlineRender
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/model-context/useInlineRender.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useCallback, useEffect, useState } from \"react\";\nimport { ToolCallContentPartProps } from \"../types\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallContentPartProps<TArgs, TResult>>,\n): FC<ToolCallContentPartProps<TArgs, TResult>> => {\n const [useToolUI] = useState(() => create(() => toolUI));\n\n useEffect(() => {\n useToolUI.setState(toolUI);\n });\n\n return useCallback((args)
|
1
|
+
{"version":3,"sources":["../../src/model-context/useInlineRender.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useCallback, useEffect, useState } from \"react\";\nimport { ToolCallContentPartProps } from \"../types\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallContentPartProps<TArgs, TResult>>,\n): FC<ToolCallContentPartProps<TArgs, TResult>> => {\n const [useToolUI] = useState(() => create(() => toolUI));\n\n useEffect(() => {\n useToolUI.setState(toolUI);\n }, [toolUI, useToolUI]);\n\n return useCallback(\n function ToolUI(args) {\n const toolUI = useToolUI();\n return toolUI(args);\n },\n [useToolUI],\n );\n};\n"],"mappings":";;;AAEA,SAAa,aAAa,WAAW,gBAAgB;AAErD,SAAS,cAAc;AAEhB,IAAM,kBAAkB,CAC7B,WACiD;AACjD,QAAM,CAAC,SAAS,IAAI,SAAS,MAAM,OAAO,MAAM,MAAM,CAAC;AAEvD,YAAU,MAAM;AACd,cAAU,SAAS,MAAM;AAAA,EAC3B,GAAG,CAAC,QAAQ,SAAS,CAAC;AAEtB,SAAO;AAAA,IACL,SAAS,OAAO,MAAM;AACpB,YAAMA,UAAS,UAAU;AACzB,aAAOA,QAAO,IAAI;AAAA,IACpB;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AACF;","names":["toolUI"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AssistantModalRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAK5D,yBAAiB,2BAA2B,CAAC;IAC3C,KAAY,KAAK,GAAG,gBAAgB,CAAC,YAAY,GAAG;QAClD,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC/C,CAAC;CACH;
|
1
|
+
{"version":3,"file":"AssistantModalRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAK5D,yBAAiB,2BAA2B,CAAC;IAC3C,KAAY,KAAK,GAAG,gBAAgB,CAAC,YAAY,GAAG;QAClD,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC/C,CAAC;CACH;AA6BD,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAC1C,2BAA2B,CAAC,KAAK,CAwBlC,CAAC"}
|
@@ -52,7 +52,12 @@ var useAssistantModalOpenState = ({
|
|
52
52
|
return threadRuntime.unstable_on("run-start", () => {
|
53
53
|
setOpen(true);
|
54
54
|
});
|
55
|
-
}, [
|
55
|
+
}, [
|
56
|
+
unstable_openOnRunStart,
|
57
|
+
setOpen,
|
58
|
+
threadRuntime,
|
59
|
+
!unstable_openOnRunStart
|
60
|
+
]);
|
56
61
|
return state;
|
57
62
|
};
|
58
63
|
var AssistantModalPrimitiveRoot = ({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { ScopedProps, usePopoverScope } from \"./scope\";\nimport { useThreadRuntime } from \"../../context\";\n\nexport namespace AssistantModalPrimitiveRoot {\n export type Props = PopoverPrimitive.PopoverProps & {\n unstable_openOnRunStart?: boolean | undefined;\n };\n}\n\nconst useAssistantModalOpenState = ({\n defaultOpen = false,\n unstable_openOnRunStart = true,\n}: {\n defaultOpen?: boolean | undefined;\n unstable_openOnRunStart?: boolean | undefined;\n}) => {\n const state = useState(defaultOpen);\n\n const [, setOpen] = state;\n const threadRuntime = useThreadRuntime();\n useEffect(() => {\n if (!unstable_openOnRunStart) return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", () => {\n setOpen(true);\n });\n }, [unstable_openOnRunStart]);\n\n return state;\n};\n\nexport const AssistantModalPrimitiveRoot: FC<\n AssistantModalPrimitiveRoot.Props\n> = ({\n __scopeAssistantModal,\n defaultOpen,\n unstable_openOnRunStart,\n open,\n onOpenChange,\n ...rest\n}: ScopedProps<AssistantModalPrimitiveRoot.Props>) => {\n const scope = usePopoverScope(__scopeAssistantModal);\n\n const [modalOpen, setOpen] = useAssistantModalOpenState({\n defaultOpen,\n unstable_openOnRunStart,\n });\n\n return (\n <PopoverPrimitive.Root\n {...scope}\n open={open === undefined ? modalOpen : open}\n onOpenChange={composeEventHandlers(onOpenChange, setOpen)}\n {...rest}\n />\n );\n};\n\nAssistantModalPrimitiveRoot.displayName = \"AssistantModalPrimitive.Root\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAwC;AACxC,uBAAkC;AAClC,uBAAqC;AACrC,mBAA6C;AAC7C,qBAAiC;
|
1
|
+
{"version":3,"sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { ScopedProps, usePopoverScope } from \"./scope\";\nimport { useThreadRuntime } from \"../../context\";\n\nexport namespace AssistantModalPrimitiveRoot {\n export type Props = PopoverPrimitive.PopoverProps & {\n unstable_openOnRunStart?: boolean | undefined;\n };\n}\n\nconst useAssistantModalOpenState = ({\n defaultOpen = false,\n unstable_openOnRunStart = true,\n}: {\n defaultOpen?: boolean | undefined;\n unstable_openOnRunStart?: boolean | undefined;\n}) => {\n const state = useState(defaultOpen);\n\n const [, setOpen] = state;\n const threadRuntime = useThreadRuntime();\n useEffect(() => {\n if (!unstable_openOnRunStart) return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", () => {\n setOpen(true);\n });\n }, [\n unstable_openOnRunStart,\n setOpen,\n threadRuntime,\n !unstable_openOnRunStart,\n ]);\n\n return state;\n};\n\nexport const AssistantModalPrimitiveRoot: FC<\n AssistantModalPrimitiveRoot.Props\n> = ({\n __scopeAssistantModal,\n defaultOpen,\n unstable_openOnRunStart,\n open,\n onOpenChange,\n ...rest\n}: ScopedProps<AssistantModalPrimitiveRoot.Props>) => {\n const scope = usePopoverScope(__scopeAssistantModal);\n\n const [modalOpen, setOpen] = useAssistantModalOpenState({\n defaultOpen,\n unstable_openOnRunStart,\n });\n\n return (\n <PopoverPrimitive.Root\n {...scope}\n open={open === undefined ? modalOpen : open}\n onOpenChange={composeEventHandlers(onOpenChange, setOpen)}\n {...rest}\n />\n );\n};\n\nAssistantModalPrimitiveRoot.displayName = \"AssistantModalPrimitive.Root\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAwC;AACxC,uBAAkC;AAClC,uBAAqC;AACrC,mBAA6C;AAC7C,qBAAiC;AAqD7B;AA7CJ,IAAM,6BAA6B,CAAC;AAAA,EAClC,cAAc;AAAA,EACd,0BAA0B;AAC5B,MAGM;AACJ,QAAM,YAAQ,uBAAS,WAAW;AAElC,QAAM,CAAC,EAAE,OAAO,IAAI;AACpB,QAAM,oBAAgB,iCAAiB;AACvC,8BAAU,MAAM;AACd,QAAI,CAAC,wBAAyB,QAAO;AAErC,WAAO,cAAc,YAAY,aAAa,MAAM;AAClD,cAAQ,IAAI;AAAA,IACd,CAAC;AAAA,EACH,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;AAEO,IAAM,8BAET,CAAC;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsD;AACpD,QAAM,YAAQ,8BAAgB,qBAAqB;AAEnD,QAAM,CAAC,WAAW,OAAO,IAAI,2BAA2B;AAAA,IACtD;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAkB;AAAA,IAAjB;AAAA,MACE,GAAG;AAAA,MACJ,MAAM,SAAS,SAAY,YAAY;AAAA,MACvC,kBAAc,uCAAqB,cAAc,OAAO;AAAA,MACvD,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,4BAA4B,cAAc;","names":[]}
|
@@ -19,7 +19,12 @@ var useAssistantModalOpenState = ({
|
|
19
19
|
return threadRuntime.unstable_on("run-start", () => {
|
20
20
|
setOpen(true);
|
21
21
|
});
|
22
|
-
}, [
|
22
|
+
}, [
|
23
|
+
unstable_openOnRunStart,
|
24
|
+
setOpen,
|
25
|
+
threadRuntime,
|
26
|
+
!unstable_openOnRunStart
|
27
|
+
]);
|
23
28
|
return state;
|
24
29
|
};
|
25
30
|
var AssistantModalPrimitiveRoot = ({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { ScopedProps, usePopoverScope } from \"./scope\";\nimport { useThreadRuntime } from \"../../context\";\n\nexport namespace AssistantModalPrimitiveRoot {\n export type Props = PopoverPrimitive.PopoverProps & {\n unstable_openOnRunStart?: boolean | undefined;\n };\n}\n\nconst useAssistantModalOpenState = ({\n defaultOpen = false,\n unstable_openOnRunStart = true,\n}: {\n defaultOpen?: boolean | undefined;\n unstable_openOnRunStart?: boolean | undefined;\n}) => {\n const state = useState(defaultOpen);\n\n const [, setOpen] = state;\n const threadRuntime = useThreadRuntime();\n useEffect(() => {\n if (!unstable_openOnRunStart) return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", () => {\n setOpen(true);\n });\n }, [unstable_openOnRunStart]);\n\n return state;\n};\n\nexport const AssistantModalPrimitiveRoot: FC<\n AssistantModalPrimitiveRoot.Props\n> = ({\n __scopeAssistantModal,\n defaultOpen,\n unstable_openOnRunStart,\n open,\n onOpenChange,\n ...rest\n}: ScopedProps<AssistantModalPrimitiveRoot.Props>) => {\n const scope = usePopoverScope(__scopeAssistantModal);\n\n const [modalOpen, setOpen] = useAssistantModalOpenState({\n defaultOpen,\n unstable_openOnRunStart,\n });\n\n return (\n <PopoverPrimitive.Root\n {...scope}\n open={open === undefined ? modalOpen : open}\n onOpenChange={composeEventHandlers(onOpenChange, setOpen)}\n {...rest}\n />\n );\n};\n\nAssistantModalPrimitiveRoot.displayName = \"AssistantModalPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAa,WAAW,gBAAgB;AACxC,YAAY,sBAAsB;AAClC,SAAS,4BAA4B;AACrC,SAAsB,uBAAuB;AAC7C,SAAS,wBAAwB;
|
1
|
+
{"version":3,"sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { ScopedProps, usePopoverScope } from \"./scope\";\nimport { useThreadRuntime } from \"../../context\";\n\nexport namespace AssistantModalPrimitiveRoot {\n export type Props = PopoverPrimitive.PopoverProps & {\n unstable_openOnRunStart?: boolean | undefined;\n };\n}\n\nconst useAssistantModalOpenState = ({\n defaultOpen = false,\n unstable_openOnRunStart = true,\n}: {\n defaultOpen?: boolean | undefined;\n unstable_openOnRunStart?: boolean | undefined;\n}) => {\n const state = useState(defaultOpen);\n\n const [, setOpen] = state;\n const threadRuntime = useThreadRuntime();\n useEffect(() => {\n if (!unstable_openOnRunStart) return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", () => {\n setOpen(true);\n });\n }, [\n unstable_openOnRunStart,\n setOpen,\n threadRuntime,\n !unstable_openOnRunStart,\n ]);\n\n return state;\n};\n\nexport const AssistantModalPrimitiveRoot: FC<\n AssistantModalPrimitiveRoot.Props\n> = ({\n __scopeAssistantModal,\n defaultOpen,\n unstable_openOnRunStart,\n open,\n onOpenChange,\n ...rest\n}: ScopedProps<AssistantModalPrimitiveRoot.Props>) => {\n const scope = usePopoverScope(__scopeAssistantModal);\n\n const [modalOpen, setOpen] = useAssistantModalOpenState({\n defaultOpen,\n unstable_openOnRunStart,\n });\n\n return (\n <PopoverPrimitive.Root\n {...scope}\n open={open === undefined ? modalOpen : open}\n onOpenChange={composeEventHandlers(onOpenChange, setOpen)}\n {...rest}\n />\n );\n};\n\nAssistantModalPrimitiveRoot.displayName = \"AssistantModalPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAa,WAAW,gBAAgB;AACxC,YAAY,sBAAsB;AAClC,SAAS,4BAA4B;AACrC,SAAsB,uBAAuB;AAC7C,SAAS,wBAAwB;AAqD7B;AA7CJ,IAAM,6BAA6B,CAAC;AAAA,EAClC,cAAc;AAAA,EACd,0BAA0B;AAC5B,MAGM;AACJ,QAAM,QAAQ,SAAS,WAAW;AAElC,QAAM,CAAC,EAAE,OAAO,IAAI;AACpB,QAAM,gBAAgB,iBAAiB;AACvC,YAAU,MAAM;AACd,QAAI,CAAC,wBAAyB,QAAO;AAErC,WAAO,cAAc,YAAY,aAAa,MAAM;AAClD,cAAQ,IAAI;AAAA,IACd,CAAC;AAAA,EACH,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;AAEO,IAAM,8BAET,CAAC;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsD;AACpD,QAAM,QAAQ,gBAAgB,qBAAqB;AAEnD,QAAM,CAAC,WAAW,OAAO,IAAI,2BAA2B;AAAA,IACtD;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAkB;AAAA,IAAjB;AAAA,MACE,GAAG;AAAA,MACJ,MAAM,SAAS,SAAY,YAAY;AAAA,MACvC,cAAc,qBAAqB,cAAc,OAAO;AAAA,MACvD,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,4BAA4B,cAAc;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ComposerInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerInput.tsx"],"names":[],"mappings":"AAYA,OAAyB,EACvB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAUjC,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,qBAAqB,GAAG;QAC1C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC9B,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACpC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACrC,wBAAwB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC/C,8BAA8B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACrD,8BAA8B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACtD,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB;cATrB,OAAO,GAAG,SAAS;oBACb,OAAO,GAAG,SAAS;qBAClB,OAAO,GAAG,SAAS;+BACT,OAAO,GAAG,SAAS;qCACb,OAAO,GAAG,SAAS;qCACnB,OAAO,GAAG,SAAS;
|
1
|
+
{"version":3,"file":"ComposerInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerInput.tsx"],"names":[],"mappings":"AAYA,OAAyB,EACvB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAUjC,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,qBAAqB,GAAG;QAC1C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC9B,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACpC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACrC,wBAAwB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC/C,8BAA8B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACrD,8BAA8B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACtD,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB;cATrB,OAAO,GAAG,SAAS;oBACb,OAAO,GAAG,SAAS;qBAClB,OAAO,GAAG,SAAS;+BACT,OAAO,GAAG,SAAS;qCACb,OAAO,GAAG,SAAS;qCACnB,OAAO,GAAG,SAAS;uDAoHvD,CAAC"}
|
@@ -105,12 +105,17 @@ var ComposerPrimitiveInput = (0, import_react.forwardRef)(
|
|
105
105
|
if (composerRuntime.type !== "thread" || !unstable_focusOnRunStart)
|
106
106
|
return void 0;
|
107
107
|
return threadRuntime.unstable_on("run-start", focus);
|
108
|
-
}, [unstable_focusOnRunStart]);
|
108
|
+
}, [unstable_focusOnRunStart, focus, composerRuntime, threadRuntime]);
|
109
109
|
(0, import_react.useEffect)(() => {
|
110
110
|
if (composerRuntime.type !== "thread" || !unstable_focusOnThreadSwitched)
|
111
111
|
return void 0;
|
112
112
|
return threadListItemRuntime.unstable_on("switched-to", focus);
|
113
|
-
}, [
|
113
|
+
}, [
|
114
|
+
unstable_focusOnThreadSwitched,
|
115
|
+
focus,
|
116
|
+
composerRuntime,
|
117
|
+
threadListItemRuntime
|
118
|
+
]);
|
114
119
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
115
120
|
Component,
|
116
121
|
{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport {\n useComposer,\n useComposerRuntime,\n} from \"../../context/react/ComposerContext\";\nimport { useThread, useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n export type Props = TextareaAutosizeProps & {\n asChild?: boolean | undefined;\n submitOnEnter?: boolean | undefined;\n cancelOnEscape?: boolean | undefined;\n unstable_focusOnRunStart?: boolean | undefined;\n unstable_focusOnScrollToBottom?: boolean | undefined;\n unstable_focusOnThreadSwitched?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n submitOnEnter = true,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const threadRuntime = useThreadRuntime();\n const composerRuntime = useComposerRuntime();\n\n const value = useComposer((c) => {\n if (!c.isEditing) return \"\";\n return c.text;\n });\n\n const Component = asChild ? Slot : TextareaAutosize;\n\n const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n\n useEscapeKeydown((e) => {\n if (!cancelOnEscape) return;\n\n if (composerRuntime.getState().canCancel) {\n composerRuntime.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled || !submitOnEnter) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n if (e.key === \"Enter\" && e.shiftKey === false) {\n const { isRunning } = threadRuntime.getState();\n\n if (!isRunning) {\n e.preventDefault();\n\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (composerRuntime.type === \"thread\" && unstable_focusOnScrollToBottom) {\n focus();\n }\n });\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnRunStart)\n return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", focus);\n }, [unstable_focusOnRunStart]);\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnThreadSwitched)\n return undefined;\n\n return threadListItemRuntime.unstable_on(\"switched-to\", focus);\n }, [unstable_focusOnThreadSwitched]);\n\n return (\n <Component\n name=\"input\"\n value={value}\n {...rest}\n ref={ref}\n disabled={isDisabled}\n onChange={composeEventHandlers(onChange, (e) => {\n if (!composerRuntime.getState().isEditing) return;\n return composerRuntime.setText(e.target.value);\n })}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyPress)}\n />\n );\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uBAAqC;AACrC,gCAAgC;AAChC,wBAAqB;AACrB,mBAMO;AACP,qCAEO;AACP,6BAGO;AACP,2BAA4C;AAC5C,sCAAiC;AACjC,iCAAoC;AACpC,mCAAyC;
|
1
|
+
{"version":3,"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport {\n useComposer,\n useComposerRuntime,\n} from \"../../context/react/ComposerContext\";\nimport { useThread, useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n export type Props = TextareaAutosizeProps & {\n asChild?: boolean | undefined;\n submitOnEnter?: boolean | undefined;\n cancelOnEscape?: boolean | undefined;\n unstable_focusOnRunStart?: boolean | undefined;\n unstable_focusOnScrollToBottom?: boolean | undefined;\n unstable_focusOnThreadSwitched?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n submitOnEnter = true,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const threadRuntime = useThreadRuntime();\n const composerRuntime = useComposerRuntime();\n\n const value = useComposer((c) => {\n if (!c.isEditing) return \"\";\n return c.text;\n });\n\n const Component = asChild ? Slot : TextareaAutosize;\n\n const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n\n useEscapeKeydown((e) => {\n if (!cancelOnEscape) return;\n\n if (composerRuntime.getState().canCancel) {\n composerRuntime.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled || !submitOnEnter) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n if (e.key === \"Enter\" && e.shiftKey === false) {\n const { isRunning } = threadRuntime.getState();\n\n if (!isRunning) {\n e.preventDefault();\n\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (composerRuntime.type === \"thread\" && unstable_focusOnScrollToBottom) {\n focus();\n }\n });\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnRunStart)\n return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", focus);\n }, [unstable_focusOnRunStart, focus, composerRuntime, threadRuntime]);\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnThreadSwitched)\n return undefined;\n\n return threadListItemRuntime.unstable_on(\"switched-to\", focus);\n }, [\n unstable_focusOnThreadSwitched,\n focus,\n composerRuntime,\n threadListItemRuntime,\n ]);\n\n return (\n <Component\n name=\"input\"\n value={value}\n {...rest}\n ref={ref}\n disabled={isDisabled}\n onChange={composeEventHandlers(onChange, (e) => {\n if (!composerRuntime.getState().isEditing) return;\n return composerRuntime.setText(e.target.value);\n })}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyPress)}\n />\n );\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":"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","names":["TextareaAutosize"]}
|
@@ -80,12 +80,17 @@ var ComposerPrimitiveInput = forwardRef(
|
|
80
80
|
if (composerRuntime.type !== "thread" || !unstable_focusOnRunStart)
|
81
81
|
return void 0;
|
82
82
|
return threadRuntime.unstable_on("run-start", focus);
|
83
|
-
}, [unstable_focusOnRunStart]);
|
83
|
+
}, [unstable_focusOnRunStart, focus, composerRuntime, threadRuntime]);
|
84
84
|
useEffect(() => {
|
85
85
|
if (composerRuntime.type !== "thread" || !unstable_focusOnThreadSwitched)
|
86
86
|
return void 0;
|
87
87
|
return threadListItemRuntime.unstable_on("switched-to", focus);
|
88
|
-
}, [
|
88
|
+
}, [
|
89
|
+
unstable_focusOnThreadSwitched,
|
90
|
+
focus,
|
91
|
+
composerRuntime,
|
92
|
+
threadListItemRuntime
|
93
|
+
]);
|
89
94
|
return /* @__PURE__ */ jsx(
|
90
95
|
Component,
|
91
96
|
{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport {\n useComposer,\n useComposerRuntime,\n} from \"../../context/react/ComposerContext\";\nimport { useThread, useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n export type Props = TextareaAutosizeProps & {\n asChild?: boolean | undefined;\n submitOnEnter?: boolean | undefined;\n cancelOnEscape?: boolean | undefined;\n unstable_focusOnRunStart?: boolean | undefined;\n unstable_focusOnScrollToBottom?: boolean | undefined;\n unstable_focusOnThreadSwitched?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n submitOnEnter = true,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const threadRuntime = useThreadRuntime();\n const composerRuntime = useComposerRuntime();\n\n const value = useComposer((c) => {\n if (!c.isEditing) return \"\";\n return c.text;\n });\n\n const Component = asChild ? Slot : TextareaAutosize;\n\n const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n\n useEscapeKeydown((e) => {\n if (!cancelOnEscape) return;\n\n if (composerRuntime.getState().canCancel) {\n composerRuntime.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled || !submitOnEnter) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n if (e.key === \"Enter\" && e.shiftKey === false) {\n const { isRunning } = threadRuntime.getState();\n\n if (!isRunning) {\n e.preventDefault();\n\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (composerRuntime.type === \"thread\" && unstable_focusOnScrollToBottom) {\n focus();\n }\n });\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnRunStart)\n return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", focus);\n }, [unstable_focusOnRunStart]);\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnThreadSwitched)\n return undefined;\n\n return threadListItemRuntime.unstable_on(\"switched-to\", focus);\n }, [unstable_focusOnThreadSwitched]);\n\n return (\n <Component\n name=\"input\"\n value={value}\n {...rest}\n ref={ref}\n disabled={isDisabled}\n onChange={composeEventHandlers(onChange, (e) => {\n if (!composerRuntime.getState().isEditing) return;\n return composerRuntime.setText(e.target.value);\n })}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyPress)}\n />\n );\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":";;;AAEA,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,YAAY;AACrB;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,sBAEA;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW,wBAAwB;AAC5C,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,gCAAgC;
|
1
|
+
{"version":3,"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport {\n useComposer,\n useComposerRuntime,\n} from \"../../context/react/ComposerContext\";\nimport { useThread, useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n export type Props = TextareaAutosizeProps & {\n asChild?: boolean | undefined;\n submitOnEnter?: boolean | undefined;\n cancelOnEscape?: boolean | undefined;\n unstable_focusOnRunStart?: boolean | undefined;\n unstable_focusOnScrollToBottom?: boolean | undefined;\n unstable_focusOnThreadSwitched?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n submitOnEnter = true,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const threadRuntime = useThreadRuntime();\n const composerRuntime = useComposerRuntime();\n\n const value = useComposer((c) => {\n if (!c.isEditing) return \"\";\n return c.text;\n });\n\n const Component = asChild ? Slot : TextareaAutosize;\n\n const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n\n useEscapeKeydown((e) => {\n if (!cancelOnEscape) return;\n\n if (composerRuntime.getState().canCancel) {\n composerRuntime.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled || !submitOnEnter) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n if (e.key === \"Enter\" && e.shiftKey === false) {\n const { isRunning } = threadRuntime.getState();\n\n if (!isRunning) {\n e.preventDefault();\n\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (composerRuntime.type === \"thread\" && unstable_focusOnScrollToBottom) {\n focus();\n }\n });\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnRunStart)\n return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", focus);\n }, [unstable_focusOnRunStart, focus, composerRuntime, threadRuntime]);\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnThreadSwitched)\n return undefined;\n\n return threadListItemRuntime.unstable_on(\"switched-to\", focus);\n }, [\n unstable_focusOnThreadSwitched,\n focus,\n composerRuntime,\n threadListItemRuntime,\n ]);\n\n return (\n <Component\n name=\"input\"\n value={value}\n {...rest}\n ref={ref}\n disabled={isDisabled}\n onChange={composeEventHandlers(onChange, (e) => {\n if (!composerRuntime.getState().isEditing) return;\n return composerRuntime.setText(e.target.value);\n })}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyPress)}\n />\n );\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":"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","names":[]}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { FileContentPart } from "../../types";
|
2
|
+
export declare const useContentPartFile: () => FileContentPart & {
|
3
|
+
readonly status: import("../../types/AssistantTypes").ContentPartStatus | import("../../types/AssistantTypes").ToolCallContentPartStatus;
|
4
|
+
};
|
5
|
+
//# sourceMappingURL=useContentPartFile.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useContentPartFile.d.ts","sourceRoot":"","sources":["../../../src/primitives/contentPart/useContentPartFile.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,kBAAkB;;CAW9B,CAAC"}
|
package/dist/{runtimes/edge/streams/utils/index.js → primitives/contentPart/useContentPartFile.js}
RENAMED
@@ -1,4 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
+
"use client";
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -17,20 +18,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
18
|
};
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
20
|
|
20
|
-
// src/
|
21
|
-
var
|
22
|
-
__export(
|
23
|
-
|
21
|
+
// src/primitives/contentPart/useContentPartFile.tsx
|
22
|
+
var useContentPartFile_exports = {};
|
23
|
+
__export(useContentPartFile_exports, {
|
24
|
+
useContentPartFile: () => useContentPartFile
|
24
25
|
});
|
25
|
-
module.exports = __toCommonJS(
|
26
|
-
var
|
27
|
-
var
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
module.exports = __toCommonJS(useContentPartFile_exports);
|
27
|
+
var import_ContentPartContext = require("../../context/react/ContentPartContext.js");
|
28
|
+
var useContentPartFile = () => {
|
29
|
+
const file = (0, import_ContentPartContext.useContentPart)((c) => {
|
30
|
+
if (c.type !== "file")
|
31
|
+
throw new Error(
|
32
|
+
"ContentPartFile can only be used inside file content parts."
|
33
|
+
);
|
34
|
+
return c;
|
35
|
+
});
|
36
|
+
return file;
|
31
37
|
};
|
32
38
|
// Annotate the CommonJS export names for ESM import in node:
|
33
39
|
0 && (module.exports = {
|
34
|
-
|
40
|
+
useContentPartFile
|
35
41
|
});
|
36
|
-
//# sourceMappingURL=
|
42
|
+
//# sourceMappingURL=useContentPartFile.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/primitives/contentPart/useContentPartFile.tsx"],"sourcesContent":["\"use client\";\n\nimport { ContentPartState } from \"../../api/ContentPartRuntime\";\nimport { useContentPart } from \"../../context/react/ContentPartContext\";\nimport { FileContentPart } from \"../../types\";\n\nexport const useContentPartFile = () => {\n const file = useContentPart((c) => {\n if (c.type !== \"file\")\n throw new Error(\n \"ContentPartFile can only be used inside file content parts.\",\n );\n\n return c as ContentPartState & FileContentPart;\n });\n\n return file;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAA+B;AAGxB,IAAM,qBAAqB,MAAM;AACtC,QAAM,WAAO,0CAAe,CAAC,MAAM;AACjC,QAAI,EAAE,SAAS;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO;AAAA,EACT,CAAC;AAED,SAAO;AACT;","names":[]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
// src/primitives/contentPart/useContentPartFile.tsx
|
4
|
+
import { useContentPart } from "../../context/react/ContentPartContext.mjs";
|
5
|
+
var useContentPartFile = () => {
|
6
|
+
const file = useContentPart((c) => {
|
7
|
+
if (c.type !== "file")
|
8
|
+
throw new Error(
|
9
|
+
"ContentPartFile can only be used inside file content parts."
|
10
|
+
);
|
11
|
+
return c;
|
12
|
+
});
|
13
|
+
return file;
|
14
|
+
};
|
15
|
+
export {
|
16
|
+
useContentPartFile
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=useContentPartFile.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/primitives/contentPart/useContentPartFile.tsx"],"sourcesContent":["\"use client\";\n\nimport { ContentPartState } from \"../../api/ContentPartRuntime\";\nimport { useContentPart } from \"../../context/react/ContentPartContext\";\nimport { FileContentPart } from \"../../types\";\n\nexport const useContentPartFile = () => {\n const file = useContentPart((c) => {\n if (c.type !== \"file\")\n throw new Error(\n \"ContentPartFile can only be used inside file content parts.\",\n );\n\n return c as ContentPartState & FileContentPart;\n });\n\n return file;\n};\n"],"mappings":";;;AAGA,SAAS,sBAAsB;AAGxB,IAAM,qBAAqB,MAAM;AACtC,QAAM,OAAO,eAAe,CAAC,MAAM;AACjC,QAAI,EAAE,SAAS;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO;AAAA,EACT,CAAC;AAED,SAAO;AACT;","names":[]}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { SourceContentPart } from "../../types";
|
2
|
+
export declare const useContentPartSource: () => SourceContentPart & {
|
3
|
+
readonly status: import("../../types/AssistantTypes").ContentPartStatus | import("../../types/AssistantTypes").ToolCallContentPartStatus;
|
4
|
+
};
|
5
|
+
//# sourceMappingURL=useContentPartSource.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useContentPartSource.d.ts","sourceRoot":"","sources":["../../../src/primitives/contentPart/useContentPartSource.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,oBAAoB;;CAWhC,CAAC"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
+
"use client";
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -17,24 +18,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
18
|
};
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
20
|
|
20
|
-
// src/
|
21
|
-
var
|
22
|
-
__export(
|
23
|
-
|
21
|
+
// src/primitives/contentPart/useContentPartSource.tsx
|
22
|
+
var useContentPartSource_exports = {};
|
23
|
+
__export(useContentPartSource_exports, {
|
24
|
+
useContentPartSource: () => useContentPartSource
|
24
25
|
});
|
25
|
-
module.exports = __toCommonJS(
|
26
|
-
var
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
26
|
+
module.exports = __toCommonJS(useContentPartSource_exports);
|
27
|
+
var import_ContentPartContext = require("../../context/react/ContentPartContext.js");
|
28
|
+
var useContentPartSource = () => {
|
29
|
+
const source = (0, import_ContentPartContext.useContentPart)((c) => {
|
30
|
+
if (c.type !== "source")
|
31
|
+
throw new Error(
|
32
|
+
"ContentPartSource can only be used inside source content parts."
|
33
|
+
);
|
34
|
+
return c;
|
35
|
+
});
|
36
|
+
return source;
|
35
37
|
};
|
36
38
|
// Annotate the CommonJS export names for ESM import in node:
|
37
39
|
0 && (module.exports = {
|
38
|
-
|
40
|
+
useContentPartSource
|
39
41
|
});
|
40
|
-
//# sourceMappingURL=
|
42
|
+
//# sourceMappingURL=useContentPartSource.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/primitives/contentPart/useContentPartSource.tsx"],"sourcesContent":["\"use client\";\n\nimport { ContentPartState } from \"../../api/ContentPartRuntime\";\nimport { useContentPart } from \"../../context/react/ContentPartContext\";\nimport { SourceContentPart } from \"../../types\";\n\nexport const useContentPartSource = () => {\n const source = useContentPart((c) => {\n if (c.type !== \"source\")\n throw new Error(\n \"ContentPartSource can only be used inside source content parts.\",\n );\n\n return c as ContentPartState & SourceContentPart;\n });\n\n return source;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAA+B;AAGxB,IAAM,uBAAuB,MAAM;AACxC,QAAM,aAAS,0CAAe,CAAC,MAAM;AACnC,QAAI,EAAE,SAAS;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO;AAAA,EACT,CAAC;AAED,SAAO;AACT;","names":[]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
// src/primitives/contentPart/useContentPartSource.tsx
|
4
|
+
import { useContentPart } from "../../context/react/ContentPartContext.mjs";
|
5
|
+
var useContentPartSource = () => {
|
6
|
+
const source = useContentPart((c) => {
|
7
|
+
if (c.type !== "source")
|
8
|
+
throw new Error(
|
9
|
+
"ContentPartSource can only be used inside source content parts."
|
10
|
+
);
|
11
|
+
return c;
|
12
|
+
});
|
13
|
+
return source;
|
14
|
+
};
|
15
|
+
export {
|
16
|
+
useContentPartSource
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=useContentPartSource.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/primitives/contentPart/useContentPartSource.tsx"],"sourcesContent":["\"use client\";\n\nimport { ContentPartState } from \"../../api/ContentPartRuntime\";\nimport { useContentPart } from \"../../context/react/ContentPartContext\";\nimport { SourceContentPart } from \"../../types\";\n\nexport const useContentPartSource = () => {\n const source = useContentPart((c) => {\n if (c.type !== \"source\")\n throw new Error(\n \"ContentPartSource can only be used inside source content parts.\",\n );\n\n return c as ContentPartState & SourceContentPart;\n });\n\n return source;\n};\n"],"mappings":";;;AAGA,SAAS,sBAAsB;AAGxB,IAAM,uBAAuB,MAAM;AACxC,QAAM,SAAS,eAAe,CAAC,MAAM;AACnC,QAAI,EAAE,SAAS;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO;AAAA,EACT,CAAC;AAED,SAAO;AACT;","names":[]}
|
@@ -8,8 +8,10 @@ export * as MessagePrimitive from "./message";
|
|
8
8
|
export * as ThreadPrimitive from "./thread";
|
9
9
|
export * as ThreadListPrimitive from "./threadList";
|
10
10
|
export * as ThreadListItemPrimitive from "./threadListItem";
|
11
|
-
export { useContentPartImage } from "./contentPart/useContentPartImage";
|
12
11
|
export { useContentPartText } from "./contentPart/useContentPartText";
|
13
12
|
export { useContentPartReasoning } from "./contentPart/useContentPartReasoning";
|
13
|
+
export { useContentPartSource } from "./contentPart/useContentPartSource";
|
14
|
+
export { useContentPartFile } from "./contentPart/useContentPartFile";
|
15
|
+
export { useContentPartImage } from "./contentPart/useContentPartImage";
|
14
16
|
export { useThreadViewportAutoScroll } from "./thread/useThreadViewportAutoScroll";
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,qBAAqB,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,iBAAiB,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,oBAAoB,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,eAAe,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,qBAAqB,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,iBAAiB,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,oBAAoB,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,eAAe,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC"}
|
package/dist/primitives/index.js
CHANGED
@@ -40,8 +40,10 @@ __export(primitives_exports, {
|
|
40
40
|
ThreadListItemPrimitive: () => ThreadListItemPrimitive,
|
41
41
|
ThreadListPrimitive: () => ThreadListPrimitive,
|
42
42
|
ThreadPrimitive: () => ThreadPrimitive,
|
43
|
+
useContentPartFile: () => import_useContentPartFile.useContentPartFile,
|
43
44
|
useContentPartImage: () => import_useContentPartImage.useContentPartImage,
|
44
45
|
useContentPartReasoning: () => import_useContentPartReasoning.useContentPartReasoning,
|
46
|
+
useContentPartSource: () => import_useContentPartSource.useContentPartSource,
|
45
47
|
useContentPartText: () => import_useContentPartText.useContentPartText,
|
46
48
|
useThreadViewportAutoScroll: () => import_useThreadViewportAutoScroll.useThreadViewportAutoScroll
|
47
49
|
});
|
@@ -56,9 +58,11 @@ var MessagePrimitive = __toESM(require("./message/index.js"));
|
|
56
58
|
var ThreadPrimitive = __toESM(require("./thread/index.js"));
|
57
59
|
var ThreadListPrimitive = __toESM(require("./threadList/index.js"));
|
58
60
|
var ThreadListItemPrimitive = __toESM(require("./threadListItem/index.js"));
|
59
|
-
var import_useContentPartImage = require("./contentPart/useContentPartImage.js");
|
60
61
|
var import_useContentPartText = require("./contentPart/useContentPartText.js");
|
61
62
|
var import_useContentPartReasoning = require("./contentPart/useContentPartReasoning.js");
|
63
|
+
var import_useContentPartSource = require("./contentPart/useContentPartSource.js");
|
64
|
+
var import_useContentPartFile = require("./contentPart/useContentPartFile.js");
|
65
|
+
var import_useContentPartImage = require("./contentPart/useContentPartImage.js");
|
62
66
|
var import_useThreadViewportAutoScroll = require("./thread/useThreadViewportAutoScroll.js");
|
63
67
|
// Annotate the CommonJS export names for ESM import in node:
|
64
68
|
0 && (module.exports = {
|
@@ -72,8 +76,10 @@ var import_useThreadViewportAutoScroll = require("./thread/useThreadViewportAuto
|
|
72
76
|
ThreadListItemPrimitive,
|
73
77
|
ThreadListPrimitive,
|
74
78
|
ThreadPrimitive,
|
79
|
+
useContentPartFile,
|
75
80
|
useContentPartImage,
|
76
81
|
useContentPartReasoning,
|
82
|
+
useContentPartSource,
|
77
83
|
useContentPartText,
|
78
84
|
useThreadViewportAutoScroll
|
79
85
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport {
|
1
|
+
{"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\nexport { useContentPartReasoning } from \"./contentPart/useContentPartReasoning\";\nexport { useContentPartSource } from \"./contentPart/useContentPartSource\";\nexport { useContentPartFile } from \"./contentPart/useContentPartFile\";\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useThreadViewportAutoScroll } from \"./thread/useThreadViewportAutoScroll\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAoC;AACpC,8BAAyC;AACzC,0BAAqC;AACrC,4BAAuC;AACvC,wBAAmC;AACnC,2BAAsC;AACtC,uBAAkC;AAClC,sBAAiC;AACjC,0BAAqC;AACrC,8BAAyC;AAEzC,gCAAmC;AACnC,qCAAwC;AACxC,kCAAqC;AACrC,gCAAmC;AACnC,iCAAoC;AACpC,yCAA4C;","names":[]}
|
@@ -9,9 +9,11 @@ import * as MessagePrimitive from "./message/index.mjs";
|
|
9
9
|
import * as ThreadPrimitive from "./thread/index.mjs";
|
10
10
|
import * as ThreadListPrimitive from "./threadList/index.mjs";
|
11
11
|
import * as ThreadListItemPrimitive from "./threadListItem/index.mjs";
|
12
|
-
import { useContentPartImage } from "./contentPart/useContentPartImage.mjs";
|
13
12
|
import { useContentPartText } from "./contentPart/useContentPartText.mjs";
|
14
13
|
import { useContentPartReasoning } from "./contentPart/useContentPartReasoning.mjs";
|
14
|
+
import { useContentPartSource } from "./contentPart/useContentPartSource.mjs";
|
15
|
+
import { useContentPartFile } from "./contentPart/useContentPartFile.mjs";
|
16
|
+
import { useContentPartImage } from "./contentPart/useContentPartImage.mjs";
|
15
17
|
import { useThreadViewportAutoScroll } from "./thread/useThreadViewportAutoScroll.mjs";
|
16
18
|
export {
|
17
19
|
ActionBarPrimitive,
|
@@ -24,8 +26,10 @@ export {
|
|
24
26
|
ThreadListItemPrimitive,
|
25
27
|
ThreadListPrimitive,
|
26
28
|
ThreadPrimitive,
|
29
|
+
useContentPartFile,
|
27
30
|
useContentPartImage,
|
28
31
|
useContentPartReasoning,
|
32
|
+
useContentPartSource,
|
29
33
|
useContentPartText,
|
30
34
|
useThreadViewportAutoScroll
|
31
35
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport {
|
1
|
+
{"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\nexport { useContentPartReasoning } from \"./contentPart/useContentPartReasoning\";\nexport { useContentPartSource } from \"./contentPart/useContentPartSource\";\nexport { useContentPartFile } from \"./contentPart/useContentPartFile\";\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useThreadViewportAutoScroll } from \"./thread/useThreadViewportAutoScroll\";\n"],"mappings":";AAAA,YAAY,wBAAwB;AACpC,YAAY,6BAA6B;AACzC,YAAY,yBAAyB;AACrC,YAAY,2BAA2B;AACvC,YAAY,uBAAuB;AACnC,YAAY,0BAA0B;AACtC,YAAY,sBAAsB;AAClC,YAAY,qBAAqB;AACjC,YAAY,yBAAyB;AACrC,YAAY,6BAA6B;AAEzC,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AACpC,SAAS,mCAAmC;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadScrollToBottom.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;
|
1
|
+
{"version":3,"file":"ThreadScrollToBottom.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAOxC,QAAA,MAAM,uBAAuB,2BAW5B,CAAC;AAEF,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B;;6DAGzC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {
|
1
|
+
{"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"../../context/react/ThreadViewportContext\";\n\nconst useThreadScrollToBottom = () => {\n const isAtBottom = useThreadViewport((s) => s.isAtBottom);\n\n const threadViewportStore = useThreadViewportStore();\n\n const handleScrollToBottom = useCallback(() => {\n threadViewportStore.getState().scrollToBottom();\n }, [threadViewportStore]);\n\n if (isAtBottom) return null;\n return handleScrollToBottom;\n};\n\nexport namespace ThreadPrimitiveScrollToBottom {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadScrollToBottom>;\n}\n\nexport const ThreadPrimitiveScrollToBottom = createActionButton(\n \"ThreadPrimitive.ScrollToBottom\",\n useThreadScrollToBottom,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAIO;AACP,mBAA4B;AAC5B,mCAGO;AAEP,IAAM,0BAA0B,MAAM;AACpC,QAAM,iBAAa,gDAAkB,CAAC,MAAM,EAAE,UAAU;AAExD,QAAM,0BAAsB,qDAAuB;AAEnD,QAAM,2BAAuB,0BAAY,MAAM;AAC7C,wBAAoB,SAAS,EAAE,eAAe;AAAA,EAChD,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,WAAY,QAAO;AACvB,SAAO;AACT;AAOO,IAAM,oCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
|
@@ -5,7 +5,10 @@ import {
|
|
5
5
|
createActionButton
|
6
6
|
} from "../../utils/createActionButton.mjs";
|
7
7
|
import { useCallback } from "react";
|
8
|
-
import {
|
8
|
+
import {
|
9
|
+
useThreadViewport,
|
10
|
+
useThreadViewportStore
|
11
|
+
} from "../../context/react/ThreadViewportContext.mjs";
|
9
12
|
var useThreadScrollToBottom = () => {
|
10
13
|
const isAtBottom = useThreadViewport((s) => s.isAtBottom);
|
11
14
|
const threadViewportStore = useThreadViewportStore();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {
|
1
|
+
{"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"../../context/react/ThreadViewportContext\";\n\nconst useThreadScrollToBottom = () => {\n const isAtBottom = useThreadViewport((s) => s.isAtBottom);\n\n const threadViewportStore = useThreadViewportStore();\n\n const handleScrollToBottom = useCallback(() => {\n threadViewportStore.getState().scrollToBottom();\n }, [threadViewportStore]);\n\n if (isAtBottom) return null;\n return handleScrollToBottom;\n};\n\nexport namespace ThreadPrimitiveScrollToBottom {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadScrollToBottom>;\n}\n\nexport const ThreadPrimitiveScrollToBottom = createActionButton(\n \"ThreadPrimitive.ScrollToBottom\",\n useThreadScrollToBottom,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,IAAM,0BAA0B,MAAM;AACpC,QAAM,aAAa,kBAAkB,CAAC,MAAM,EAAE,UAAU;AAExD,QAAM,sBAAsB,uBAAuB;AAEnD,QAAM,uBAAuB,YAAY,MAAM;AAC7C,wBAAoB,SAAS,EAAE,eAAe;AAAA,EAChD,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,WAAY,QAAO;AACvB,SAAO;AACT;AAOO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAIhF,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG;QACnE,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAClC,CAAC;CACH;
|
1
|
+
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAIhF,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG;QACnE,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAClC,CAAC;CACH;AAsBD,eAAO,MAAM,uBAAuB;;;iBAxBnB,OAAO,GAAG,SAAS;kDAiClC,CAAC"}
|
@@ -37,6 +37,7 @@ var ThreadPrimitiveViewportScrollable = (0, import_react.forwardRef)(({ autoScro
|
|
37
37
|
const ref = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, autoScrollRef);
|
38
38
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...rest, ref, children });
|
39
39
|
});
|
40
|
+
ThreadPrimitiveViewportScrollable.displayName = "ThreadPrimitive.ViewportScrollable";
|
40
41
|
var ThreadPrimitiveViewport = (0, import_react.forwardRef)((props, ref) => {
|
41
42
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThreadViewportProvider.ThreadViewportProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThreadPrimitiveViewportScrollable, { ...props, ref }) });
|
42
43
|
});
|