@assistant-ui/react 0.15.31 → 0.15.32
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/_virtual/_rolldown/runtime.js +1 -2
- package/dist/adapters/OpenAIRealtimeVoiceAdapter.js +1 -2
- package/dist/assistant-transport.js +1 -2
- package/dist/cloud-renderer/CloudRendererHost.js +1 -2
- package/dist/context/ReadonlyStore.js +1 -2
- package/dist/context/providers/MessageProvider.js +1 -2
- package/dist/context/providers/ThreadViewportProvider.js +1 -2
- package/dist/context/react/ThreadViewportContext.js +1 -2
- package/dist/context/react/utils/createContextHook.js +1 -2
- package/dist/context/react/utils/createContextStoreHook.js +1 -2
- package/dist/context/stores/ThreadViewport.js +1 -2
- package/dist/devtools/DevToolsHooks.js +1 -2
- package/dist/hooks/useMessageQuote.js +1 -2
- package/dist/hooks/useMessageTiming.js +1 -2
- package/dist/hooks/useToolCallElapsed.js +1 -2
- package/dist/internal.js +1 -2
- package/dist/legacy-runtime/AssistantRuntimeProvider.js +1 -2
- package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppRenderer.js +3 -3
- package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
- package/dist/mcp-apps/McpAppsRemoteHost.js +1 -2
- package/dist/mcp-apps/app-frame.js +1 -2
- package/dist/mcp-apps/bridge.js +1 -2
- package/dist/mcp-apps/csp.js +1 -2
- package/dist/mcp-apps/types.js +1 -2
- package/dist/mcp-apps/utils.js +1 -2
- package/dist/model-context/frame/useAssistantFrameHost.js +1 -2
- package/dist/model-context/makeAssistantVisible.js +1 -2
- package/dist/primitives/actionBar/ActionBarCopy.js +1 -2
- package/dist/primitives/actionBar/ActionBarEdit.js +1 -2
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js +1 -2
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +1 -2
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +1 -2
- package/dist/primitives/actionBar/ActionBarInteractionContext.js +1 -2
- package/dist/primitives/actionBar/ActionBarReload.js +1 -2
- package/dist/primitives/actionBar/ActionBarRoot.js +1 -2
- package/dist/primitives/actionBar/ActionBarSpeak.js +1 -2
- package/dist/primitives/actionBar/ActionBarStopSpeaking.js +1 -2
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +1 -2
- package/dist/primitives/actionBar.js +1 -2
- package/dist/primitives/actionBarMore/ActionBarMoreContent.js +1 -2
- package/dist/primitives/actionBarMore/ActionBarMoreItem.js +1 -2
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +1 -2
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js +1 -2
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js +1 -2
- package/dist/primitives/actionBarMore/scope.js +1 -2
- package/dist/primitives/actionBarMore.js +1 -2
- package/dist/primitives/assistantModal/AssistantModalAnchor.js +1 -2
- package/dist/primitives/assistantModal/AssistantModalContent.js +1 -2
- package/dist/primitives/assistantModal/AssistantModalRoot.js +1 -2
- package/dist/primitives/assistantModal/AssistantModalTrigger.js +1 -2
- package/dist/primitives/assistantModal/popoverRenderPrimitives.js +1 -2
- package/dist/primitives/assistantModal/scope.js +1 -2
- package/dist/primitives/assistantModal.js +1 -2
- package/dist/primitives/attachment/AttachmentName.js +1 -2
- package/dist/primitives/attachment/AttachmentRemove.js +1 -2
- package/dist/primitives/attachment/AttachmentRoot.js +1 -2
- package/dist/primitives/attachment/AttachmentThumb.js +1 -2
- package/dist/primitives/attachment.js +1 -2
- package/dist/primitives/branchPicker/BranchPickerCount.js +1 -2
- package/dist/primitives/branchPicker/BranchPickerNext.js +1 -2
- package/dist/primitives/branchPicker/BranchPickerNumber.js +1 -2
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +1 -2
- package/dist/primitives/branchPicker/BranchPickerRoot.js +1 -2
- package/dist/primitives/branchPicker.js +1 -2
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts +5 -4
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +57 -20
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js +1 -2
- package/dist/primitives/chainOfThought.js +1 -2
- package/dist/primitives/composer/ComposerAddAttachment.js +1 -2
- package/dist/primitives/composer/ComposerAttachmentDropzone.js +1 -2
- package/dist/primitives/composer/ComposerCancel.js +1 -2
- package/dist/primitives/composer/ComposerCompactContext.js +1 -2
- package/dist/primitives/composer/ComposerDictate.js +1 -2
- package/dist/primitives/composer/ComposerDictationTranscript.js +1 -2
- package/dist/primitives/composer/ComposerInput.js +1 -2
- package/dist/primitives/composer/ComposerInputPluginContext.js +1 -2
- package/dist/primitives/composer/ComposerQuote.js +1 -2
- package/dist/primitives/composer/ComposerResume.js +1 -2
- package/dist/primitives/composer/ComposerRoot.js +1 -2
- package/dist/primitives/composer/ComposerSend.js +1 -2
- package/dist/primitives/composer/ComposerStopDictation.js +1 -2
- package/dist/primitives/composer/composerInputSelector.js +1 -2
- package/dist/primitives/composer/trigger/TriggerPopover.js +1 -2
- package/dist/primitives/composer/trigger/TriggerPopoverAction.js +1 -2
- package/dist/primitives/composer/trigger/TriggerPopoverBack.js +1 -2
- package/dist/primitives/composer/trigger/TriggerPopoverCategories.js +1 -2
- package/dist/primitives/composer/trigger/TriggerPopoverDirective.js +1 -2
- package/dist/primitives/composer/trigger/TriggerPopoverItems.js +1 -2
- package/dist/primitives/composer/trigger/TriggerPopoverResource.js +1 -2
- package/dist/primitives/composer/trigger/TriggerPopoverRootContext.js +1 -2
- package/dist/primitives/composer/trigger/detectTrigger.js +1 -2
- package/dist/primitives/composer/trigger/index.js +1 -2
- package/dist/primitives/composer/trigger/matchesTriggerItemQuery.js +1 -2
- package/dist/primitives/composer/trigger/triggerDetectionResource.js +1 -2
- package/dist/primitives/composer/trigger/triggerKeyboardResource.js +1 -2
- package/dist/primitives/composer/trigger/triggerNavigationResource.js +1 -2
- package/dist/primitives/composer/trigger/triggerSelectionResource.js +1 -2
- package/dist/primitives/composer/useComposerCancelWithFocus.js +1 -2
- package/dist/primitives/composer/useComposerInputState.js +1 -2
- package/dist/primitives/composer.js +1 -2
- package/dist/primitives/dropdownMenuRenderPrimitives.js +1 -2
- package/dist/primitives/error/ErrorMessage.js +1 -2
- package/dist/primitives/error/ErrorRoot.js +1 -2
- package/dist/primitives/error.js +1 -2
- package/dist/primitives/message/MessageError.js +1 -2
- package/dist/primitives/message/MessageIf.js +1 -2
- package/dist/primitives/message/MessageParts.js +1 -2
- package/dist/primitives/message/MessagePartsGrouped.js +1 -2
- package/dist/primitives/message/MessageRoot.js +1 -2
- package/dist/primitives/message.js +1 -2
- package/dist/primitives/messagePart/MessagePartImage.js +1 -2
- package/dist/primitives/messagePart/MessagePartText.js +1 -2
- package/dist/primitives/messagePart/useMessagePartData.js +1 -2
- package/dist/primitives/messagePart/useMessagePartFile.js +1 -2
- package/dist/primitives/messagePart/useMessagePartImage.js +1 -2
- package/dist/primitives/messagePart/useMessagePartReasoning.js +1 -2
- package/dist/primitives/messagePart/useMessagePartSource.js +1 -2
- package/dist/primitives/messagePart/useMessagePartText.js +1 -2
- package/dist/primitives/messagePart.js +1 -2
- package/dist/primitives/queueItem/QueueItemRemove.js +1 -2
- package/dist/primitives/queueItem/QueueItemSteer.js +1 -2
- package/dist/primitives/queueItem/QueueItemText.js +1 -2
- package/dist/primitives/queueItem.js +1 -2
- package/dist/primitives/reasoning/useScrollLock.d.ts.map +1 -1
- package/dist/primitives/reasoning/useScrollLock.js +41 -25
- package/dist/primitives/reasoning/useScrollLock.js.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js +1 -2
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js +1 -2
- package/dist/primitives/selectionToolbar.js +1 -2
- package/dist/primitives/suggestion/SuggestionDescription.js +1 -2
- package/dist/primitives/suggestion/SuggestionTitle.js +1 -2
- package/dist/primitives/suggestion/SuggestionTrigger.js +1 -2
- package/dist/primitives/suggestion.js +1 -2
- package/dist/primitives/thread/ThreadEmpty.js +1 -2
- package/dist/primitives/thread/ThreadIf.js +1 -2
- package/dist/primitives/thread/ThreadLoadEarlier.js +1 -2
- package/dist/primitives/thread/ThreadRoot.js +1 -2
- package/dist/primitives/thread/ThreadRootElementContext.js +1 -2
- package/dist/primitives/thread/ThreadScrollToBottom.js +1 -2
- package/dist/primitives/thread/ThreadSuggestion.js +1 -2
- package/dist/primitives/thread/ThreadViewport.js +1 -2
- package/dist/primitives/thread/ThreadViewportFooter.js +1 -2
- package/dist/primitives/thread/topAnchor/computeTopAnchorSlack.js +1 -2
- package/dist/primitives/thread/topAnchor/createReserveObservers.js +1 -2
- package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.js +1 -2
- package/dist/primitives/thread/topAnchor/topAnchorTurn.js +1 -2
- package/dist/primitives/thread/topAnchor/topAnchorUtils.js +1 -2
- package/dist/primitives/thread/topAnchor/useTopAnchorReserve.js +1 -2
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +1 -2
- package/dist/primitives/thread.js +1 -2
- package/dist/primitives/threadList/ThreadListLoadMore.js +1 -2
- package/dist/primitives/threadList/ThreadListNew.js +1 -2
- package/dist/primitives/threadList/ThreadListRoot.js +1 -2
- package/dist/primitives/threadList.js +1 -2
- package/dist/primitives/threadListFocusGroup.js +1 -2
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +1 -2
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +1 -2
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.js +2 -3
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +1 -2
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +1 -2
- package/dist/primitives/threadListItem.js +1 -2
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js +1 -2
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js +1 -2
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js +1 -2
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js +1 -2
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js +1 -2
- package/dist/primitives/threadListItemMore/scope.js +1 -2
- package/dist/primitives/threadListItemMore.js +1 -2
- package/dist/sandbox-host/SandboxHost.js +1 -2
- package/dist/unstable/useComposerInput.js +1 -2
- package/dist/unstable/useComposerInputHistory.js +1 -2
- package/dist/unstable/useLiveCompletionAdapter.js +1 -2
- package/dist/unstable/useMentionAdapter.js +1 -2
- package/dist/unstable/useMessageStallDetection.js +1 -2
- package/dist/unstable/useModelContextSnapshot.js +1 -2
- package/dist/unstable/useSlashCommandAdapter.js +1 -2
- package/dist/unstable/webmcp/WebMcpRegistrationResource.js +1 -2
- package/dist/unstable/webmcp/convertTools.js +1 -2
- package/dist/unstable/webmcp/useWebMcpProvider.js +1 -2
- package/dist/unstable/webmcp/webmcp-host.js +1 -2
- package/dist/utils/Primitive.js +1 -2
- package/dist/utils/createActionButton.js +1 -2
- package/dist/utils/getSelectionMessageId.js +1 -2
- package/dist/utils/hooks/useManagedRef.js +1 -2
- package/dist/utils/hooks/useMediaQuery.js +1 -2
- package/dist/utils/hooks/useOnScrollToBottom.js +1 -2
- package/dist/utils/hooks/useSizeHandle.js +1 -2
- package/dist/utils/isCompositionKey.js +1 -2
- package/dist/utils/smooth/SmoothContext.js +1 -2
- package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
- package/dist/utils/smooth/useSmooth.js +11 -4
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/dist/utils/useIsomorphicLayoutEffect.js +0 -1
- package/package.json +6 -6
- package/src/mcp-apps/McpAppRenderer.composer.test.tsx +111 -0
- package/src/mcp-apps/McpAppRenderer.test.tsx +24 -23
- package/src/mcp-apps/McpAppRenderer.tsx +9 -1
- package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.test.tsx +91 -0
- package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.tsx +54 -0
- package/src/primitives/reasoning/useScrollLock.test.tsx +71 -2
- package/src/primitives/reasoning/useScrollLock.ts +78 -51
- package/src/primitives/threadListItem/ThreadListItemRoot.tsx +4 -1
- package/src/primitives/threadListItem/ThreadListKeyboardNav.test.tsx +25 -0
- package/src/utils/smooth/useSmooth.test.tsx +113 -4
- package/src/utils/smooth/useSmooth.ts +16 -2
- package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.ts +0 -49
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
2
2
|
import { useEffectEvent, useRef } from "@assistant-ui/tap/react-shim";
|
|
3
3
|
import { resource } from "@assistant-ui/tap";
|
|
4
|
-
|
|
4
|
+
// src/primitives/composer/trigger/triggerSelectionResource.ts
|
|
5
5
|
/** Owns composer text mutation + behavior dispatch on item selection. */
|
|
6
6
|
const useTriggerSelectionResource = (t0) => {
|
|
7
7
|
const $ = c(15);
|
|
@@ -84,7 +84,6 @@ const useTriggerSelectionResource = (t0) => {
|
|
|
84
84
|
return t4;
|
|
85
85
|
};
|
|
86
86
|
const TriggerSelectionResource = resource(useTriggerSelectionResource);
|
|
87
|
-
//#endregion
|
|
88
87
|
export { TriggerSelectionResource };
|
|
89
88
|
|
|
90
89
|
//# sourceMappingURL=triggerSelectionResource.js.map
|
|
@@ -4,7 +4,7 @@ import { useThreadRootElementRef } from "../thread/ThreadRootElementContext.js";
|
|
|
4
4
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
5
5
|
import "@assistant-ui/tap/react-shim";
|
|
6
6
|
import { useAui } from "@assistant-ui/store";
|
|
7
|
-
|
|
7
|
+
// src/primitives/composer/useComposerCancelWithFocus.ts
|
|
8
8
|
const COMPOSER_SELECTOR = "[data-aui-composer-type]";
|
|
9
9
|
const THREAD_SELECTOR = "[data-aui-thread-root]";
|
|
10
10
|
const useComposerCancelWithFocus = (cancel) => {
|
|
@@ -36,7 +36,6 @@ const useComposerCancelWithFocus = (cancel) => {
|
|
|
36
36
|
} else t0 = $[3];
|
|
37
37
|
return t0;
|
|
38
38
|
};
|
|
39
|
-
//#endregion
|
|
40
39
|
export { useComposerCancelWithFocus };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=useComposerCancelWithFocus.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useTriggerPopoverActiveAriaOptional } from "./trigger/TriggerPopoverRootContext.js";
|
|
3
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
4
4
|
import { useAuiState } from "@assistant-ui/store";
|
|
5
|
-
|
|
5
|
+
// src/primitives/composer/useComposerInputState.ts
|
|
6
6
|
function useComposerInputValue() {
|
|
7
7
|
return useAuiState(_temp);
|
|
8
8
|
}
|
|
@@ -41,7 +41,6 @@ function useTriggerPopoverAriaProps() {
|
|
|
41
41
|
} else t0 = $[3];
|
|
42
42
|
return t0;
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { useComposerInputDisabled, useComposerInputValue, useTriggerPopoverAriaProps };
|
|
46
45
|
|
|
47
46
|
//# sourceMappingURL=useComposerInputState.js.map
|
|
@@ -19,7 +19,7 @@ import { ComposerPrimitiveTriggerPopoverCategories, ComposerPrimitiveTriggerPopo
|
|
|
19
19
|
import { ComposerPrimitiveTriggerPopoverItem, ComposerPrimitiveTriggerPopoverItems } from "./composer/trigger/TriggerPopoverItems.js";
|
|
20
20
|
import { ComposerPrimitiveTriggerPopoverBack } from "./composer/trigger/TriggerPopoverBack.js";
|
|
21
21
|
import { ComposerPrimitiveTriggerPopover } from "./composer/trigger/index.js";
|
|
22
|
-
|
|
22
|
+
// src/primitives/composer.ts
|
|
23
23
|
var composer_exports = /* @__PURE__ */ __exportAll({
|
|
24
24
|
AddAttachment: () => ComposerPrimitiveAddAttachment,
|
|
25
25
|
AttachmentByIndex: () => ComposerPrimitiveAttachmentByIndex,
|
|
@@ -59,7 +59,6 @@ var composer_exports = /* @__PURE__ */ __exportAll({
|
|
|
59
59
|
unstable_useTriggerPopoverTriggers: () => useTriggerPopoverTriggers,
|
|
60
60
|
unstable_useTriggerPopoverTriggersOptional: () => useTriggerPopoverTriggersOptional
|
|
61
61
|
});
|
|
62
|
-
//#endregion
|
|
63
62
|
export { ComposerPrimitiveAddAttachment as AddAttachment, ComposerPrimitiveAttachmentByIndex as AttachmentByIndex, ComposerPrimitiveAttachmentDropzone as AttachmentDropzone, ComposerPrimitiveAttachments as Attachments, ComposerPrimitiveCancel as Cancel, ComposerPrimitiveDictate as Dictate, ComposerPrimitiveDictationTranscript as DictationTranscript, ComposerPrimitiveIf as If, ComposerPrimitiveInput as Input, ComposerPrimitiveQueue as Queue, ComposerPrimitiveQuote as Quote, ComposerPrimitiveQuoteDismiss as QuoteDismiss, ComposerPrimitiveQuoteText as QuoteText, ComposerPrimitiveResume as Resume, ComposerPrimitiveRoot as Root, ComposerPrimitiveSend as Send, ComposerPrimitiveStopDictation as StopDictation, ComposerPrimitiveTriggerPopover as TriggerPopover, ComposerPrimitiveTriggerPopoverBack as TriggerPopoverBack, ComposerPrimitiveTriggerPopoverCategories as TriggerPopoverCategories, ComposerPrimitiveTriggerPopoverCategoryItem as TriggerPopoverCategoryItem, ComposerPrimitiveTriggerPopoverItem as TriggerPopoverItem, ComposerPrimitiveTriggerPopoverItems as TriggerPopoverItems, ComposerPrimitiveTriggerPopoverRoot as TriggerPopoverRoot, ComposerPrimitiveTriggerPopover as Unstable_TriggerPopover, ComposerPrimitiveTriggerPopoverBack as Unstable_TriggerPopoverBack, ComposerPrimitiveTriggerPopoverCategories as Unstable_TriggerPopoverCategories, ComposerPrimitiveTriggerPopoverCategoryItem as Unstable_TriggerPopoverCategoryItem, ComposerPrimitiveTriggerPopoverItem as Unstable_TriggerPopoverItem, ComposerPrimitiveTriggerPopoverItems as Unstable_TriggerPopoverItems, ComposerPrimitiveTriggerPopoverRoot as Unstable_TriggerPopoverRoot, composer_exports, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional };
|
|
64
63
|
|
|
65
64
|
//# sourceMappingURL=composer.js.map
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { withRenderProp } from "../utils/Primitive.js";
|
|
2
2
|
import { DropdownMenu } from "radix-ui";
|
|
3
|
-
|
|
3
|
+
// src/primitives/dropdownMenuRenderPrimitives.ts
|
|
4
4
|
const DropdownMenuRenderTrigger = withRenderProp(DropdownMenu.Trigger);
|
|
5
5
|
const DropdownMenuRenderContent = withRenderProp(DropdownMenu.Content);
|
|
6
6
|
const DropdownMenuRenderItem = withRenderProp(DropdownMenu.Item);
|
|
7
7
|
const DropdownMenuRenderSeparator = withRenderProp(DropdownMenu.Separator);
|
|
8
|
-
//#endregion
|
|
9
8
|
export { DropdownMenuRenderContent, DropdownMenuRenderItem, DropdownMenuRenderSeparator, DropdownMenuRenderTrigger };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=dropdownMenuRenderPrimitives.js.map
|
|
@@ -4,7 +4,7 @@ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
|
4
4
|
import { useMessageError } from "@assistant-ui/core/react";
|
|
5
5
|
import { forwardRef } from "@assistant-ui/tap/react-shim";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/primitives/error/ErrorMessage.tsx
|
|
8
8
|
const ErrorPrimitiveMessage = forwardRef((t0, forwardRef) => {
|
|
9
9
|
const $ = c(7);
|
|
10
10
|
let children;
|
|
@@ -36,7 +36,6 @@ const ErrorPrimitiveMessage = forwardRef((t0, forwardRef) => {
|
|
|
36
36
|
return t2;
|
|
37
37
|
});
|
|
38
38
|
ErrorPrimitiveMessage.displayName = "ErrorPrimitive.Message";
|
|
39
|
-
//#endregion
|
|
40
39
|
export { ErrorPrimitiveMessage };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=ErrorMessage.js.map
|
|
@@ -3,7 +3,7 @@ import { Primitive } from "../../utils/Primitive.js";
|
|
|
3
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
4
4
|
import { forwardRef } from "@assistant-ui/tap/react-shim";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/primitives/error/ErrorRoot.tsx
|
|
7
7
|
const ErrorPrimitiveRoot = forwardRef((props, forwardRef) => {
|
|
8
8
|
const $ = c(3);
|
|
9
9
|
let t0;
|
|
@@ -20,7 +20,6 @@ const ErrorPrimitiveRoot = forwardRef((props, forwardRef) => {
|
|
|
20
20
|
return t0;
|
|
21
21
|
});
|
|
22
22
|
ErrorPrimitiveRoot.displayName = "ErrorPrimitive.Root";
|
|
23
|
-
//#endregion
|
|
24
23
|
export { ErrorPrimitiveRoot };
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=ErrorRoot.js.map
|
package/dist/primitives/error.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { ErrorPrimitiveRoot } from "./error/ErrorRoot.js";
|
|
3
3
|
import { ErrorPrimitiveMessage } from "./error/ErrorMessage.js";
|
|
4
|
-
|
|
4
|
+
// src/primitives/error.ts
|
|
5
5
|
var error_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
Message: () => ErrorPrimitiveMessage,
|
|
7
7
|
Root: () => ErrorPrimitiveRoot
|
|
8
8
|
});
|
|
9
|
-
//#endregion
|
|
10
9
|
export { ErrorPrimitiveMessage as Message, ErrorPrimitiveRoot as Root, error_exports };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=error.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useMessageError } from "@assistant-ui/core/react";
|
|
3
|
-
|
|
3
|
+
// src/primitives/message/MessageError.ts
|
|
4
4
|
const MessagePrimitiveError = (t0) => {
|
|
5
5
|
const { children } = t0;
|
|
6
6
|
return useMessageError() !== void 0 ? children : null;
|
|
7
7
|
};
|
|
8
8
|
MessagePrimitiveError.displayName = "MessagePrimitive.Error";
|
|
9
|
-
//#endregion
|
|
10
9
|
export { MessagePrimitiveError };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=MessageError.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
3
|
import { useAuiState } from "@assistant-ui/store";
|
|
4
|
-
|
|
4
|
+
// src/primitives/message/MessageIf.ts
|
|
5
5
|
const useMessageIf = (props) => {
|
|
6
6
|
const $ = c(12);
|
|
7
7
|
let t0;
|
|
@@ -62,7 +62,6 @@ const MessagePrimitiveIf = (t0) => {
|
|
|
62
62
|
return useMessageIf(query) ? children : null;
|
|
63
63
|
};
|
|
64
64
|
MessagePrimitiveIf.displayName = "MessagePrimitive.If";
|
|
65
|
-
//#endregion
|
|
66
65
|
export { MessagePrimitiveIf };
|
|
67
66
|
|
|
68
67
|
//# sourceMappingURL=MessageIf.js.map
|
|
@@ -5,7 +5,7 @@ import { MessagePartPrimitiveInProgress } from "../messagePart/MessagePartInProg
|
|
|
5
5
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
6
6
|
import { MessagePartComponent as MessagePartComponentBase, MessagePrimitivePartByIndex as MessagePrimitivePartByIndexBase, MessagePrimitiveParts as MessagePrimitiveParts$1, messagePartsDefaultComponents } from "@assistant-ui/core/react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/primitives/message/MessageParts.tsx
|
|
9
9
|
const webDefaultComponents = {
|
|
10
10
|
...messagePartsDefaultComponents,
|
|
11
11
|
Text: () => /* @__PURE__ */ jsxs("p", {
|
|
@@ -66,7 +66,6 @@ const MessagePrimitiveParts = (props) => {
|
|
|
66
66
|
return t2;
|
|
67
67
|
};
|
|
68
68
|
MessagePrimitiveParts.displayName = "MessagePrimitive.Parts";
|
|
69
|
-
//#endregion
|
|
70
69
|
export { MessagePartComponentBase as MessagePartComponent, MessagePrimitivePartByIndexBase as MessagePrimitivePartByIndex, MessagePrimitiveParts };
|
|
71
70
|
|
|
72
71
|
//# sourceMappingURL=MessageParts.js.map
|
|
@@ -10,7 +10,7 @@ import { memo } from "@assistant-ui/tap/react-shim";
|
|
|
10
10
|
import { useAuiState } from "@assistant-ui/store";
|
|
11
11
|
import { getMessagePartKeys } from "@assistant-ui/core/internal";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
|
|
13
|
+
// src/primitives/message/MessagePartsGrouped.tsx
|
|
14
14
|
/**
|
|
15
15
|
* Groups message parts by their parent ID.
|
|
16
16
|
* Parts without a parent ID appear in their chronological position as individual groups.
|
|
@@ -332,7 +332,6 @@ function _temp2(s) {
|
|
|
332
332
|
function _temp3(s) {
|
|
333
333
|
return s.message.parts.length;
|
|
334
334
|
}
|
|
335
|
-
//#endregion
|
|
336
335
|
export { MessagePrimitiveUnstable_PartsGrouped, MessagePrimitiveUnstable_PartsGroupedByParentId };
|
|
337
336
|
|
|
338
337
|
//# sourceMappingURL=MessagePartsGrouped.js.map
|
|
@@ -8,7 +8,7 @@ import { forwardRef } from "@assistant-ui/tap/react-shim";
|
|
|
8
8
|
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
import { useComposedRefs } from "radix-ui/internal";
|
|
11
|
-
|
|
11
|
+
// src/primitives/message/MessageRoot.tsx
|
|
12
12
|
const useIsHoveringRef = () => {
|
|
13
13
|
const $ = c(4);
|
|
14
14
|
const aui = useAui();
|
|
@@ -251,7 +251,6 @@ function _temp3(s) {
|
|
|
251
251
|
function _temp4(s) {
|
|
252
252
|
return s.message.id;
|
|
253
253
|
}
|
|
254
|
-
//#endregion
|
|
255
254
|
export { MessagePrimitiveRoot };
|
|
256
255
|
|
|
257
256
|
//# sourceMappingURL=MessageRoot.js.map
|
|
@@ -6,7 +6,7 @@ import { MessagePrimitiveAttachmentByIndex, MessagePrimitiveAttachments } from "
|
|
|
6
6
|
import { MessagePrimitiveError } from "./message/MessageError.js";
|
|
7
7
|
import { MessagePrimitiveUnstable_PartsGrouped, MessagePrimitiveUnstable_PartsGroupedByParentId } from "./message/MessagePartsGrouped.js";
|
|
8
8
|
import { MessagePrimitiveGenerativeUI as GenerativeUI, MessagePrimitiveGroupedParts as GroupedParts, MessagePrimitiveQuote as Quote } from "@assistant-ui/core/react";
|
|
9
|
-
|
|
9
|
+
// src/primitives/message.ts
|
|
10
10
|
var message_exports = /* @__PURE__ */ __exportAll({
|
|
11
11
|
AttachmentByIndex: () => MessagePrimitiveAttachmentByIndex,
|
|
12
12
|
Attachments: () => MessagePrimitiveAttachments,
|
|
@@ -22,7 +22,6 @@ var message_exports = /* @__PURE__ */ __exportAll({
|
|
|
22
22
|
Unstable_PartsGrouped: () => MessagePrimitiveUnstable_PartsGrouped,
|
|
23
23
|
Unstable_PartsGroupedByParentId: () => MessagePrimitiveUnstable_PartsGroupedByParentId
|
|
24
24
|
});
|
|
25
|
-
//#endregion
|
|
26
25
|
export { MessagePrimitiveAttachmentByIndex as AttachmentByIndex, MessagePrimitiveAttachments as Attachments, MessagePrimitiveParts as Content, MessagePrimitiveError as Error, GenerativeUI, GroupedParts, MessagePrimitiveIf as If, MessagePrimitivePartByIndexBase as PartByIndex, MessagePrimitiveParts as Parts, Quote, MessagePrimitiveRoot as Root, MessagePrimitiveUnstable_PartsGrouped as Unstable_PartsGrouped, MessagePrimitiveUnstable_PartsGroupedByParentId as Unstable_PartsGroupedByParentId, message_exports };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=message.js.map
|
|
@@ -4,7 +4,7 @@ import { useMessagePartImage } from "./useMessagePartImage.js";
|
|
|
4
4
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
5
5
|
import { forwardRef } from "@assistant-ui/tap/react-shim";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/primitives/messagePart/MessagePartImage.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Renders an image from the current message part context.
|
|
10
10
|
*
|
|
@@ -38,7 +38,6 @@ const MessagePartPrimitiveImage = forwardRef((props, forwardedRef) => {
|
|
|
38
38
|
return t0;
|
|
39
39
|
});
|
|
40
40
|
MessagePartPrimitiveImage.displayName = "MessagePartPrimitive.Image";
|
|
41
|
-
//#endregion
|
|
42
41
|
export { MessagePartPrimitiveImage };
|
|
43
42
|
|
|
44
43
|
//# sourceMappingURL=MessagePartImage.js.map
|
|
@@ -4,7 +4,7 @@ import { useMessagePartText } from "./useMessagePartText.js";
|
|
|
4
4
|
import { useSmooth } from "../../utils/smooth/useSmooth.js";
|
|
5
5
|
import { forwardRef, isValidElement } from "@assistant-ui/tap/react-shim";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/primitives/messagePart/MessagePartText.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Renders the text content of a message part with optional smooth streaming.
|
|
10
10
|
*
|
|
@@ -35,7 +35,6 @@ const MessagePartPrimitiveText = forwardRef(({ smooth = true, component: Compone
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
MessagePartPrimitiveText.displayName = "MessagePartPrimitive.Text";
|
|
38
|
-
//#endregion
|
|
39
38
|
export { MessagePartPrimitiveText };
|
|
40
39
|
|
|
41
40
|
//# sourceMappingURL=MessagePartText.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
-
|
|
3
|
+
// src/primitives/messagePart/useMessagePartData.ts
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Use {@link useAuiState} to select and narrow `s.part`.
|
|
6
6
|
* Return `null` for optional rendering. Do not throw inside the selector:
|
|
@@ -28,7 +28,6 @@ function _temp(s) {
|
|
|
28
28
|
if (s.part.type !== "data") return null;
|
|
29
29
|
return s.part;
|
|
30
30
|
}
|
|
31
|
-
//#endregion
|
|
32
31
|
export { useMessagePartData };
|
|
33
32
|
|
|
34
33
|
//# sourceMappingURL=useMessagePartData.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
-
|
|
3
|
+
// src/primitives/messagePart/useMessagePartFile.ts
|
|
4
4
|
const COMPLETE_STATUS = Object.freeze({ type: "complete" });
|
|
5
5
|
const EMPTY_FILE_PART = Object.freeze({
|
|
6
6
|
type: "file",
|
|
@@ -31,7 +31,6 @@ function _temp(s) {
|
|
|
31
31
|
if (s.part.type !== "file") return EMPTY_FILE_PART;
|
|
32
32
|
return s.part;
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { useMessagePartFile };
|
|
36
35
|
|
|
37
36
|
//# sourceMappingURL=useMessagePartFile.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
-
|
|
3
|
+
// src/primitives/messagePart/useMessagePartImage.ts
|
|
4
4
|
const COMPLETE_STATUS = Object.freeze({ type: "complete" });
|
|
5
5
|
const EMPTY_IMAGE_PART = Object.freeze({
|
|
6
6
|
type: "image",
|
|
@@ -30,7 +30,6 @@ function _temp(s) {
|
|
|
30
30
|
if (s.part.type !== "image") return EMPTY_IMAGE_PART;
|
|
31
31
|
return s.part;
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { useMessagePartImage };
|
|
35
34
|
|
|
36
35
|
//# sourceMappingURL=useMessagePartImage.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
-
|
|
3
|
+
// src/primitives/messagePart/useMessagePartReasoning.ts
|
|
4
4
|
const COMPLETE_STATUS = Object.freeze({ type: "complete" });
|
|
5
5
|
const EMPTY_REASONING_PART = Object.freeze({
|
|
6
6
|
type: "reasoning",
|
|
@@ -30,7 +30,6 @@ function _temp(s) {
|
|
|
30
30
|
if (s.part.type !== "reasoning") return EMPTY_REASONING_PART;
|
|
31
31
|
return s.part;
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { useMessagePartReasoning };
|
|
35
34
|
|
|
36
35
|
//# sourceMappingURL=useMessagePartReasoning.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
-
|
|
3
|
+
// src/primitives/messagePart/useMessagePartSource.ts
|
|
4
4
|
const COMPLETE_STATUS = Object.freeze({ type: "complete" });
|
|
5
5
|
const EMPTY_SOURCE_PART = Object.freeze({
|
|
6
6
|
type: "source",
|
|
@@ -32,7 +32,6 @@ function _temp(s) {
|
|
|
32
32
|
if (s.part.type !== "source") return EMPTY_SOURCE_PART;
|
|
33
33
|
return s.part;
|
|
34
34
|
}
|
|
35
|
-
//#endregion
|
|
36
35
|
export { useMessagePartSource };
|
|
37
36
|
|
|
38
37
|
//# sourceMappingURL=useMessagePartSource.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
-
|
|
3
|
+
// src/primitives/messagePart/useMessagePartText.ts
|
|
4
4
|
const COMPLETE_STATUS = Object.freeze({ type: "complete" });
|
|
5
5
|
const EMPTY_TEXT_PART = Object.freeze({
|
|
6
6
|
type: "text",
|
|
@@ -30,7 +30,6 @@ function _temp(s) {
|
|
|
30
30
|
if (s.part.type !== "text" && s.part.type !== "reasoning") return EMPTY_TEXT_PART;
|
|
31
31
|
return s.part;
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { useMessagePartText };
|
|
35
34
|
|
|
36
35
|
//# sourceMappingURL=useMessagePartText.js.map
|
|
@@ -3,14 +3,13 @@ import { MessagePartPrimitiveText } from "./messagePart/MessagePartText.js";
|
|
|
3
3
|
import { MessagePartPrimitiveImage } from "./messagePart/MessagePartImage.js";
|
|
4
4
|
import { MessagePartPrimitiveInProgress } from "./messagePart/MessagePartInProgress.js";
|
|
5
5
|
import { PartPrimitiveMessages as Messages } from "@assistant-ui/core/react";
|
|
6
|
-
|
|
6
|
+
// src/primitives/messagePart.ts
|
|
7
7
|
var messagePart_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
Image: () => MessagePartPrimitiveImage,
|
|
9
9
|
InProgress: () => MessagePartPrimitiveInProgress,
|
|
10
10
|
Messages: () => Messages,
|
|
11
11
|
Text: () => MessagePartPrimitiveText
|
|
12
12
|
});
|
|
13
|
-
//#endregion
|
|
14
13
|
export { MessagePartPrimitiveImage as Image, MessagePartPrimitiveInProgress as InProgress, Messages, MessagePartPrimitiveText as Text, messagePart_exports };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=messagePart.js.map
|
|
@@ -3,7 +3,7 @@ import { createActionButton } from "../../utils/createActionButton.js";
|
|
|
3
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
4
4
|
import "@assistant-ui/tap/react-shim";
|
|
5
5
|
import { useAui } from "@assistant-ui/store";
|
|
6
|
-
|
|
6
|
+
// src/primitives/queueItem/QueueItemRemove.ts
|
|
7
7
|
const useQueueItemRemove = () => {
|
|
8
8
|
const $ = c(2);
|
|
9
9
|
const aui = useAui();
|
|
@@ -26,7 +26,6 @@ const useQueueItemRemove = () => {
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
const QueueItemPrimitiveRemove = createActionButton("QueueItemPrimitive.Remove", useQueueItemRemove);
|
|
29
|
-
//#endregion
|
|
30
29
|
export { QueueItemPrimitiveRemove };
|
|
31
30
|
|
|
32
31
|
//# sourceMappingURL=QueueItemRemove.js.map
|
|
@@ -3,7 +3,7 @@ import { createActionButton } from "../../utils/createActionButton.js";
|
|
|
3
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
4
4
|
import "@assistant-ui/tap/react-shim";
|
|
5
5
|
import { useAui } from "@assistant-ui/store";
|
|
6
|
-
|
|
6
|
+
// src/primitives/queueItem/QueueItemSteer.ts
|
|
7
7
|
const useQueueItemSteer = () => {
|
|
8
8
|
const $ = c(2);
|
|
9
9
|
const aui = useAui();
|
|
@@ -26,7 +26,6 @@ const useQueueItemSteer = () => {
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
const QueueItemPrimitiveSteer = createActionButton("QueueItemPrimitive.Steer", useQueueItemSteer);
|
|
29
|
-
//#endregion
|
|
30
29
|
export { QueueItemPrimitiveSteer };
|
|
31
30
|
|
|
32
31
|
//# sourceMappingURL=QueueItemSteer.js.map
|
|
@@ -4,7 +4,7 @@ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
|
4
4
|
import { forwardRef } from "@assistant-ui/tap/react-shim";
|
|
5
5
|
import { useAuiState } from "@assistant-ui/store";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/primitives/queueItem/QueueItemText.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Renders the prompt text of a queue item.
|
|
10
10
|
*
|
|
@@ -41,7 +41,6 @@ function _temp2(part_0) {
|
|
|
41
41
|
function _temp3(s) {
|
|
42
42
|
return (s.queueItem.parts ?? []).filter(_temp).map(_temp2).join("\n\n");
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { QueueItemPrimitiveText };
|
|
46
45
|
|
|
47
46
|
//# sourceMappingURL=QueueItemText.js.map
|
|
@@ -2,13 +2,12 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { QueueItemPrimitiveText } from "./queueItem/QueueItemText.js";
|
|
3
3
|
import { QueueItemPrimitiveSteer } from "./queueItem/QueueItemSteer.js";
|
|
4
4
|
import { QueueItemPrimitiveRemove } from "./queueItem/QueueItemRemove.js";
|
|
5
|
-
|
|
5
|
+
// src/primitives/queueItem.ts
|
|
6
6
|
var queueItem_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
Remove: () => QueueItemPrimitiveRemove,
|
|
8
8
|
Steer: () => QueueItemPrimitiveSteer,
|
|
9
9
|
Text: () => QueueItemPrimitiveText
|
|
10
10
|
});
|
|
11
|
-
//#endregion
|
|
12
11
|
export { QueueItemPrimitiveRemove as Remove, QueueItemPrimitiveSteer as Steer, QueueItemPrimitiveText as Text, queueItem_exports };
|
|
13
12
|
|
|
14
13
|
//# sourceMappingURL=queueItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollLock.d.ts","sourceRoot":"","sources":["../../../src/primitives/reasoning/useScrollLock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useScrollLock.d.ts","sourceRoot":"","sources":["../../../src/primitives/reasoning/useScrollLock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAgFvE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EAC/D,oBAAoB,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,EACvC,mBAAmB,MAAM,eAqC1B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
3
|
import { useEffect, useRef } from "@assistant-ui/tap/react-shim";
|
|
4
|
-
|
|
4
|
+
// src/primitives/reasoning/useScrollLock.ts
|
|
5
5
|
const findScrollableAncestor = (element) => {
|
|
6
6
|
let current = element;
|
|
7
7
|
while (current) {
|
|
@@ -11,6 +11,39 @@ const findScrollableAncestor = (element) => {
|
|
|
11
11
|
}
|
|
12
12
|
return null;
|
|
13
13
|
};
|
|
14
|
+
const scrollLocks = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
const acquireScrollLock = (scrollContainer) => {
|
|
16
|
+
const existing = scrollLocks.get(scrollContainer);
|
|
17
|
+
if (existing) {
|
|
18
|
+
existing.count++;
|
|
19
|
+
return existing;
|
|
20
|
+
}
|
|
21
|
+
const scrollPosition = scrollContainer.scrollTop;
|
|
22
|
+
const scrollbarWidth = scrollContainer.style.scrollbarWidth;
|
|
23
|
+
const computed = getComputedStyle(scrollContainer);
|
|
24
|
+
const paddingSide = computed.direction === "rtl" ? "paddingLeft" : "paddingRight";
|
|
25
|
+
const previousPadding = scrollContainer.style[paddingSide];
|
|
26
|
+
const elementScrollbarSize = scrollContainer.offsetWidth - scrollContainer.clientWidth - parseFloat(computed.borderLeftWidth) - parseFloat(computed.borderRightWidth);
|
|
27
|
+
const ownerDocument = scrollContainer.ownerDocument;
|
|
28
|
+
const scrollbarSize = (scrollContainer === ownerDocument.documentElement || scrollContainer === ownerDocument.body) && elementScrollbarSize <= 0 ? (ownerDocument.defaultView?.innerWidth ?? 0) - ownerDocument.documentElement.clientWidth : elementScrollbarSize;
|
|
29
|
+
scrollContainer.style.scrollbarWidth = "none";
|
|
30
|
+
if (scrollbarSize > 0) scrollContainer.style[paddingSide] = `${parseFloat(computed[paddingSide]) + scrollbarSize}px`;
|
|
31
|
+
const restoreStyles = () => {
|
|
32
|
+
scrollContainer.style.scrollbarWidth = scrollbarWidth;
|
|
33
|
+
scrollContainer.style[paddingSide] = previousPadding;
|
|
34
|
+
};
|
|
35
|
+
const resetPosition = () => scrollContainer.scrollTop = scrollPosition;
|
|
36
|
+
scrollContainer.addEventListener("scroll", resetPosition);
|
|
37
|
+
const lock = {
|
|
38
|
+
count: 1,
|
|
39
|
+
restore: () => {
|
|
40
|
+
scrollContainer.removeEventListener("scroll", resetPosition);
|
|
41
|
+
restoreStyles();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
scrollLocks.set(scrollContainer, lock);
|
|
45
|
+
return lock;
|
|
46
|
+
};
|
|
14
47
|
/**
|
|
15
48
|
* Locks scroll position during collapsible/height animations and hides scrollbar.
|
|
16
49
|
*
|
|
@@ -63,31 +96,15 @@ const useScrollLock = (animatedElementRef, animationDuration) => {
|
|
|
63
96
|
cleanupRef.current = null;
|
|
64
97
|
return;
|
|
65
98
|
}
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const computed = getComputedStyle(scrollContainer);
|
|
69
|
-
const paddingSide = computed.direction === "rtl" ? "paddingLeft" : "paddingRight";
|
|
70
|
-
const previousPadding = scrollContainer.style[paddingSide];
|
|
71
|
-
const elementScrollbarSize = scrollContainer.offsetWidth - scrollContainer.clientWidth - parseFloat(computed.borderLeftWidth) - parseFloat(computed.borderRightWidth);
|
|
72
|
-
const ownerDocument = scrollContainer.ownerDocument;
|
|
73
|
-
const scrollbarSize = (scrollContainer === ownerDocument.documentElement || scrollContainer === ownerDocument.body) && elementScrollbarSize <= 0 ? (ownerDocument.defaultView?.innerWidth ?? 0) - ownerDocument.documentElement.clientWidth : elementScrollbarSize;
|
|
74
|
-
scrollContainer.style.scrollbarWidth = "none";
|
|
75
|
-
if (scrollbarSize > 0) scrollContainer.style[paddingSide] = `${parseFloat(computed[paddingSide]) + scrollbarSize}px`;
|
|
76
|
-
const restoreStyles = () => {
|
|
77
|
-
scrollContainer.style.scrollbarWidth = scrollbarWidth;
|
|
78
|
-
scrollContainer.style[paddingSide] = previousPadding;
|
|
79
|
-
};
|
|
80
|
-
const resetPosition = () => scrollContainer.scrollTop = scrollPosition;
|
|
81
|
-
scrollContainer.addEventListener("scroll", resetPosition);
|
|
82
|
-
const timeoutId = setTimeout(() => {
|
|
83
|
-
scrollContainer.removeEventListener("scroll", resetPosition);
|
|
84
|
-
restoreStyles();
|
|
85
|
-
cleanupRef.current = null;
|
|
86
|
-
}, animationDuration);
|
|
99
|
+
const lock = acquireScrollLock(scrollContainer);
|
|
100
|
+
const timeoutId = setTimeout(() => cleanupRef.current?.(), animationDuration);
|
|
87
101
|
cleanupRef.current = () => {
|
|
88
102
|
clearTimeout(timeoutId);
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
if ((lock.count = lock.count - 1) === 0) {
|
|
104
|
+
lock.restore();
|
|
105
|
+
scrollLocks.delete(scrollContainer);
|
|
106
|
+
}
|
|
107
|
+
cleanupRef.current = null;
|
|
91
108
|
};
|
|
92
109
|
};
|
|
93
110
|
$[2] = animatedElementRef;
|
|
@@ -96,7 +113,6 @@ const useScrollLock = (animatedElementRef, animationDuration) => {
|
|
|
96
113
|
} else t2 = $[4];
|
|
97
114
|
return t2;
|
|
98
115
|
};
|
|
99
|
-
//#endregion
|
|
100
116
|
export { useScrollLock };
|
|
101
117
|
|
|
102
118
|
//# sourceMappingURL=useScrollLock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollLock.js","names":["c","_c","RefObject","useCallback","useEffect","useRef","findScrollableAncestor","element","HTMLElement","current","overflowY","getComputedStyle","parentElement","
|
|
1
|
+
{"version":3,"file":"useScrollLock.js","names":["c","_c","RefObject","useCallback","useEffect","useRef","findScrollableAncestor","element","HTMLElement","current","overflowY","getComputedStyle","parentElement","scrollLocks","WeakMap","count","restore","acquireScrollLock","scrollContainer","existing","get","scrollPosition","scrollTop","scrollbarWidth","style","computed","paddingSide","direction","previousPadding","elementScrollbarSize","offsetWidth","clientWidth","parseFloat","borderLeftWidth","borderRightWidth","ownerDocument","isRootScroller","documentElement","body","scrollbarSize","defaultView","innerWidth","restoreStyles","resetPosition","addEventListener","lock","removeEventListener","set","useScrollLock","animatedElementRef","animationDuration","$","cleanupRef","t0","t1","Symbol","for","t2","timeoutId","setTimeout","clearTimeout","delete","lockScroll","_c","lockScroll"],"sources":["../../../src/primitives/reasoning/useScrollLock.ts"],"sourcesContent":["\"use client\";\n\nimport { type RefObject, useCallback, useEffect, useRef } from \"react\";\n\nconst findScrollableAncestor = (element: HTMLElement | null) => {\n let current = element;\n while (current) {\n const { overflowY } = getComputedStyle(current);\n if (overflowY === \"scroll\" || overflowY === \"auto\") return current;\n current = current.parentElement;\n }\n return null;\n};\n\nconst scrollLocks = new WeakMap<\n HTMLElement,\n { count: number; restore: () => void }\n>();\n\nconst acquireScrollLock = (scrollContainer: HTMLElement) => {\n const existing = scrollLocks.get(scrollContainer);\n if (existing) {\n existing.count++;\n return existing;\n }\n\n const scrollPosition = scrollContainer.scrollTop;\n const scrollbarWidth = scrollContainer.style.scrollbarWidth;\n\n // Hiding the scrollbar collapses its gutter on classic scrollbars, which\n // shifts centered content horizontally; compensate with padding on the\n // side the scrollbar occupies (the left side in RTL).\n const computed = getComputedStyle(scrollContainer);\n const paddingSide =\n computed.direction === \"rtl\" ? \"paddingLeft\" : \"paddingRight\";\n const previousPadding = scrollContainer.style[paddingSide];\n const elementScrollbarSize =\n scrollContainer.offsetWidth -\n scrollContainer.clientWidth -\n parseFloat(computed.borderLeftWidth) -\n parseFloat(computed.borderRightWidth);\n // A root element's offsetWidth already excludes the viewport scrollbar, so\n // the element formula reports zero once the scroll propagates to the\n // viewport, and only then does the viewport measure apply. A body that\n // scrolls in its own right is measured by the element formula like any\n // other scroller, whether or not the viewport is scrolling too.\n const ownerDocument = scrollContainer.ownerDocument;\n const isRootScroller =\n scrollContainer === ownerDocument.documentElement ||\n scrollContainer === ownerDocument.body;\n const scrollbarSize =\n isRootScroller && elementScrollbarSize <= 0\n ? (ownerDocument.defaultView?.innerWidth ?? 0) -\n ownerDocument.documentElement.clientWidth\n : elementScrollbarSize;\n\n scrollContainer.style.scrollbarWidth = \"none\";\n if (scrollbarSize > 0) {\n scrollContainer.style[paddingSide] = `${\n parseFloat(computed[paddingSide]) + scrollbarSize\n }px`;\n }\n\n const restoreStyles = () => {\n scrollContainer.style.scrollbarWidth = scrollbarWidth;\n scrollContainer.style[paddingSide] = previousPadding;\n };\n\n const resetPosition = () => (scrollContainer.scrollTop = scrollPosition);\n scrollContainer.addEventListener(\"scroll\", resetPosition);\n\n const lock = {\n count: 1,\n restore: () => {\n scrollContainer.removeEventListener(\"scroll\", resetPosition);\n restoreStyles();\n },\n };\n scrollLocks.set(scrollContainer, lock);\n return lock;\n};\n\n/**\n * Locks scroll position during collapsible/height animations and hides scrollbar.\n *\n * This utility prevents page jumps when content height changes during animations,\n * providing a smooth user experience. It finds the nearest scrollable ancestor and\n * temporarily locks its scroll position while the animation completes.\n *\n * - Prevents forced reflows: no layout reads, mutations scoped to scrollable parent only\n * - Reactive: only intercepts scroll events when browser actually adjusts\n * - Cleans up automatically after animation duration\n *\n * @param animatedElementRef - Ref to the animated element\n * @param animationDuration - Lock duration in milliseconds\n * @returns Function to activate the scroll lock\n *\n * @example\n * ```tsx\n * const collapsibleRef = useRef<HTMLDivElement>(null);\n * const lockScroll = useScrollLock(collapsibleRef, 200);\n *\n * const handleCollapse = () => {\n * lockScroll(); // Lock scroll before collapsing\n * setIsOpen(false);\n * };\n * ```\n */\nexport const useScrollLock = <T extends HTMLElement = HTMLElement>(\n animatedElementRef: RefObject<T | null>,\n animationDuration: number,\n) => {\n const cleanupRef = useRef<(() => void) | null>(null);\n\n useEffect(() => {\n return () => {\n cleanupRef.current?.();\n };\n }, []);\n\n const lockScroll = useCallback(() => {\n cleanupRef.current?.();\n\n const scrollContainer = findScrollableAncestor(animatedElementRef.current);\n if (!scrollContainer) {\n cleanupRef.current = null;\n return;\n }\n\n const lock = acquireScrollLock(scrollContainer);\n\n const timeoutId = setTimeout(\n () => cleanupRef.current?.(),\n animationDuration,\n );\n\n cleanupRef.current = () => {\n clearTimeout(timeoutId);\n if (--lock.count === 0) {\n lock.restore();\n scrollLocks.delete(scrollContainer);\n }\n cleanupRef.current = null;\n };\n }, [animationDuration, animatedElementRef]);\n\n return lockScroll;\n};\n"],"mappings":";;;;AAIA,MAAMM,0BAA0BC,YAAgC;CAC9D,IAAIE,UAAUF;CACd,OAAOE,SAAS;EACd,MAAM,EAAEC,cAAcC,iBAAiBF,OAAO;EAC9C,IAAIC,cAAc,YAAYA,cAAc,QAAQ,OAAOD;EAC3DA,UAAUA,QAAQG;CACpB;CACA,OAAO;AACT;AAEA,MAAMC,8BAAc,IAAIC,QAGtB;AAEF,MAAMG,qBAAqBC,oBAAiC;CAC1D,MAAMC,WAAWN,YAAYO,IAAIF,eAAe;CAChD,IAAIC,UAAU;EACZA,SAASJ;EACT,OAAOI;CACT;CAEA,MAAME,iBAAiBH,gBAAgBI;CACvC,MAAMC,iBAAiBL,gBAAgBM,MAAMD;CAK7C,MAAME,WAAWd,iBAAiBO,eAAe;CACjD,MAAMQ,cACJD,SAASE,cAAc,QAAQ,gBAAgB;CACjD,MAAMC,kBAAkBV,gBAAgBM,MAAME;CAC9C,MAAMG,uBACJX,gBAAgBY,cAChBZ,gBAAgBa,cAChBC,WAAWP,SAASQ,eAAe,IACnCD,WAAWP,SAASS,gBAAgB;CAMtC,MAAMC,gBAAgBjB,gBAAgBiB;CAItC,MAAMI,iBAFJrB,oBAAoBiB,cAAcE,mBAClCnB,oBAAoBiB,cAAcG,SAEhBT,wBAAwB,KACrCM,cAAcK,aAAaC,cAAc,KAC1CN,cAAcE,gBAAgBN,cAC9BF;CAENX,gBAAgBM,MAAMD,iBAAiB;CACvC,IAAIgB,gBAAgB,GAClBrB,gBAAgBM,MAAME,eAAe,GACnCM,WAAWP,SAASC,YAAY,IAAIa,cAAa;CAIrD,MAAMG,sBAAsB;EAC1BxB,gBAAgBM,MAAMD,iBAAiBA;EACvCL,gBAAgBM,MAAME,eAAeE;CACvC;CAEA,MAAMe,sBAAuBzB,gBAAgBI,YAAYD;CACzDH,gBAAgB0B,iBAAiB,UAAUD,aAAa;CAExD,MAAME,OAAO;EACX9B,OAAO;EACPC,eAAe;GACbE,gBAAgB4B,oBAAoB,UAAUH,aAAa;GAC3DD,cAAc;EAChB;CACF;CACA7B,YAAYkC,IAAI7B,iBAAiB2B,IAAI;CACrC,OAAOA;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAaG,iBAAgBC,oBAAAC,sBAAA;CAAA,MAAAC,IAAAlD,EAAA,CAAA;CAI3B,MAAAmD,aAAmB/C,OAA4B,IAAI;CAAE,IAAAgD;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAI,OAAAC,IAAA,2BAAA,GAAA;EAE3CH,iBACD;GACLD,WAAU3C,UAAW;EAAC;EAEvB6C,KAAA,CAAA;EAAEH,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAD,KAAAF,EAAA;EAAAG,KAAAH,EAAA;CAAA;CAJL/C,UAAUiD,IAIPC,EAAE;CAAC,IAAAG;CAAA,IAAAN,EAAA,OAAAF,sBAAAE,EAAA,OAAAD,mBAAA;EAEyBO,WAAA;GAC7BL,WAAU3C,UAAW;GAErB,MAAAS,kBAAwBZ,uBAAuB2C,mBAAkBxC,OAAQ;GACzE,IAAI,CAACS,iBAAe;IAClBkC,WAAU3C,UAAW;IAAH;GAAA;GAIpB,MAAAoC,OAAa5B,kBAAkBC,eAAe;GAE9C,MAAAwC,YAAkBC,iBACVP,WAAU3C,UAAW,GAC3ByC,iBACF;GAEAE,WAAU3C,gBAAW;IACnBmD,aAAaF,SAAS;IACtB,KAAMb,KAAI9B,QAAJ8B,KAAI9B,QAAM,OAAK,GAAC;KACpB8B,KAAI7B,QAAS;KACbH,YAAWgD,OAAQ3C,eAAe;IAAC;IAErCkC,WAAU3C,UAAW;GAAH;EANF;EAQnB0C,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAA2C,OAErCW;AAAU"}
|