@assistant-ui/react 0.14.27 → 0.14.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/ExternalThread.d.ts +11 -1
- package/dist/client/ExternalThread.d.ts.map +1 -1
- package/dist/client/ExternalThread.js +758 -513
- package/dist/client/ExternalThread.js.map +1 -1
- package/dist/context/react/utils/createContextStoreHook.d.ts.map +1 -1
- package/dist/context/react/utils/createStateHookForRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.d.ts +12 -1
- package/dist/legacy-runtime/cloud/auiV0.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.js +2 -1
- package/dist/legacy-runtime/cloud/auiV0.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.js +7 -6
- package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js +30 -15
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +8 -4
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.js +1 -0
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.js.map +1 -1
- package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
- package/dist/model-context/makeAssistantVisible.d.ts.map +1 -1
- package/dist/model-context/makeAssistantVisible.js +7 -1
- package/dist/model-context/makeAssistantVisible.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarRoot.js +3 -3
- package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarSpeak.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.d.ts +7 -6
- package/dist/primitives/actionBar/useActionBarFloatStatus.d.ts.map +1 -1
- package/dist/primitives/actionBar/useActionBarFloatStatus.js +10 -11
- package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
- package/dist/primitives/assistantModal/popoverRenderPrimitives.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +1 -0
- package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRoot.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +1 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +8 -2
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.js +1 -3
- package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerDictate.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerDictationTranscript.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +6 -4
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerQuote.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerQuote.js.map +1 -1
- package/dist/primitives/composer/ComposerRoot.d.ts +5 -0
- package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerRoot.js +86 -40
- package/dist/primitives/composer/ComposerRoot.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerSend.js +1 -0
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.js +1 -0
- package/dist/primitives/composer/ComposerStopDictation.js.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopover.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopover.js.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverBack.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverCategories.js.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverItems.js.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/TriggerPopoverRootContext.js.map +1 -1
- package/dist/primitives/composer/trigger/detectTrigger.d.ts +1 -1
- package/dist/primitives/composer/trigger/triggerDetectionResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerKeyboardResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerNavigationResource.d.ts.map +1 -1
- package/dist/primitives/composer/trigger/triggerSelectionResource.d.ts.map +1 -1
- package/dist/primitives/dropdownMenuRenderPrimitives.d.ts.map +1 -1
- package/dist/primitives/error/ErrorMessage.d.ts.map +1 -1
- package/dist/primitives/error/ErrorMessage.js.map +1 -1
- package/dist/primitives/error/ErrorRoot.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
- package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
- package/dist/primitives/messagePart/MessagePartImage.d.ts.map +1 -1
- package/dist/primitives/messagePart/MessagePartText.d.ts.map +1 -1
- package/dist/primitives/messagePart/MessagePartText.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartData.d.ts +3 -2
- package/dist/primitives/messagePart/useMessagePartData.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartData.js +3 -2
- package/dist/primitives/messagePart/useMessagePartData.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartFile.d.ts +5 -4
- package/dist/primitives/messagePart/useMessagePartFile.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartFile.js +11 -3
- package/dist/primitives/messagePart/useMessagePartFile.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartImage.d.ts +5 -4
- package/dist/primitives/messagePart/useMessagePartImage.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartImage.js +10 -3
- package/dist/primitives/messagePart/useMessagePartImage.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts +5 -4
- package/dist/primitives/messagePart/useMessagePartReasoning.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartReasoning.js +10 -3
- package/dist/primitives/messagePart/useMessagePartReasoning.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartSource.d.ts +6 -4
- package/dist/primitives/messagePart/useMessagePartSource.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartSource.js +12 -3
- package/dist/primitives/messagePart/useMessagePartSource.js.map +1 -1
- package/dist/primitives/messagePart/useMessagePartText.d.ts +6 -5
- package/dist/primitives/messagePart/useMessagePartText.d.ts.map +1 -1
- package/dist/primitives/messagePart/useMessagePartText.js +10 -3
- package/dist/primitives/messagePart/useMessagePartText.js.map +1 -1
- package/dist/primitives/queueItem/QueueItemRemove.d.ts.map +1 -1
- package/dist/primitives/queueItem/QueueItemRemove.js +1 -0
- package/dist/primitives/queueItem/QueueItemRemove.js.map +1 -1
- package/dist/primitives/queueItem/QueueItemSteer.d.ts.map +1 -1
- package/dist/primitives/queueItem/QueueItemSteer.js +1 -0
- package/dist/primitives/queueItem/QueueItemSteer.js.map +1 -1
- package/dist/primitives/queueItem/QueueItemText.d.ts.map +1 -1
- package/dist/primitives/queueItem/QueueItemText.js.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarQuote.d.ts.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionDescription.d.ts.map +1 -1
- package/dist/primitives/suggestion/SuggestionDescription.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionTitle.d.ts.map +1 -1
- package/dist/primitives/suggestion/SuggestionTitle.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.d.ts.map +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.js +1 -0
- package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -1
- package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadScrollToBottom.js +1 -0
- package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.js +53 -19
- package/dist/primitives/thread/ThreadViewport.js.map +1 -1
- package/dist/primitives/thread/ThreadViewportFooter.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/createReserveObservers.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.d.ts +4 -0
- package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.js +14 -1
- package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.js.map +1 -1
- package/dist/primitives/thread/topAnchor/topAnchorTurn.d.ts +13 -1
- package/dist/primitives/thread/topAnchor/topAnchorTurn.d.ts.map +1 -1
- package/dist/primitives/thread/topAnchor/topAnchorTurn.js +14 -1
- package/dist/primitives/thread/topAnchor/topAnchorTurn.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +2 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/primitives/threadList/ThreadListLoadMore.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListRoot.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListRoot.js.map +1 -1
- package/dist/primitives/threadListFocusGroup.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts.map +1 -1
- package/dist/tests/setup.d.ts +1 -1
- package/dist/utils/Primitive.d.ts.map +1 -1
- package/dist/utils/Primitive.js.map +1 -1
- package/dist/utils/createActionButton.d.ts.map +1 -1
- package/dist/utils/hooks/useOnResizeContent.js +1 -0
- package/dist/utils/hooks/useOnResizeContent.js.map +1 -1
- package/dist/utils/hooks/useSizeHandle.js +1 -0
- package/dist/utils/hooks/useSizeHandle.js.map +1 -1
- package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
- package/dist/utils/smooth/useSmooth.js +2 -2
- package/dist/utils/smooth/useSmooth.js.map +1 -1
- package/package.json +20 -20
- package/src/client/ExternalThread.ts +341 -53
- package/src/legacy-runtime/cloud/auiV0.ts +14 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/commandQueue.ts +4 -1
- package/src/legacy-runtime/runtime-cores/assistant-transport/runManager.ts +37 -10
- package/src/legacy-runtime/runtime-cores/assistant-transport/transport-delivery.test.tsx +79 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/transport-parentid.test.tsx +97 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/transport-scheduling.test.ts +113 -2
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransport.spec.md +10 -2
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.test.tsx +189 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.ts +20 -4
- package/src/model-context/makeAssistantVisible.test.tsx +146 -0
- package/src/model-context/makeAssistantVisible.tsx +18 -1
- package/src/primitives/actionBar/useActionBarFloatStatus.ts +7 -5
- package/src/primitives/composer/ComposerAddAttachment.test.tsx +108 -0
- package/src/primitives/composer/ComposerAddAttachment.ts +10 -4
- package/src/primitives/composer/ComposerAttachmentDropzone.test.tsx +3 -2
- package/src/primitives/composer/ComposerAttachmentDropzone.tsx +3 -2
- package/src/primitives/composer/ComposerInput.test.tsx +98 -1
- package/src/primitives/composer/ComposerInput.tsx +10 -8
- package/src/primitives/composer/ComposerRoot.test.tsx +226 -5
- package/src/primitives/composer/ComposerRoot.tsx +50 -1
- package/src/primitives/messagePart/useMessagePartData.ts +3 -2
- package/src/primitives/messagePart/useMessagePartFile.ts +19 -7
- package/src/primitives/messagePart/useMessagePartImage.ts +18 -7
- package/src/primitives/messagePart/useMessagePartReasoning.ts +15 -6
- package/src/primitives/messagePart/useMessagePartSource.ts +20 -7
- package/src/primitives/messagePart/useMessagePartText.ts +15 -5
- package/src/primitives/thread/ThreadViewport.tsx +15 -0
- package/src/primitives/thread/topAnchor/mountTopAnchorReserve.test.ts +243 -0
- package/src/primitives/thread/topAnchor/mountTopAnchorReserve.ts +28 -7
- package/src/primitives/thread/topAnchor/topAnchorTurn.test.ts +69 -0
- package/src/primitives/thread/topAnchor/topAnchorTurn.ts +29 -0
- package/src/primitives/thread/useThreadViewportAutoScroll.test.tsx +86 -1
- package/src/primitives/thread/useThreadViewportAutoScroll.ts +6 -1
- package/src/tests/DataRenderers.test.tsx +212 -0
- package/src/tests/RemoteThreadListRuntime.adapterProvider.test.tsx +1 -11
- package/src/tests/external-thread-attachments.test.tsx +372 -0
- package/src/tests/external-thread-parity.test.tsx +232 -0
- package/src/tests/generative-ui.test.tsx +1 -46
- package/src/tests/messagePartSwitchRace.test.tsx +172 -0
- package/src/tests/messagePartTypeMismatch.test.tsx +146 -0
- package/src/tests/threadMessageById.test.tsx +0 -7
- package/src/utils/smooth/useSmooth.ts +7 -4
- package/src/tests/BaseComposerRuntimeCore.test.ts +0 -612
- package/src/tests/BaseSubscribable.test.ts +0 -54
- package/src/tests/DataRenderers.test.ts +0 -355
- package/src/tests/ExternalStoreThreadRuntimeCore.test.ts +0 -685
- package/src/tests/LocalThreadRuntimeCore.test.ts +0 -324
- package/src/tests/auiV0Encode.test.ts +0 -188
- package/src/tests/external-message-converter.test.ts +0 -346
- package/src/tests/shouldContinue.test.ts +0 -122
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mountTopAnchorReserve.js","names":["computeTopAnchorReserve","computeTopAnchorTargetScrollTop","createReserveObservers","createReserveElement","getAnchorId","setReserveHeight","snapScrollTop","TopAnchorStore","getState","turnAnchor","element","viewport","HTMLElement","anchor","target","targetConfig","tallerThan","visibleHeight","subscribe","fn","createFrameScheduler","frame","schedule","requestAnimationFrame","cancel","cancelAnimationFrame","mountTopAnchorReserve","store","reserve","lastScrolledAnchorId","apply","state","clamp","observers","disconnect","remove","parentElement","previousElementSibling","after","reserveChanged","scheduler","
|
|
1
|
+
{"version":3,"file":"mountTopAnchorReserve.js","names":["computeTopAnchorReserve","computeTopAnchorTargetScrollTop","createReserveObservers","createReserveElement","getAnchorId","setReserveHeight","snapScrollTop","TopAnchorStore","getState","turnAnchor","element","viewport","HTMLElement","anchor","target","targetConfig","tallerThan","visibleHeight","topAnchorTurn","anchorId","targetId","subscribe","fn","createFrameScheduler","frame","schedule","requestAnimationFrame","cancel","cancelAnimationFrame","mountTopAnchorReserve","store","reserve","lastScrolledAnchorId","apply","state","clamp","observers","disconnect","remove","parentElement","lastElementChild","append","previousElementSibling","after","reserveChanged","scheduler","undefined","targetScrollTop","Math","abs","scrollTop","scrollTo","top","behavior","unsubscribe"],"sources":["../../../../src/primitives/thread/topAnchor/mountTopAnchorReserve.ts"],"sourcesContent":["\"use client\";\n\nimport {\n computeTopAnchorReserve,\n computeTopAnchorTargetScrollTop,\n} from \"./computeTopAnchorSlack\";\nimport { createReserveObservers } from \"./createReserveObservers\";\nimport {\n createReserveElement,\n getAnchorId,\n setReserveHeight,\n snapScrollTop,\n} from \"./topAnchorUtils\";\n\n/**\n * Minimal slice of `ThreadViewportStore` that the top-anchor reserve needs.\n * Decoupling from the full store keeps `mountTopAnchorReserve` testable in\n * isolation and re-usable from any consumer that can adapt to this shape.\n */\nexport type TopAnchorStore = {\n getState(): {\n turnAnchor: \"top\" | \"bottom\";\n element: {\n viewport: HTMLElement | null;\n anchor: HTMLElement | null;\n target: HTMLElement | null;\n };\n targetConfig: {\n tallerThan: number;\n visibleHeight: number;\n } | null;\n topAnchorTurn: {\n readonly anchorId: string;\n readonly targetId: string;\n } | null;\n };\n subscribe(fn: () => void): () => void;\n};\n\nconst createFrameScheduler = (fn: () => void) => {\n let frame: number | null = null;\n\n return {\n schedule: () => {\n if (frame !== null) return;\n frame = requestAnimationFrame(() => {\n frame = null;\n fn();\n });\n },\n cancel: () => {\n if (frame !== null) {\n cancelAnimationFrame(frame);\n frame = null;\n }\n },\n };\n};\n\nexport const mountTopAnchorReserve = (store: TopAnchorStore) => {\n let reserve: HTMLElement | null = null;\n let lastScrolledAnchorId: string | undefined;\n\n function apply() {\n const state = store.getState();\n const { viewport, anchor, target } = state.element;\n const clamp = state.targetConfig;\n\n if (state.turnAnchor !== \"top\" || !viewport) {\n observers.disconnect();\n if (reserve) {\n setReserveHeight(reserve, 0);\n reserve.remove();\n }\n return;\n }\n\n if (!anchor && !target && !clamp && state.topAnchorTurn) {\n // ThreadViewport clears this state once the stored pair stops being the\n // trailing turn (followed at most by pending user messages), so reaching\n // here means the anchor gap is transient and the next run is imminent.\n observers.disconnect();\n if (\n reserve?.parentElement &&\n reserve.parentElement.lastElementChild !== reserve\n ) {\n reserve.parentElement.append(reserve);\n }\n return;\n }\n\n if (!anchor || !target || !clamp) {\n observers.disconnect();\n if (reserve) {\n setReserveHeight(reserve, 0);\n reserve.remove();\n }\n return;\n }\n\n reserve ??= createReserveElement();\n\n if (\n reserve.parentElement !== target.parentElement ||\n reserve.previousElementSibling !== target\n ) {\n target.after(reserve);\n }\n\n observers.target(viewport, anchor, target);\n\n const reserveChanged = setReserveHeight(\n reserve,\n computeTopAnchorReserve({ viewport, anchor, reserve, ...clamp }),\n );\n\n if (reserveChanged) {\n scheduler.schedule();\n return;\n }\n\n const anchorId = getAnchorId(anchor);\n if (anchorId !== undefined && lastScrolledAnchorId === anchorId) return;\n\n const targetScrollTop = snapScrollTop(\n computeTopAnchorTargetScrollTop({ viewport, anchor, ...clamp }),\n );\n\n if (Math.abs(viewport.scrollTop - targetScrollTop) > 1) {\n viewport.scrollTo({ top: targetScrollTop, behavior: \"smooth\" });\n }\n\n if (anchorId !== undefined) lastScrolledAnchorId = anchorId;\n }\n\n const scheduler = createFrameScheduler(apply);\n const observers = createReserveObservers(scheduler.schedule);\n\n scheduler.schedule();\n const unsubscribe = store.subscribe(scheduler.schedule);\n\n return () => {\n scheduler.cancel();\n unsubscribe();\n observers.disconnect();\n reserve?.remove();\n };\n};\n"],"mappings":";;;;;AAuCA,MAAMuB,wBAAwBD,OAAmB;CAC/C,IAAIE,QAAuB;CAE3B,OAAO;EACLC,gBAAgB;GACd,IAAID,UAAU,MAAM;GACpBA,QAAQE,4BAA4B;IAClCF,QAAQ;IACRF,GAAG;GACL,CAAC;EACH;EACAK,cAAc;GACZ,IAAIH,UAAU,MAAM;IAClBI,qBAAqBJ,KAAK;IAC1BA,QAAQ;GACV;EACF;CACF;AACF;AAEA,MAAaK,yBAAyBC,UAA0B;CAC9D,IAAIC,UAA8B;CAClC,IAAIC;CAEJ,SAASC,QAAQ;EACf,MAAMC,QAAQJ,MAAMtB,SAAS;EAC7B,MAAM,EAAEG,UAAUE,QAAQC,WAAWoB,MAAMxB;EAC3C,MAAMyB,QAAQD,MAAMnB;EAEpB,IAAImB,MAAMzB,eAAe,SAAS,CAACE,UAAU;GAC3CyB,UAAUC,WAAW;GACrB,IAAIN,SAAS;IACX1B,iBAAiB0B,SAAS,CAAC;IAC3BA,QAAQO,OAAO;GACjB;GACA;EACF;EAEA,IAAI,CAACzB,UAAU,CAACC,UAAU,CAACqB,SAASD,MAAMhB,eAAe;GAIvDkB,UAAUC,WAAW;GACrB,IACEN,SAASQ,iBACTR,QAAQQ,cAAcC,qBAAqBT,SAE3CA,QAAQQ,cAAcE,OAAOV,OAAO;GAEtC;EACF;EAEA,IAAI,CAAClB,UAAU,CAACC,UAAU,CAACqB,OAAO;GAChCC,UAAUC,WAAW;GACrB,IAAIN,SAAS;IACX1B,iBAAiB0B,SAAS,CAAC;IAC3BA,QAAQO,OAAO;GACjB;GACA;EACF;EAEAP,YAAY5B,qBAAqB;EAEjC,IACE4B,QAAQQ,kBAAkBzB,OAAOyB,iBACjCR,QAAQW,2BAA2B5B,QAEnCA,OAAO6B,MAAMZ,OAAO;EAGtBK,UAAUtB,OAAOH,UAAUE,QAAQC,MAAM;EAOzC,IALuBT,iBACrB0B,SACA/B,wBAAwB;GAAEW;GAAUE;GAAQkB;GAAS,GAAGI;EAAM,CAAC,CAG7DS,GAAgB;GAClBC,UAAUpB,SAAS;GACnB;EACF;EAEA,MAAMN,WAAWf,YAAYS,MAAM;EACnC,IAAIM,aAAa2B,KAAAA,KAAad,yBAAyBb,UAAU;EAEjE,MAAM4B,kBAAkBzC,cACtBL,gCAAgC;GAAEU;GAAUE;GAAQ,GAAGsB;EAAM,CAAC,CAChE;EAEA,IAAIa,KAAKC,IAAItC,SAASuC,YAAYH,eAAe,IAAI,GACnDpC,SAASwC,SAAS;GAAEC,KAAKL;GAAiBM,UAAU;EAAS,CAAC;EAGhE,IAAIlC,aAAa2B,KAAAA,GAAWd,uBAAuBb;CACrD;CAEA,MAAM0B,YAAYtB,qBAAqBU,KAAK;CAC5C,MAAMG,YAAYlC,uBAAuB2C,UAAUpB,QAAQ;CAE3DoB,UAAUpB,SAAS;CACnB,MAAM6B,cAAcxB,MAAMT,UAAUwB,UAAUpB,QAAQ;CAEtD,aAAa;EACXoB,UAAUlB,OAAO;EACjB2B,YAAY;EACZlB,UAAUC,WAAW;EACrBN,SAASO,OAAO;CAClB;AACF"}
|
|
@@ -3,6 +3,18 @@ type TopAnchorTurnMessage = {
|
|
|
3
3
|
readonly id: string;
|
|
4
4
|
readonly role: string;
|
|
5
5
|
};
|
|
6
|
+
type TopAnchorTurn = {
|
|
7
|
+
readonly anchorId: string;
|
|
8
|
+
readonly targetId: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A stored turn stays valid only while it is still the trailing turn: the
|
|
12
|
+
* anchor immediately precedes the target, and anything after the target is a
|
|
13
|
+
* pending user message awaiting the next run. An assistant message after the
|
|
14
|
+
* target means the turn was superseded (e.g. an external store synced in a
|
|
15
|
+
* turn completed elsewhere), so the reserve must be torn down, not preserved.
|
|
16
|
+
*/
|
|
17
|
+
declare const isTopAnchorTurnValid: (turn: TopAnchorTurn | null, messages: readonly TopAnchorTurnMessage[]) => boolean;
|
|
6
18
|
declare const getActiveTopAnchorTurn: ({ isRunning, messages }: {
|
|
7
19
|
readonly isRunning: boolean;
|
|
8
20
|
readonly messages: readonly TopAnchorTurnMessage[];
|
|
@@ -13,5 +25,5 @@ declare const getActiveTopAnchorTurn: ({ isRunning, messages }: {
|
|
|
13
25
|
declare const getActiveTopAnchorAnchorId: (options: Parameters<typeof getActiveTopAnchorTurn>[0]) => string | undefined;
|
|
14
26
|
declare const getActiveTopAnchorTargetId: (options: Parameters<typeof getActiveTopAnchorTurn>[0]) => string | undefined;
|
|
15
27
|
//#endregion
|
|
16
|
-
export { getActiveTopAnchorAnchorId, getActiveTopAnchorTargetId, getActiveTopAnchorTurn };
|
|
28
|
+
export { TopAnchorTurn, getActiveTopAnchorAnchorId, getActiveTopAnchorTargetId, getActiveTopAnchorTurn, isTopAnchorTurnValid };
|
|
17
29
|
//# sourceMappingURL=topAnchorTurn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topAnchorTurn.d.ts","names":[],"sources":["../../../../src/primitives/thread/topAnchor/topAnchorTurn.ts"],"mappings":";KAEK;WACM;WACA;;
|
|
1
|
+
{"version":3,"file":"topAnchorTurn.d.ts","names":[],"sources":["../../../../src/primitives/thread/topAnchor/topAnchorTurn.ts"],"mappings":";KAEK;WACM;WACA;;KAGC;WACD;WACA;;;;;;;;;cAUE,uBACX,MAAM,sBACN,mBAAmB;cAeR,2BAA0B,WAAA;WAI5B;WACA,mBAAmB;;;;;cAWjB,6BACX,SAAS,kBAAkB;cAGhB,6BACX,SAAS,kBAAkB"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/primitives/thread/topAnchor/topAnchorTurn.ts
|
|
3
|
+
/**
|
|
4
|
+
* A stored turn stays valid only while it is still the trailing turn: the
|
|
5
|
+
* anchor immediately precedes the target, and anything after the target is a
|
|
6
|
+
* pending user message awaiting the next run. An assistant message after the
|
|
7
|
+
* target means the turn was superseded (e.g. an external store synced in a
|
|
8
|
+
* turn completed elsewhere), so the reserve must be torn down, not preserved.
|
|
9
|
+
*/
|
|
10
|
+
const isTopAnchorTurnValid = (turn, messages) => {
|
|
11
|
+
if (!turn) return false;
|
|
12
|
+
const targetIndex = messages.findIndex((message) => message.id === turn.targetId);
|
|
13
|
+
if (targetIndex < 1) return false;
|
|
14
|
+
return messages[targetIndex - 1]?.id === turn.anchorId && messages.slice(targetIndex + 1).every((message) => message.role === "user");
|
|
15
|
+
};
|
|
3
16
|
const getActiveTopAnchorTurn = ({ isRunning, messages }) => {
|
|
4
17
|
if (!isRunning) return null;
|
|
5
18
|
const target = messages.at(-1);
|
|
@@ -13,6 +26,6 @@ const getActiveTopAnchorTurn = ({ isRunning, messages }) => {
|
|
|
13
26
|
const getActiveTopAnchorAnchorId = (options) => getActiveTopAnchorTurn(options)?.anchorId;
|
|
14
27
|
const getActiveTopAnchorTargetId = (options) => getActiveTopAnchorTurn(options)?.targetId;
|
|
15
28
|
//#endregion
|
|
16
|
-
export { getActiveTopAnchorAnchorId, getActiveTopAnchorTargetId, getActiveTopAnchorTurn };
|
|
29
|
+
export { getActiveTopAnchorAnchorId, getActiveTopAnchorTargetId, getActiveTopAnchorTurn, isTopAnchorTurnValid };
|
|
17
30
|
|
|
18
31
|
//# sourceMappingURL=topAnchorTurn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topAnchorTurn.js","names":["TopAnchorTurnMessage","id","role","
|
|
1
|
+
{"version":3,"file":"topAnchorTurn.js","names":["TopAnchorTurnMessage","id","role","TopAnchorTurn","anchorId","targetId","isTopAnchorTurnValid","turn","messages","targetIndex","findIndex","message","slice","every","getActiveTopAnchorTurn","isRunning","target","at","anchor","getActiveTopAnchorAnchorId","options","Parameters","getActiveTopAnchorTargetId"],"sources":["../../../../src/primitives/thread/topAnchor/topAnchorTurn.ts"],"sourcesContent":["\"use client\";\n\ntype TopAnchorTurnMessage = {\n readonly id: string;\n readonly role: string;\n};\n\nexport type TopAnchorTurn = {\n readonly anchorId: string;\n readonly targetId: string;\n};\n\n/**\n * A stored turn stays valid only while it is still the trailing turn: the\n * anchor immediately precedes the target, and anything after the target is a\n * pending user message awaiting the next run. An assistant message after the\n * target means the turn was superseded (e.g. an external store synced in a\n * turn completed elsewhere), so the reserve must be torn down, not preserved.\n */\nexport const isTopAnchorTurnValid = (\n turn: TopAnchorTurn | null,\n messages: readonly TopAnchorTurnMessage[],\n) => {\n if (!turn) return false;\n\n const targetIndex = messages.findIndex(\n (message) => message.id === turn.targetId,\n );\n if (targetIndex < 1) return false;\n\n return (\n messages[targetIndex - 1]?.id === turn.anchorId &&\n messages.slice(targetIndex + 1).every((message) => message.role === \"user\")\n );\n};\n\nexport const getActiveTopAnchorTurn = ({\n isRunning,\n messages,\n}: {\n readonly isRunning: boolean;\n readonly messages: readonly TopAnchorTurnMessage[];\n}) => {\n if (!isRunning) return null;\n\n const target = messages.at(-1);\n const anchor = messages.at(-2);\n if (anchor?.role !== \"user\" || target?.role !== \"assistant\") return null;\n\n return { anchorId: anchor.id, targetId: target.id };\n};\n\nexport const getActiveTopAnchorAnchorId = (\n options: Parameters<typeof getActiveTopAnchorTurn>[0],\n) => getActiveTopAnchorTurn(options)?.anchorId;\n\nexport const getActiveTopAnchorTargetId = (\n options: Parameters<typeof getActiveTopAnchorTurn>[0],\n) => getActiveTopAnchorTurn(options)?.targetId;\n"],"mappings":";;;;;;;;;AAmBA,MAAaM,wBACXC,MACAC,aACG;CACH,IAAI,CAACD,MAAM,OAAO;CAElB,MAAME,cAAcD,SAASE,WAC1BC,YAAYA,QAAQV,OAAOM,KAAKF,QACnC;CACA,IAAII,cAAc,GAAG,OAAO;CAE5B,OACED,SAASC,cAAc,EAAE,EAAER,OAAOM,KAAKH,YACvCI,SAASI,MAAMH,cAAc,CAAC,CAAC,CAACI,OAAOF,YAAYA,QAAQT,SAAS,MAAM;AAE9E;AAEA,MAAaY,0BAA0B,EACrCC,WACAP,eAII;CACJ,IAAI,CAACO,WAAW,OAAO;CAEvB,MAAMC,SAASR,SAASS,GAAG,EAAE;CAC7B,MAAMC,SAASV,SAASS,GAAG,EAAE;CAC7B,IAAIC,QAAQhB,SAAS,UAAUc,QAAQd,SAAS,aAAa,OAAO;CAEpE,OAAO;EAAEE,UAAUc,OAAOjB;EAAII,UAAUW,OAAOf;CAAG;AACpD;AAEA,MAAakB,8BACXC,YACGN,uBAAuBM,OAAO,CAAC,EAAEhB;AAEtC,MAAakB,8BACXF,YACGN,uBAAuBM,OAAO,CAAC,EAAEf"}
|
|
@@ -11,6 +11,7 @@ import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
|
11
11
|
const useThreadViewportAutoScroll = ({ autoScroll, scrollToBottomOnRunStart = true, scrollToBottomOnInitialize = true, scrollToBottomOnThreadSwitch = true }) => {
|
|
12
12
|
const divRef = useRef(null);
|
|
13
13
|
const hasMessages = useAuiState((s) => s.thread.messages.length > 0);
|
|
14
|
+
const isRunning = useAuiState((s_0) => s_0.thread.isRunning);
|
|
14
15
|
const initializeScrollRequestedRef = useRef(false);
|
|
15
16
|
const scheduledFrameRef = useRef(null);
|
|
16
17
|
const threadViewportStore = useThreadViewportStore();
|
|
@@ -68,7 +69,7 @@ const useThreadViewportAutoScroll = ({ autoScroll, scrollToBottomOnRunStart = tr
|
|
|
68
69
|
const scrollBehavior = scrollingToBottomBehaviorRef.current;
|
|
69
70
|
if (scrollBehavior && hasActiveTopAnchor()) scrollingToBottomBehaviorRef.current = null;
|
|
70
71
|
else if (scrollBehavior) scrollToBottom(scrollBehavior);
|
|
71
|
-
else if (autoScroll && threadViewportStore.getState().isAtBottom) scrollToBottom("instant");
|
|
72
|
+
else if (autoScroll && !(isRunning && hasActiveTopAnchor()) && threadViewportStore.getState().isAtBottom) scrollToBottom("instant");
|
|
72
73
|
handleScroll();
|
|
73
74
|
});
|
|
74
75
|
const scrollRef = useManagedRef((el) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThreadViewportAutoScroll.js","names":["useComposedRefs","useCallback","useLayoutEffect","useRef","RefCallback","useAuiEvent","useAuiState","useOnResizeContent","useOnScrollToBottom","useManagedRef","writableStore","useThreadViewportStore","useThreadViewportAutoScroll","Options","autoScroll","scrollToBottomOnRunStart","scrollToBottomOnInitialize","scrollToBottomOnThreadSwitch","HTMLElement","TElement","divRef","hasMessages","s","thread","messages","length","initializeScrollRequestedRef","scheduledFrameRef","threadViewportStore","undefined","getState","turnAnchor","lastScrollTop","lastScrollHeight","lastObservedScrollHeight","lastObservedClientHeight","scrollingToBottomBehaviorRef","ScrollBehavior","scrollToBottom","behavior","div","current","scrollTo","top","scrollHeight","scheduleScrollToBottom","cancelAnimationFrame","requestAnimationFrame","hasActiveTopAnchor","state","element","viewport","anchor","handleScroll","isAtBottom","newIsAtBottom","Math","abs","scrollTop","clientHeight","isInFlightDownwardScroll","viewportOverflows","shouldUpdate","setState","resizeRef","scrollBehavior","scrollRef","el","cancelPendingScrollToBottom","addEventListener","removeEventListener","autoScrollRef"],"sources":["../../../src/primitives/thread/useThreadViewportAutoScroll.ts"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallback, useLayoutEffect, useRef, type RefCallback } from \"react\";\nimport { useAuiEvent, useAuiState } from \"@assistant-ui/store\";\nimport { useOnResizeContent } from \"../../utils/hooks/useOnResizeContent\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useManagedRef } from \"../../utils/hooks/useManagedRef\";\nimport { writableStore } from \"../../context/ReadonlyStore\";\nimport { useThreadViewportStore } from \"../../context/react/ThreadViewportContext\";\n\nexport namespace useThreadViewportAutoScroll {\n export type Options = {\n /**\n * Whether to automatically scroll to the bottom when new messages are added.\n * When enabled, the viewport will automatically scroll to show the latest content.\n *\n * Default false if `turnAnchor` is \"top\", otherwise defaults to true.\n */\n autoScroll?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when a new run starts.\n *\n * Defaults to true.\n */\n scrollToBottomOnRunStart?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when messages first appear in the thread.\n *\n * Defaults to true.\n */\n scrollToBottomOnInitialize?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when switching to a different thread.\n *\n * Defaults to true.\n */\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n };\n}\n\nexport const useThreadViewportAutoScroll = <TElement extends HTMLElement>({\n autoScroll,\n scrollToBottomOnRunStart = true,\n scrollToBottomOnInitialize = true,\n scrollToBottomOnThreadSwitch = true,\n}: useThreadViewportAutoScroll.Options): RefCallback<TElement> => {\n const divRef = useRef<TElement>(null);\n const hasMessages = useAuiState((s) => s.thread.messages.length > 0);\n const initializeScrollRequestedRef = useRef(false);\n const scheduledFrameRef = useRef<number | null>(null);\n\n const threadViewportStore = useThreadViewportStore();\n if (autoScroll === undefined) {\n autoScroll = threadViewportStore.getState().turnAnchor !== \"top\";\n }\n\n const lastScrollTop = useRef<number>(0);\n const lastScrollHeight = useRef<number>(0);\n const lastObservedScrollHeight = useRef<number>(0);\n const lastObservedClientHeight = useRef<number>(0);\n\n // Pending bottom-scroll intent. Planted by initialize/run-start/switch/button\n // triggers, cleared when handleScroll confirms we reached bottom, or when the\n // user actively scrolls up while content size is stable.\n const scrollingToBottomBehaviorRef = useRef<ScrollBehavior | null>(null);\n\n const scrollToBottom = useCallback((behavior: ScrollBehavior) => {\n const div = divRef.current;\n if (!div) return;\n\n scrollingToBottomBehaviorRef.current = behavior;\n div.scrollTo({ top: div.scrollHeight, behavior });\n }, []);\n\n const scheduleScrollToBottom = useCallback(\n (behavior: ScrollBehavior) => {\n scrollingToBottomBehaviorRef.current = behavior;\n if (scheduledFrameRef.current !== null) {\n cancelAnimationFrame(scheduledFrameRef.current);\n }\n scheduledFrameRef.current = requestAnimationFrame(() => {\n scheduledFrameRef.current = null;\n scrollToBottom(behavior);\n });\n },\n [scrollToBottom],\n );\n\n useLayoutEffect(\n () => () => {\n if (scheduledFrameRef.current !== null) {\n cancelAnimationFrame(scheduledFrameRef.current);\n }\n },\n [],\n );\n\n const hasActiveTopAnchor = useCallback(() => {\n const state = threadViewportStore.getState();\n return (\n state.turnAnchor === \"top\" &&\n state.element.viewport === divRef.current &&\n state.element.anchor !== null\n );\n }, [threadViewportStore]);\n\n const handleScroll = () => {\n const div = divRef.current;\n if (!div) return;\n\n const isAtBottom = threadViewportStore.getState().isAtBottom;\n const newIsAtBottom =\n Math.abs(div.scrollHeight - div.scrollTop - div.clientHeight) <= 1 ||\n div.scrollHeight <= div.clientHeight;\n\n const isInFlightDownwardScroll =\n !newIsAtBottom && lastScrollTop.current < div.scrollTop;\n if (isInFlightDownwardScroll) {\n // no-op: a smooth scroll-to-bottom fires many midpoint scroll events\n // before landing, don't flicker isAtBottom or clear intent mid-animation\n } else {\n if (newIsAtBottom) {\n // newIsAtBottom is ambiguous when the viewport doesn't overflow —\n // keep intent alive until content can actually scroll\n const viewportOverflows = div.scrollHeight > div.clientHeight + 1;\n if (viewportOverflows) {\n scrollingToBottomBehaviorRef.current = null;\n }\n } else if (\n lastScrollTop.current > div.scrollTop &&\n lastScrollHeight.current === div.scrollHeight\n ) {\n // scrollHeight equality rules out content-driven shifts being misread as user scroll-up\n scrollingToBottomBehaviorRef.current = null;\n }\n\n const shouldUpdate =\n newIsAtBottom || scrollingToBottomBehaviorRef.current === null;\n\n if (shouldUpdate && newIsAtBottom !== isAtBottom) {\n writableStore(threadViewportStore).setState({\n isAtBottom: newIsAtBottom,\n });\n }\n }\n\n lastScrollTop.current = div.scrollTop;\n lastScrollHeight.current = div.scrollHeight;\n };\n\n const resizeRef = useOnResizeContent(() => {\n const div = divRef.current;\n if (!div) return;\n\n const { scrollHeight, clientHeight } = div;\n if (\n scrollHeight === lastObservedScrollHeight.current &&\n clientHeight === lastObservedClientHeight.current\n ) {\n return;\n }\n lastObservedScrollHeight.current = scrollHeight;\n lastObservedClientHeight.current = clientHeight;\n\n const scrollBehavior = scrollingToBottomBehaviorRef.current;\n if (scrollBehavior && hasActiveTopAnchor()) {\n // Let the top-anchor reserve own scrolling while a run starts to avoid a bottom-scroll race.\n scrollingToBottomBehaviorRef.current = null;\n } else if (scrollBehavior) {\n scrollToBottom(scrollBehavior);\n } else if (autoScroll && threadViewportStore.getState().isAtBottom) {\n scrollToBottom(\"instant\");\n }\n\n handleScroll();\n });\n\n const scrollRef = useManagedRef<HTMLElement>((el) => {\n // A pointer gesture invalidates pending bottom-scroll intent; otherwise an\n // intent kept alive by a non-overflowing thread (see handleScroll) hijacks\n // the next content growth, e.g. expanding a collapsible tool call.\n const cancelPendingScrollToBottom = () => {\n scrollingToBottomBehaviorRef.current = null;\n };\n el.addEventListener(\"scroll\", handleScroll);\n el.addEventListener(\"pointerdown\", cancelPendingScrollToBottom);\n return () => {\n el.removeEventListener(\"scroll\", handleScroll);\n el.removeEventListener(\"pointerdown\", cancelPendingScrollToBottom);\n };\n });\n\n useLayoutEffect(() => {\n if (!scrollToBottomOnInitialize) return;\n if (!hasMessages) {\n initializeScrollRequestedRef.current = false;\n return;\n }\n if (initializeScrollRequestedRef.current) return;\n\n initializeScrollRequestedRef.current = true;\n // defer to an in-flight run (e.g. first message on a new thread) that\n // already planted intent — otherwise we'd downgrade its \"auto\" to \"instant\"\n if (scrollingToBottomBehaviorRef.current !== null) return;\n scheduleScrollToBottom(\"instant\");\n }, [hasMessages, scheduleScrollToBottom, scrollToBottomOnInitialize]);\n\n useOnScrollToBottom(({ behavior }) => {\n scrollToBottom(behavior);\n });\n\n useAuiEvent(\"thread.runStart\", () => {\n if (!scrollToBottomOnRunStart) return;\n if (threadViewportStore.getState().turnAnchor === \"top\") return;\n scheduleScrollToBottom(\"auto\");\n });\n\n useAuiEvent(\"threadListItem.switchedTo\", () => {\n if (!scrollToBottomOnThreadSwitch) return;\n scheduleScrollToBottom(\"instant\");\n });\n\n const autoScrollRef = useComposedRefs<TElement>(resizeRef, scrollRef, divRef);\n return autoScrollRef as RefCallback<TElement>;\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"useThreadViewportAutoScroll.js","names":["useComposedRefs","useCallback","useLayoutEffect","useRef","RefCallback","useAuiEvent","useAuiState","useOnResizeContent","useOnScrollToBottom","useManagedRef","writableStore","useThreadViewportStore","useThreadViewportAutoScroll","Options","autoScroll","scrollToBottomOnRunStart","scrollToBottomOnInitialize","scrollToBottomOnThreadSwitch","HTMLElement","TElement","divRef","hasMessages","s","thread","messages","length","isRunning","initializeScrollRequestedRef","scheduledFrameRef","threadViewportStore","undefined","getState","turnAnchor","lastScrollTop","lastScrollHeight","lastObservedScrollHeight","lastObservedClientHeight","scrollingToBottomBehaviorRef","ScrollBehavior","scrollToBottom","behavior","div","current","scrollTo","top","scrollHeight","scheduleScrollToBottom","cancelAnimationFrame","requestAnimationFrame","hasActiveTopAnchor","state","element","viewport","anchor","handleScroll","isAtBottom","newIsAtBottom","Math","abs","scrollTop","clientHeight","isInFlightDownwardScroll","viewportOverflows","shouldUpdate","setState","resizeRef","scrollBehavior","scrollRef","el","cancelPendingScrollToBottom","addEventListener","removeEventListener","autoScrollRef"],"sources":["../../../src/primitives/thread/useThreadViewportAutoScroll.ts"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallback, useLayoutEffect, useRef, type RefCallback } from \"react\";\nimport { useAuiEvent, useAuiState } from \"@assistant-ui/store\";\nimport { useOnResizeContent } from \"../../utils/hooks/useOnResizeContent\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useManagedRef } from \"../../utils/hooks/useManagedRef\";\nimport { writableStore } from \"../../context/ReadonlyStore\";\nimport { useThreadViewportStore } from \"../../context/react/ThreadViewportContext\";\n\nexport namespace useThreadViewportAutoScroll {\n export type Options = {\n /**\n * Whether to automatically scroll to the bottom when new messages are added.\n * When enabled, the viewport will automatically scroll to show the latest content.\n *\n * Default false if `turnAnchor` is \"top\", otherwise defaults to true.\n */\n autoScroll?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when a new run starts.\n *\n * Defaults to true.\n */\n scrollToBottomOnRunStart?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when messages first appear in the thread.\n *\n * Defaults to true.\n */\n scrollToBottomOnInitialize?: boolean | undefined;\n\n /**\n * Whether to scroll to bottom when switching to a different thread.\n *\n * Defaults to true.\n */\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n };\n}\n\nexport const useThreadViewportAutoScroll = <TElement extends HTMLElement>({\n autoScroll,\n scrollToBottomOnRunStart = true,\n scrollToBottomOnInitialize = true,\n scrollToBottomOnThreadSwitch = true,\n}: useThreadViewportAutoScroll.Options): RefCallback<TElement> => {\n const divRef = useRef<TElement>(null);\n const hasMessages = useAuiState((s) => s.thread.messages.length > 0);\n const isRunning = useAuiState((s) => s.thread.isRunning);\n const initializeScrollRequestedRef = useRef(false);\n const scheduledFrameRef = useRef<number | null>(null);\n\n const threadViewportStore = useThreadViewportStore();\n if (autoScroll === undefined) {\n autoScroll = threadViewportStore.getState().turnAnchor !== \"top\";\n }\n\n const lastScrollTop = useRef<number>(0);\n const lastScrollHeight = useRef<number>(0);\n const lastObservedScrollHeight = useRef<number>(0);\n const lastObservedClientHeight = useRef<number>(0);\n\n // Pending bottom-scroll intent. Planted by initialize/run-start/switch/button\n // triggers, cleared when handleScroll confirms we reached bottom, or when the\n // user actively scrolls up while content size is stable.\n const scrollingToBottomBehaviorRef = useRef<ScrollBehavior | null>(null);\n\n const scrollToBottom = useCallback((behavior: ScrollBehavior) => {\n const div = divRef.current;\n if (!div) return;\n\n scrollingToBottomBehaviorRef.current = behavior;\n div.scrollTo({ top: div.scrollHeight, behavior });\n }, []);\n\n const scheduleScrollToBottom = useCallback(\n (behavior: ScrollBehavior) => {\n scrollingToBottomBehaviorRef.current = behavior;\n if (scheduledFrameRef.current !== null) {\n cancelAnimationFrame(scheduledFrameRef.current);\n }\n scheduledFrameRef.current = requestAnimationFrame(() => {\n scheduledFrameRef.current = null;\n scrollToBottom(behavior);\n });\n },\n [scrollToBottom],\n );\n\n useLayoutEffect(\n () => () => {\n if (scheduledFrameRef.current !== null) {\n cancelAnimationFrame(scheduledFrameRef.current);\n }\n },\n [],\n );\n\n const hasActiveTopAnchor = useCallback(() => {\n const state = threadViewportStore.getState();\n return (\n state.turnAnchor === \"top\" &&\n state.element.viewport === divRef.current &&\n state.element.anchor !== null\n );\n }, [threadViewportStore]);\n\n const handleScroll = () => {\n const div = divRef.current;\n if (!div) return;\n\n const isAtBottom = threadViewportStore.getState().isAtBottom;\n const newIsAtBottom =\n Math.abs(div.scrollHeight - div.scrollTop - div.clientHeight) <= 1 ||\n div.scrollHeight <= div.clientHeight;\n\n const isInFlightDownwardScroll =\n !newIsAtBottom && lastScrollTop.current < div.scrollTop;\n if (isInFlightDownwardScroll) {\n // no-op: a smooth scroll-to-bottom fires many midpoint scroll events\n // before landing, don't flicker isAtBottom or clear intent mid-animation\n } else {\n if (newIsAtBottom) {\n // newIsAtBottom is ambiguous when the viewport doesn't overflow —\n // keep intent alive until content can actually scroll\n const viewportOverflows = div.scrollHeight > div.clientHeight + 1;\n if (viewportOverflows) {\n scrollingToBottomBehaviorRef.current = null;\n }\n } else if (\n lastScrollTop.current > div.scrollTop &&\n lastScrollHeight.current === div.scrollHeight\n ) {\n // scrollHeight equality rules out content-driven shifts being misread as user scroll-up\n scrollingToBottomBehaviorRef.current = null;\n }\n\n const shouldUpdate =\n newIsAtBottom || scrollingToBottomBehaviorRef.current === null;\n\n if (shouldUpdate && newIsAtBottom !== isAtBottom) {\n writableStore(threadViewportStore).setState({\n isAtBottom: newIsAtBottom,\n });\n }\n }\n\n lastScrollTop.current = div.scrollTop;\n lastScrollHeight.current = div.scrollHeight;\n };\n\n const resizeRef = useOnResizeContent(() => {\n const div = divRef.current;\n if (!div) return;\n\n const { scrollHeight, clientHeight } = div;\n if (\n scrollHeight === lastObservedScrollHeight.current &&\n clientHeight === lastObservedClientHeight.current\n ) {\n return;\n }\n lastObservedScrollHeight.current = scrollHeight;\n lastObservedClientHeight.current = clientHeight;\n\n const scrollBehavior = scrollingToBottomBehaviorRef.current;\n if (scrollBehavior && hasActiveTopAnchor()) {\n // Let the top-anchor reserve own scrolling while a run starts to avoid a bottom-scroll race.\n scrollingToBottomBehaviorRef.current = null;\n } else if (scrollBehavior) {\n scrollToBottom(scrollBehavior);\n } else if (\n autoScroll &&\n !(isRunning && hasActiveTopAnchor()) &&\n threadViewportStore.getState().isAtBottom\n ) {\n scrollToBottom(\"instant\");\n }\n\n handleScroll();\n });\n\n const scrollRef = useManagedRef<HTMLElement>((el) => {\n // A pointer gesture invalidates pending bottom-scroll intent; otherwise an\n // intent kept alive by a non-overflowing thread (see handleScroll) hijacks\n // the next content growth, e.g. expanding a collapsible tool call.\n const cancelPendingScrollToBottom = () => {\n scrollingToBottomBehaviorRef.current = null;\n };\n el.addEventListener(\"scroll\", handleScroll);\n el.addEventListener(\"pointerdown\", cancelPendingScrollToBottom);\n return () => {\n el.removeEventListener(\"scroll\", handleScroll);\n el.removeEventListener(\"pointerdown\", cancelPendingScrollToBottom);\n };\n });\n\n useLayoutEffect(() => {\n if (!scrollToBottomOnInitialize) return;\n if (!hasMessages) {\n initializeScrollRequestedRef.current = false;\n return;\n }\n if (initializeScrollRequestedRef.current) return;\n\n initializeScrollRequestedRef.current = true;\n // defer to an in-flight run (e.g. first message on a new thread) that\n // already planted intent — otherwise we'd downgrade its \"auto\" to \"instant\"\n if (scrollingToBottomBehaviorRef.current !== null) return;\n scheduleScrollToBottom(\"instant\");\n }, [hasMessages, scheduleScrollToBottom, scrollToBottomOnInitialize]);\n\n useOnScrollToBottom(({ behavior }) => {\n scrollToBottom(behavior);\n });\n\n useAuiEvent(\"thread.runStart\", () => {\n if (!scrollToBottomOnRunStart) return;\n if (threadViewportStore.getState().turnAnchor === \"top\") return;\n scheduleScrollToBottom(\"auto\");\n });\n\n useAuiEvent(\"threadListItem.switchedTo\", () => {\n if (!scrollToBottomOnThreadSwitch) return;\n scheduleScrollToBottom(\"instant\");\n });\n\n const autoScrollRef = useComposedRefs<TElement>(resizeRef, scrollRef, divRef);\n return autoScrollRef as RefCallback<TElement>;\n};\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListLoadMore.d.ts","names":[],"sources":["../../../src/primitives/threadList/ThreadListLoadMore.tsx"],"mappings":";;cASM;kBAMW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,6CAA2B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListLoadMore.d.ts","names":[],"sources":["../../../src/primitives/threadList/ThreadListLoadMore.tsx"],"mappings":";;cASM;kBAMW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,6CAA2B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAGvC,cAAA,6CAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListNew.d.ts","names":[],"sources":["../../../src/primitives/threadList/ThreadListNew.tsx"],"mappings":";;kBAYiB;OACH,UAAU;OACV,QAAQ;;cAGT,wCAAsB,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListNew.d.ts","names":[],"sources":["../../../src/primitives/threadList/ThreadListNew.tsx"],"mappings":";;kBAYiB;OACH,UAAU;OACV,QAAQ;;cAGT,wCAAsB,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAoBjC,cAAA,6CAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListRoot.d.ts","names":[],"sources":["../../../src/primitives/threadList/ThreadListRoot.tsx"],"mappings":";;;KAUK,oBAAoB,gCAAgC,UAAU;kBAElD;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ;;cAGT,yCAAuB,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListRoot.d.ts","names":[],"sources":["../../../src/primitives/threadList/ThreadListRoot.tsx"],"mappings":";;;KAUK,oBAAoB,gCAAgC,UAAU;kBAElD;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ;;cAGT,yCAAuB,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA;;;;oBAWlC,cAAA,0CAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListRoot.js","names":["c","_c","Primitive","ComponentPropsWithoutRef","ComponentRef","forwardRef","ThreadListCollection","PrimitiveDivProps","div","ThreadListPrimitiveRoot","Element","Props","props","ref","$","t0","undefined","displayName"],"sources":["../../../src/primitives/threadList/ThreadListRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { ThreadListCollection } from \"../threadListFocusGroup\";\n\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport namespace ThreadListPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = PrimitiveDivProps;\n}\n\nexport const ThreadListPrimitiveRoot = forwardRef<\n ThreadListPrimitiveRoot.Element,\n ThreadListPrimitiveRoot.Props\n>((props, ref) => {\n return (\n <ThreadListCollection.Provider scope={undefined}>\n <ThreadListCollection.Slot scope={undefined}>\n <Primitive.div {...props} ref={ref} />\n </ThreadListCollection.Slot>\n </ThreadListCollection.Provider>\n );\n});\n\nThreadListPrimitiveRoot.displayName = \"ThreadListPrimitive.Root\";\n"],"mappings":";;;;;;;AAiBA,MAAaS,0BAA0BJ,YAGrCO,OAAAC,QAAA;CAAA,MAAAC,IAAAb,EAAA,CAAA;CAAA,IAAAc;CAAA,IAAAD,EAAA,OAAAF,SAAAE,EAAA,OAAAD,KAAA;EAEEE,KAAA,oBAAA,qBAAA,UAAA;GAAsCC,OAAAA,KAAAA;
|
|
1
|
+
{"version":3,"file":"ThreadListRoot.js","names":["c","_c","Primitive","ComponentPropsWithoutRef","ComponentRef","forwardRef","ThreadListCollection","PrimitiveDivProps","div","ThreadListPrimitiveRoot","Element","Props","props","ref","$","t0","undefined","displayName"],"sources":["../../../src/primitives/threadList/ThreadListRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { ThreadListCollection } from \"../threadListFocusGroup\";\n\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport namespace ThreadListPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = PrimitiveDivProps;\n}\n\nexport const ThreadListPrimitiveRoot = forwardRef<\n ThreadListPrimitiveRoot.Element,\n ThreadListPrimitiveRoot.Props\n>((props, ref) => {\n return (\n <ThreadListCollection.Provider scope={undefined}>\n <ThreadListCollection.Slot scope={undefined}>\n <Primitive.div {...props} ref={ref} />\n </ThreadListCollection.Slot>\n </ThreadListCollection.Provider>\n );\n});\n\nThreadListPrimitiveRoot.displayName = \"ThreadListPrimitive.Root\";\n"],"mappings":";;;;;;;AAiBA,MAAaS,0BAA0BJ,YAGrCO,OAAAC,QAAA;CAAA,MAAAC,IAAAb,EAAA,CAAA;CAAA,IAAAc;CAAA,IAAAD,EAAA,OAAAF,SAAAE,EAAA,OAAAD,KAAA;EAEEE,KAAA,oBAAA,qBAAA,UAAA;GAAsCC,OAAAA,KAAAA;GACpC,UAAA,oBAAA,qBAAA,MAAA;IAAkCA,OAAAA,KAAAA;IAChC,UAAA,oBAAA,UAAA,KAAA;KAAA,GAAmBJ;KAAYC;IAAG,CAAA;GACpC,CAAA;EACF,CAAA;EAAgCC,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAAA,OAJhCC;AAIgC,CAEnC;AAEDN,wBAAwBQ,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threadListFocusGroup.d.ts","names":[],"sources":["../../src/primitives/threadListFocusGroup.ts"],"mappings":";;cAKmB,0BAAuB;OAAvB,UAAA;;cAGN;;
|
|
1
|
+
{"version":3,"file":"threadListFocusGroup.d.ts","names":[],"sources":["../../src/primitives/threadListFocusGroup.ts"],"mappings":";;cAKmB,0BAAuB;OAAvB,UAAA;;cAGN;;IAKe,WAAC,MAAA;;;;;;;;;KAFxB;EACH,YAAY,UAAU;EACtB,SAAS,UAAU;;cAOR,6CAA2B,SAAA;cAE3B,8BAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemArchive.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemArchive.ts"],"mappings":";;cASM;kBAKW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,gDAA8B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListItemArchive.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemArchive.ts"],"mappings":";;cASM;kBAKW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,gDAA8B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAG1C,cAAA,6CAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemDelete.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemDelete.ts"],"mappings":";;cASM;kBAKW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,+CAA6B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListItemDelete.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemDelete.ts"],"mappings":";;cASM;kBAKW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,+CAA6B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAGzC,cAAA,6CAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemRoot.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemRoot.tsx"],"mappings":";;;KAmBK,oBAAoB,gCAAgC,UAAU;kBAElD;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ;;cAGT,6CAA2B,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListItemRoot.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemRoot.tsx"],"mappings":";;;KAmBK,oBAAoB,gCAAgC,UAAU;kBAElD;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ;;cAGT,6CAA2B,0BAAA,KAAA,qBAAA,gBAAA,kCAAA,eAAA;;;;oBAsDtC,cAAA,0CAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemRoot.js","names":["Primitive","ComponentRef","forwardRef","ComponentPropsWithoutRef","KeyboardEvent","useMemo","useRef","useAuiState","composeEventHandlers","Direction","ThreadListItemFocusProvider","useThreadListCollection","PrimitiveDivProps","div","ThreadListItemPrimitiveRoot","Element","Props","props","ref","isMain","s","threads","mainThreadId","threadListItem","id","triggerRef","HTMLButtonElement","moreRef","focus","getItems","undefined","direction","useDirection","onKeyDown","event","HTMLDivElement","forwardKey","backKey","trigger","current","more","target","key","triggers","map","item","filter","node","next","indexOf","preventDefault","displayName"],"sources":["../../../src/primitives/threadListItem/ThreadListItemRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n type KeyboardEvent,\n useMemo,\n useRef,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Direction } from \"radix-ui\";\nimport {\n ThreadListItemFocusProvider,\n useThreadListCollection,\n} from \"../threadListFocusGroup\";\n\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport namespace ThreadListItemPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = PrimitiveDivProps;\n}\n\nexport const ThreadListItemPrimitiveRoot = forwardRef<\n ThreadListItemPrimitiveRoot.Element,\n ThreadListItemPrimitiveRoot.Props\n>((props, ref) => {\n const isMain = useAuiState(\n (s) => s.threads.mainThreadId === s.threadListItem.id,\n );\n\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const moreRef = useRef<HTMLButtonElement | null>(null);\n const focus = useMemo(() => ({ triggerRef, moreRef }), []);\n\n const getItems = useThreadListCollection(undefined);\n const direction = Direction.useDirection();\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const forwardKey = direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n const backKey = direction === \"rtl\" ? \"ArrowRight\" : \"ArrowLeft\";\n const trigger = triggerRef.current;\n const more = moreRef.current;\n\n if (trigger && event.target === trigger) {\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n const triggers = getItems()\n .map((item) => item.ref.current)\n .filter((node): node is HTMLButtonElement => node !== null);\n const next =\n triggers[\n triggers.indexOf(trigger) + (event.key === \"ArrowDown\" ? 1 : -1)\n ];\n if (next) {\n next.focus();\n event.preventDefault();\n }\n } else if (event.key === forwardKey && more) {\n more.focus();\n event.preventDefault();\n }\n } else if (more && event.target === more && event.key === backKey) {\n trigger?.focus();\n event.preventDefault();\n }\n };\n\n return (\n <ThreadListItemFocusProvider value={focus}>\n <Primitive.div\n {...(isMain ? { \"data-active\": \"true\", \"aria-current\": \"true\" } : null)}\n {...props}\n onKeyDown={composeEventHandlers(props.onKeyDown, onKeyDown)}\n ref={ref}\n />\n </ThreadListItemFocusProvider>\n );\n});\n\nThreadListItemPrimitiveRoot.displayName = \"ThreadListItemPrimitive.Root\";\n"],"mappings":";;;;;;;;;AA0BA,MAAac,8BAA8BZ,YAGxCe,OAAOC,QAAQ;CAChB,MAAMC,SAASZ,aACZa,MAAMA,EAAEC,QAAQC,iBAAiBF,EAAEG,eAAeC,EACrD;CAEA,MAAMC,aAAanB,OAAiC,IAAI;CACxD,MAAMqB,UAAUrB,OAAiC,IAAI;CACrD,MAAMsB,QAAQvB,eAAe;EAAEoB;EAAYE;CAAQ,IAAI,CAAA,CAAE;CAEzD,MAAME,WAAWlB,wBAAwBmB,KAAAA,CAAS;CAClD,MAAMC,YAAYtB,UAAUuB,aAAa;CAEzC,MAAMC,aAAaC,UAAyC;EAC1D,MAAME,aAAaL,cAAc,QAAQ,cAAc;EACvD,MAAMM,UAAUN,cAAc,QAAQ,eAAe;EACrD,MAAMO,UAAUb,WAAWc;EAC3B,MAAMC,OAAOb,QAAQY;EAErB,IAAID,WAAWJ,MAAMO,WAAWH;
|
|
1
|
+
{"version":3,"file":"ThreadListItemRoot.js","names":["Primitive","ComponentRef","forwardRef","ComponentPropsWithoutRef","KeyboardEvent","useMemo","useRef","useAuiState","composeEventHandlers","Direction","ThreadListItemFocusProvider","useThreadListCollection","PrimitiveDivProps","div","ThreadListItemPrimitiveRoot","Element","Props","props","ref","isMain","s","threads","mainThreadId","threadListItem","id","triggerRef","HTMLButtonElement","moreRef","focus","getItems","undefined","direction","useDirection","onKeyDown","event","HTMLDivElement","forwardKey","backKey","trigger","current","more","target","key","triggers","map","item","filter","node","next","indexOf","preventDefault","displayName"],"sources":["../../../src/primitives/threadListItem/ThreadListItemRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n type KeyboardEvent,\n useMemo,\n useRef,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Direction } from \"radix-ui\";\nimport {\n ThreadListItemFocusProvider,\n useThreadListCollection,\n} from \"../threadListFocusGroup\";\n\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\n\nexport namespace ThreadListItemPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = PrimitiveDivProps;\n}\n\nexport const ThreadListItemPrimitiveRoot = forwardRef<\n ThreadListItemPrimitiveRoot.Element,\n ThreadListItemPrimitiveRoot.Props\n>((props, ref) => {\n const isMain = useAuiState(\n (s) => s.threads.mainThreadId === s.threadListItem.id,\n );\n\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const moreRef = useRef<HTMLButtonElement | null>(null);\n const focus = useMemo(() => ({ triggerRef, moreRef }), []);\n\n const getItems = useThreadListCollection(undefined);\n const direction = Direction.useDirection();\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const forwardKey = direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n const backKey = direction === \"rtl\" ? \"ArrowRight\" : \"ArrowLeft\";\n const trigger = triggerRef.current;\n const more = moreRef.current;\n\n if (trigger && event.target === trigger) {\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n const triggers = getItems()\n .map((item) => item.ref.current)\n .filter((node): node is HTMLButtonElement => node !== null);\n const next =\n triggers[\n triggers.indexOf(trigger) + (event.key === \"ArrowDown\" ? 1 : -1)\n ];\n if (next) {\n next.focus();\n event.preventDefault();\n }\n } else if (event.key === forwardKey && more) {\n more.focus();\n event.preventDefault();\n }\n } else if (more && event.target === more && event.key === backKey) {\n trigger?.focus();\n event.preventDefault();\n }\n };\n\n return (\n <ThreadListItemFocusProvider value={focus}>\n <Primitive.div\n {...(isMain ? { \"data-active\": \"true\", \"aria-current\": \"true\" } : null)}\n {...props}\n onKeyDown={composeEventHandlers(props.onKeyDown, onKeyDown)}\n ref={ref}\n />\n </ThreadListItemFocusProvider>\n );\n});\n\nThreadListItemPrimitiveRoot.displayName = \"ThreadListItemPrimitive.Root\";\n"],"mappings":";;;;;;;;;AA0BA,MAAac,8BAA8BZ,YAGxCe,OAAOC,QAAQ;CAChB,MAAMC,SAASZ,aACZa,MAAMA,EAAEC,QAAQC,iBAAiBF,EAAEG,eAAeC,EACrD;CAEA,MAAMC,aAAanB,OAAiC,IAAI;CACxD,MAAMqB,UAAUrB,OAAiC,IAAI;CACrD,MAAMsB,QAAQvB,eAAe;EAAEoB;EAAYE;CAAQ,IAAI,CAAA,CAAE;CAEzD,MAAME,WAAWlB,wBAAwBmB,KAAAA,CAAS;CAClD,MAAMC,YAAYtB,UAAUuB,aAAa;CAEzC,MAAMC,aAAaC,UAAyC;EAC1D,MAAME,aAAaL,cAAc,QAAQ,cAAc;EACvD,MAAMM,UAAUN,cAAc,QAAQ,eAAe;EACrD,MAAMO,UAAUb,WAAWc;EAC3B,MAAMC,OAAOb,QAAQY;EAErB,IAAID,WAAWJ,MAAMO,WAAWH,SAC1BJ;OAAAA,MAAMQ,QAAQ,eAAeR,MAAMQ,QAAQ,WAAW;IACxD,MAAMC,WAAWd,SAAS,CAAC,CACxBe,KAAKC,SAASA,KAAK3B,IAAIqB,OAAO,CAAC,CAC/BO,QAAQC,SAAoCA,SAAS,IAAI;IAC5D,MAAMC,OACJL,SACEA,SAASM,QAAQX,OAAO,KAAKJ,MAAMQ,QAAQ,cAAc,IAAI;IAEjE,IAAIM,MAAM;KACRA,KAAKpB,MAAM;KACXM,MAAMgB,eAAe;IACvB;GACF,OAAO,IAAIhB,MAAMQ,QAAQN,cAAcI,MAAM;IAC3CA,KAAKZ,MAAM;IACXM,MAAMgB,eAAe;GACvB;SACK,IAAIV,QAAQN,MAAMO,WAAWD,QAAQN,MAAMQ,QAAQL,SAAS;GACjEC,SAASV,MAAM;GACfM,MAAMgB,eAAe;EACvB;CACF;CAEA,OACE,oBAAC,6BAAD;EAA6B,OAAOtB;EAClC,UAAA,oBAAC,UAAU,KAAX;GACE,GAAKT,SAAS;IAAE,eAAe;IAAQ,gBAAgB;GAAO,IAAI;GAClE,GAAIF;GACJ,WAAWT,qBAAqBS,MAAMgB,WAAWA,SAAS;GACrDf;EAAI,CAAA;CAEgB,CAAA;AAEjC,CAAC;AAEDJ,4BAA4BqC,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemTrigger.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemTrigger.tsx"],"mappings":";;cAeM;kBAKW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAQlC,gDAA8B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListItemTrigger.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemTrigger.tsx"],"mappings":";;cAeM;kBAKW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAQlC,gDAA8B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAYzC,cAAA,6CAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemTrigger.js","names":["c","_c","forwardRef","useComposedRefs","ActionButtonElement","ActionButtonProps","createActionButton","useThreadListItemTrigger","useThreadListItemTriggerBehavior","ThreadListCollection","useThreadListItemFocus","switchTo","ThreadListItemPrimitiveTrigger","Element","Props","ThreadListItemTriggerButton","props","forwardedRef","$","focus","ref","triggerRef","t0","undefined","displayName"],"sources":["../../../src/primitives/threadListItem/ThreadListItemTrigger.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemTrigger as useThreadListItemTriggerBehavior } from \"@assistant-ui/core/react\";\nimport {\n ThreadListCollection,\n useThreadListItemFocus,\n} from \"../threadListFocusGroup\";\n\nconst useThreadListItemTrigger = () => {\n const { switchTo } = useThreadListItemTriggerBehavior();\n return switchTo;\n};\n\nexport namespace ThreadListItemPrimitiveTrigger {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemTrigger>;\n}\n\nconst ThreadListItemTriggerButton = createActionButton(\n \"ThreadListItemPrimitive.Trigger\",\n useThreadListItemTrigger,\n);\n\nexport const ThreadListItemPrimitiveTrigger = forwardRef<\n ThreadListItemPrimitiveTrigger.Element,\n ThreadListItemPrimitiveTrigger.Props\n>((props, forwardedRef) => {\n const focus = useThreadListItemFocus();\n const ref = useComposedRefs(forwardedRef, focus?.triggerRef);\n\n return (\n <ThreadListCollection.ItemSlot scope={undefined}>\n <ThreadListItemTriggerButton {...props} ref={ref} />\n </ThreadListCollection.ItemSlot>\n );\n});\n\nThreadListItemPrimitiveTrigger.displayName = \"ThreadListItemPrimitive.Trigger\";\n"],"mappings":";;;;;;;;;AAeA,MAAMO,mCAA2B;CAC/B,MAAA,EAAAI,aAAqBH,yBAAiC;CAAE,OACjDG;AAAQ;AAQjB,MAAMI,8BAA8BT,mBAClC,mCACAC,0BACF;AAEA,MAAaK,iCAAiCV,YAG5Cc,OAAAC,iBAAA;CAAA,MAAAC,IAAAjB,EAAA,CAAA;CAEA,MAAAmB,MAAYjB,gBAAgBc,cADdP,uBAC4BS,CAAK,EAAAE,UAAY;CAAE,IAAAC;CAAA,IAAAJ,EAAA,OAAAF,SAAAE,EAAA,OAAAE,KAAA;EAG3DE,KAAA,oBAAA,qBAAA,UAAA;GAAsCC,OAAAA,KAAAA;
|
|
1
|
+
{"version":3,"file":"ThreadListItemTrigger.js","names":["c","_c","forwardRef","useComposedRefs","ActionButtonElement","ActionButtonProps","createActionButton","useThreadListItemTrigger","useThreadListItemTriggerBehavior","ThreadListCollection","useThreadListItemFocus","switchTo","ThreadListItemPrimitiveTrigger","Element","Props","ThreadListItemTriggerButton","props","forwardedRef","$","focus","ref","triggerRef","t0","undefined","displayName"],"sources":["../../../src/primitives/threadListItem/ThreadListItemTrigger.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemTrigger as useThreadListItemTriggerBehavior } from \"@assistant-ui/core/react\";\nimport {\n ThreadListCollection,\n useThreadListItemFocus,\n} from \"../threadListFocusGroup\";\n\nconst useThreadListItemTrigger = () => {\n const { switchTo } = useThreadListItemTriggerBehavior();\n return switchTo;\n};\n\nexport namespace ThreadListItemPrimitiveTrigger {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemTrigger>;\n}\n\nconst ThreadListItemTriggerButton = createActionButton(\n \"ThreadListItemPrimitive.Trigger\",\n useThreadListItemTrigger,\n);\n\nexport const ThreadListItemPrimitiveTrigger = forwardRef<\n ThreadListItemPrimitiveTrigger.Element,\n ThreadListItemPrimitiveTrigger.Props\n>((props, forwardedRef) => {\n const focus = useThreadListItemFocus();\n const ref = useComposedRefs(forwardedRef, focus?.triggerRef);\n\n return (\n <ThreadListCollection.ItemSlot scope={undefined}>\n <ThreadListItemTriggerButton {...props} ref={ref} />\n </ThreadListCollection.ItemSlot>\n );\n});\n\nThreadListItemPrimitiveTrigger.displayName = \"ThreadListItemPrimitive.Trigger\";\n"],"mappings":";;;;;;;;;AAeA,MAAMO,mCAA2B;CAC/B,MAAA,EAAAI,aAAqBH,yBAAiC;CAAE,OACjDG;AAAQ;AAQjB,MAAMI,8BAA8BT,mBAClC,mCACAC,0BACF;AAEA,MAAaK,iCAAiCV,YAG5Cc,OAAAC,iBAAA;CAAA,MAAAC,IAAAjB,EAAA,CAAA;CAEA,MAAAmB,MAAYjB,gBAAgBc,cADdP,uBAC4BS,CAAK,EAAAE,UAAY;CAAE,IAAAC;CAAA,IAAAJ,EAAA,OAAAF,SAAAE,EAAA,OAAAE,KAAA;EAG3DE,KAAA,oBAAA,qBAAA,UAAA;GAAsCC,OAAAA,KAAAA;GACpC,UAAA,oBAAC,6BAAD;IAA4B,GAAKP;IAAYI;GAAG,CAAA;EAClD,CAAA;EAAgCF,EAAA,KAAAF;EAAAE,EAAA,KAAAE;EAAAF,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,OAFhCI;AAEgC,CAEnC;AAEDV,+BAA+BY,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemUnarchive.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemUnarchive.ts"],"mappings":";;cASM;kBAKW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,kDAAgC,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListItemUnarchive.d.ts","names":[],"sources":["../../../src/primitives/threadListItem/ThreadListItemUnarchive.ts"],"mappings":";;cASM;kBAKW;OACH,UAAU;OACV,QAAQ,yBAAyB;;cAGlC,kDAAgC,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAG5C,cAAA,6CAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemMoreContent.d.ts","names":[],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreContent.tsx"],"mappings":";;;;kBAkBiB;OACH,UAAU,oBAAoB,aAAsB;OACpD,QAAQ,2BACX,aAAsB;IAE7B,cACI,gCAAgC,aAAsB;;;cAKjD,oDAAkC,0BAAA,KAAA,aAAA,2CAAA,cAAA;;;
|
|
1
|
+
{"version":3,"file":"ThreadListItemMoreContent.d.ts","names":[],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreContent.tsx"],"mappings":";;;;kBAkBiB;OACH,UAAU,oBAAoB,aAAsB;OACpD,QAAQ,2BACX,aAAsB;IAE7B,cACI,gCAAgC,aAAsB;;;cAKjD,oDAAkC,0BAAA,KAAA,aAAA,2CAAA,cAAA;;;EALvC,cAAA,gCAAgC,aAAsB;oBA8C7D,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemMoreContent.js","names":["c","_c","ComponentPropsWithoutRef","ComponentRef","forwardRef","Direction","DropdownMenu","DropdownMenuPrimitive","composeEventHandlers","WithRenderPropProps","DropdownMenuRenderContent","useThreadListItemFocus","useThreadListItemMoreSharedFocusGroup","useThreadListItemMoreSetOpen","ScopedProps","useDropdownMenuScope","ThreadListItemMorePrimitiveContent","Element","Content","Props","portalProps","Portal","t0","forwardedRef","$","__scopeThreadListItemMore","sideOffset","t1","props","undefined","scope","setOpen","focus","sharedFocusGroup","direction","useDirection","closeKey","t2","T0","t3","moreRef","event","key","preventDefault","current","t4","onKeyDown","t5","t6","onEscapeKeyDown","t7","t8","displayName"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreContent.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Direction, DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport type { WithRenderPropProps } from \"../../utils/Primitive\";\nimport { DropdownMenuRenderContent } from \"../dropdownMenuRenderPrimitives\";\nimport { useThreadListItemFocus } from \"../threadListFocusGroup\";\nimport {\n useThreadListItemMoreSharedFocusGroup,\n useThreadListItemMoreSetOpen,\n} from \"./ThreadListItemMoreRoot\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nexport namespace ThreadListItemMorePrimitiveContent {\n export type Element = ComponentRef<typeof DropdownMenuPrimitive.Content>;\n export type Props = WithRenderPropProps<\n typeof DropdownMenuPrimitive.Content\n > & {\n portalProps?:\n | ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>\n | undefined;\n };\n}\n\nexport const ThreadListItemMorePrimitiveContent = forwardRef<\n ThreadListItemMorePrimitiveContent.Element,\n ThreadListItemMorePrimitiveContent.Props\n>(\n (\n {\n __scopeThreadListItemMore,\n portalProps,\n sideOffset = 4,\n ...props\n }: ScopedProps<ThreadListItemMorePrimitiveContent.Props>,\n forwardedRef,\n ) => {\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n const setOpen = useThreadListItemMoreSetOpen();\n const focus = useThreadListItemFocus();\n const sharedFocusGroup = useThreadListItemMoreSharedFocusGroup();\n const direction = Direction.useDirection();\n const closeKey = direction === \"rtl\" ? \"ArrowRight\" : \"ArrowLeft\";\n\n return (\n <DropdownMenuPrimitive.Portal {...scope} {...portalProps}>\n <DropdownMenuRenderContent\n {...scope}\n {...props}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (!sharedFocusGroup || event.key !== closeKey) return;\n event.preventDefault();\n setOpen(false);\n focus?.moreRef.current?.focus();\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, () => {\n if (!sharedFocusGroup) return;\n focus?.moreRef.current?.focus();\n })}\n ref={forwardedRef}\n sideOffset={sideOffset}\n />\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\n\nThreadListItemMorePrimitiveContent.displayName =\n \"ThreadListItemMorePrimitive.Content\";\n"],"mappings":";;;;;;;;;;;AA6BA,MAAagB,qCAAqCZ,YAIhDkB,IAAAC,iBAAA;CAAA,MAAAC,IAAAvB,EAAA,EAAA;CACE,MAAA,EAAAwB,2BAAAL,aAAAM,YAAAC,IAAA,GAAAC,UAAAN;CAGE,MAAAI,aAAAC,OAAAE,KAAAA,IAAA,IAAAF;CAKF,MAAAG,QAAcf,qBAAqBU,yBAAyB;CAC5D,MAAAM,UAAgBlB,6BAA6B;CAC7C,MAAAmB,QAAcrB,uBAAuB;CACrC,MAAAsB,mBAAyBrB,sCAAsC;CAE/D,MAAAwB,WADkB/B,UAAS8B,aACVD,MAAc,QAAd,eAAA;CAGd,MAAAG,KAAA9B;CACE,MAAA+B,KAAA5B;CAAyB,IAAA6B;CAAA,IAAAf,EAAA,OAAAY,YAAAZ,EAAA,OAAAQ,OAAAQ,WAAAhB,EAAA,OAAAO,WAAAP,EAAA,OAAAS,kBAAA;EAGyBM,MAAAE,UAAA;GAC/C,IAAI,CAACR,oBAAoBQ,MAAKC,QAASN,UAAQ;GAC/CK,MAAKE,eAAgB;GACrBZ,QAAQ,KAAK;GACbC,OAAKQ,QAAiBI,SAAOZ,MAAC;EAAC;EAChCR,EAAA,KAAAY;EAAAZ,EAAA,KAAAQ,OAAAQ;EAAAhB,EAAA,KAAAO;EAAAP,EAAA,KAAAS;EAAAT,EAAA,KAAAe;CAAA,OAAAA,KAAAf,EAAA;CALU,MAAAqB,KAAArC,qBAAqBoB,MAAKkB,WAAYP,EAKhD;CAAC,IAAAQ;CAAA,IAAAvB,EAAA,OAAAQ,OAAAQ,WAAAhB,EAAA,OAAAS,kBAAA;EAC2Dc,WAAA;GAC3D,IAAI,CAACd,kBAAgB;GACrBD,OAAKQ,QAAiBI,SAAOZ,MAAC;EAAC;EAChCR,EAAA,KAAAQ,OAAAQ;EAAAhB,EAAA,KAAAS;EAAAT,EAAA,KAAAuB;CAAA,OAAAA,KAAAvB,EAAA;CAHgB,MAAAwB,KAAAxC,qBAAqBoB,MAAKqB,iBAAkBF,EAG5D;CAAC,IAAAG;CAAA,IAAA1B,EAAA,OAAAc,MAAAd,EAAA,OAAAD,gBAAAC,EAAA,QAAAI,SAAAJ,EAAA,QAAAM,SAAAN,EAAA,QAAAE,cAAAF,EAAA,QAAAqB,MAAArB,EAAA,QAAAwB,IAAA;EAZJE,KAAA,oBAAC,IAAD;GAA0B,GACpBpB;GAAK,GACLF;GACO,WAAAiB;GAMM,iBAAAG;GAIZzB,KAAAA;GACOG;EAAU,CAAA;EACtBF,EAAA,KAAAc;EAAAd,EAAA,KAAAD;EAAAC,EAAA,MAAAI;EAAAJ,EAAA,MAAAM;EAAAN,EAAA,MAAAE;EAAAF,EAAA,MAAAqB;EAAArB,EAAA,MAAAwB;EAAAxB,EAAA,MAAA0B;CAAA,OAAAA,KAAA1B,EAAA;CAAA,IAAA2B;CAAA,IAAA3B,EAAA,QAAAJ,eAAAI,EAAA,QAAAM,SAAAN,EAAA,QAAAa,GAAAhB,UAAAG,EAAA,QAAA0B,IAAA;EAhBJC,KAAA,oBAAA,GAAA,QAAA;GAAA,GAAkCrB;GAAK,GAAMV;
|
|
1
|
+
{"version":3,"file":"ThreadListItemMoreContent.js","names":["c","_c","ComponentPropsWithoutRef","ComponentRef","forwardRef","Direction","DropdownMenu","DropdownMenuPrimitive","composeEventHandlers","WithRenderPropProps","DropdownMenuRenderContent","useThreadListItemFocus","useThreadListItemMoreSharedFocusGroup","useThreadListItemMoreSetOpen","ScopedProps","useDropdownMenuScope","ThreadListItemMorePrimitiveContent","Element","Content","Props","portalProps","Portal","t0","forwardedRef","$","__scopeThreadListItemMore","sideOffset","t1","props","undefined","scope","setOpen","focus","sharedFocusGroup","direction","useDirection","closeKey","t2","T0","t3","moreRef","event","key","preventDefault","current","t4","onKeyDown","t5","t6","onEscapeKeyDown","t7","t8","displayName"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreContent.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Direction, DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport type { WithRenderPropProps } from \"../../utils/Primitive\";\nimport { DropdownMenuRenderContent } from \"../dropdownMenuRenderPrimitives\";\nimport { useThreadListItemFocus } from \"../threadListFocusGroup\";\nimport {\n useThreadListItemMoreSharedFocusGroup,\n useThreadListItemMoreSetOpen,\n} from \"./ThreadListItemMoreRoot\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nexport namespace ThreadListItemMorePrimitiveContent {\n export type Element = ComponentRef<typeof DropdownMenuPrimitive.Content>;\n export type Props = WithRenderPropProps<\n typeof DropdownMenuPrimitive.Content\n > & {\n portalProps?:\n | ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>\n | undefined;\n };\n}\n\nexport const ThreadListItemMorePrimitiveContent = forwardRef<\n ThreadListItemMorePrimitiveContent.Element,\n ThreadListItemMorePrimitiveContent.Props\n>(\n (\n {\n __scopeThreadListItemMore,\n portalProps,\n sideOffset = 4,\n ...props\n }: ScopedProps<ThreadListItemMorePrimitiveContent.Props>,\n forwardedRef,\n ) => {\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n const setOpen = useThreadListItemMoreSetOpen();\n const focus = useThreadListItemFocus();\n const sharedFocusGroup = useThreadListItemMoreSharedFocusGroup();\n const direction = Direction.useDirection();\n const closeKey = direction === \"rtl\" ? \"ArrowRight\" : \"ArrowLeft\";\n\n return (\n <DropdownMenuPrimitive.Portal {...scope} {...portalProps}>\n <DropdownMenuRenderContent\n {...scope}\n {...props}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (!sharedFocusGroup || event.key !== closeKey) return;\n event.preventDefault();\n setOpen(false);\n focus?.moreRef.current?.focus();\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, () => {\n if (!sharedFocusGroup) return;\n focus?.moreRef.current?.focus();\n })}\n ref={forwardedRef}\n sideOffset={sideOffset}\n />\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\n\nThreadListItemMorePrimitiveContent.displayName =\n \"ThreadListItemMorePrimitive.Content\";\n"],"mappings":";;;;;;;;;;;AA6BA,MAAagB,qCAAqCZ,YAIhDkB,IAAAC,iBAAA;CAAA,MAAAC,IAAAvB,EAAA,EAAA;CACE,MAAA,EAAAwB,2BAAAL,aAAAM,YAAAC,IAAA,GAAAC,UAAAN;CAGE,MAAAI,aAAAC,OAAAE,KAAAA,IAAA,IAAAF;CAKF,MAAAG,QAAcf,qBAAqBU,yBAAyB;CAC5D,MAAAM,UAAgBlB,6BAA6B;CAC7C,MAAAmB,QAAcrB,uBAAuB;CACrC,MAAAsB,mBAAyBrB,sCAAsC;CAE/D,MAAAwB,WADkB/B,UAAS8B,aACVD,MAAc,QAAd,eAAA;CAGd,MAAAG,KAAA9B;CACE,MAAA+B,KAAA5B;CAAyB,IAAA6B;CAAA,IAAAf,EAAA,OAAAY,YAAAZ,EAAA,OAAAQ,OAAAQ,WAAAhB,EAAA,OAAAO,WAAAP,EAAA,OAAAS,kBAAA;EAGyBM,MAAAE,UAAA;GAC/C,IAAI,CAACR,oBAAoBQ,MAAKC,QAASN,UAAQ;GAC/CK,MAAKE,eAAgB;GACrBZ,QAAQ,KAAK;GACbC,OAAKQ,QAAiBI,SAAOZ,MAAC;EAAC;EAChCR,EAAA,KAAAY;EAAAZ,EAAA,KAAAQ,OAAAQ;EAAAhB,EAAA,KAAAO;EAAAP,EAAA,KAAAS;EAAAT,EAAA,KAAAe;CAAA,OAAAA,KAAAf,EAAA;CALU,MAAAqB,KAAArC,qBAAqBoB,MAAKkB,WAAYP,EAKhD;CAAC,IAAAQ;CAAA,IAAAvB,EAAA,OAAAQ,OAAAQ,WAAAhB,EAAA,OAAAS,kBAAA;EAC2Dc,WAAA;GAC3D,IAAI,CAACd,kBAAgB;GACrBD,OAAKQ,QAAiBI,SAAOZ,MAAC;EAAC;EAChCR,EAAA,KAAAQ,OAAAQ;EAAAhB,EAAA,KAAAS;EAAAT,EAAA,KAAAuB;CAAA,OAAAA,KAAAvB,EAAA;CAHgB,MAAAwB,KAAAxC,qBAAqBoB,MAAKqB,iBAAkBF,EAG5D;CAAC,IAAAG;CAAA,IAAA1B,EAAA,OAAAc,MAAAd,EAAA,OAAAD,gBAAAC,EAAA,QAAAI,SAAAJ,EAAA,QAAAM,SAAAN,EAAA,QAAAE,cAAAF,EAAA,QAAAqB,MAAArB,EAAA,QAAAwB,IAAA;EAZJE,KAAA,oBAAC,IAAD;GAA0B,GACpBpB;GAAK,GACLF;GACO,WAAAiB;GAMM,iBAAAG;GAIZzB,KAAAA;GACOG;EAAU,CAAA;EACtBF,EAAA,KAAAc;EAAAd,EAAA,KAAAD;EAAAC,EAAA,MAAAI;EAAAJ,EAAA,MAAAM;EAAAN,EAAA,MAAAE;EAAAF,EAAA,MAAAqB;EAAArB,EAAA,MAAAwB;EAAAxB,EAAA,MAAA0B;CAAA,OAAAA,KAAA1B,EAAA;CAAA,IAAA2B;CAAA,IAAA3B,EAAA,QAAAJ,eAAAI,EAAA,QAAAM,SAAAN,EAAA,QAAAa,GAAAhB,UAAAG,EAAA,QAAA0B,IAAA;EAhBJC,KAAA,oBAAA,GAAA,QAAA;GAAA,GAAkCrB;GAAK,GAAMV;GAC3C8B,UAAAA;EAgBF,CAAA;EAA+B1B,EAAA,MAAAJ;EAAAI,EAAA,MAAAM;EAAAN,EAAA,MAAAa,GAAAhB;EAAAG,EAAA,MAAA0B;EAAA1B,EAAA,MAAA2B;CAAA,OAAAA,KAAA3B,EAAA;CAAA,OAjB/B2B;AAiB+B,CAGrC;AAEAnC,mCAAmCoC,cACjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemMoreItem.d.ts","names":[],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreItem.tsx"],"mappings":";;;;kBAQiB;OACH,UAAU,oBAAoB,aAAsB;OACpD,QAAQ,2BAA2B,aAAsB;;cAG1D,iDAA+B,0BAAA,KAAA,aAAA,wCAAA,cAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListItemMoreItem.d.ts","names":[],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreItem.tsx"],"mappings":";;;;kBAQiB;OACH,UAAU,oBAAoB,aAAsB;OACpD,QAAQ,2BAA2B,aAAsB;;cAG1D,iDAA+B,0BAAA,KAAA,aAAA,wCAAA,cAAA;;oBAe3C,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemMoreRoot.js","names":["c","_c","createContext","Dispatch","FC","SetStateAction","useContext","DropdownMenu","DropdownMenuPrimitive","useControllableState","ScopedProps","useDropdownMenuScope","ThreadListItemMoreSetOpenContext","useThreadListItemMoreSetOpen","ThreadListItemMoreSharedFocusGroupContext","useThreadListItemMoreSharedFocusGroup","ThreadListItemMorePrimitiveRoot","Props","DropdownMenuProps","sharedFocusGroup","t0","$","__scopeThreadListItemMore","defaultOpen","modalProp","onOpenChange","openProp","rest","t1","open","modal","undefined","scope","t2","t3","onChange","t4","prop","defaultProp","caller","setOpen","t5","t6","t7","displayName"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n type Dispatch,\n type FC,\n type SetStateAction,\n useContext,\n} from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nconst ThreadListItemMoreSetOpenContext = createContext<\n Dispatch<SetStateAction<boolean>>\n>(() => {});\n\nexport const useThreadListItemMoreSetOpen = (): Dispatch<\n SetStateAction<boolean>\n> => useContext(ThreadListItemMoreSetOpenContext);\n\nconst ThreadListItemMoreSharedFocusGroupContext = createContext(false);\n\nexport const useThreadListItemMoreSharedFocusGroup = (): boolean =>\n useContext(ThreadListItemMoreSharedFocusGroupContext);\n\nexport namespace ThreadListItemMorePrimitiveRoot {\n export type Props = DropdownMenuPrimitive.DropdownMenuProps & {\n /**\n * Join the menu to the thread list's focus group: Right opens it, Left/Escape\n * close it and return focus to the trigger (mirrored in RTL). Forces the menu\n * non-modal, since a focus trap can't let focus cross the trigger/menu\n * boundary. Defaults to a standalone modal dropdown.\n */\n sharedFocusGroup?: boolean | undefined;\n };\n}\n\n/**\n * Root container for the overflow menu, built on Radix DropdownMenu.\n *\n * Defaults to a standard, self-contained modal dropdown. Pass\n * {@link ThreadListItemMorePrimitiveRoot.Props.sharedFocusGroup} to fold it into\n * the thread list's keyboard navigation instead.\n */\nexport const ThreadListItemMorePrimitiveRoot: FC<\n ThreadListItemMorePrimitiveRoot.Props\n> = ({\n __scopeThreadListItemMore,\n open: openProp,\n defaultOpen,\n onOpenChange,\n sharedFocusGroup = false,\n modal: modalProp,\n ...rest\n}: ScopedProps<ThreadListItemMorePrimitiveRoot.Props>) => {\n const modal = sharedFocusGroup ? false : (modalProp ?? true);\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n caller: \"ThreadListItemMorePrimitive.Root\",\n ...(onOpenChange ? { onChange: onOpenChange } : {}),\n });\n\n return (\n <ThreadListItemMoreSharedFocusGroupContext.Provider\n value={sharedFocusGroup}\n >\n <ThreadListItemMoreSetOpenContext.Provider value={setOpen}>\n <DropdownMenuPrimitive.Root\n {...scope}\n {...rest}\n modal={modal}\n open={open}\n onOpenChange={setOpen}\n />\n </ThreadListItemMoreSetOpenContext.Provider>\n </ThreadListItemMoreSharedFocusGroupContext.Provider>\n );\n};\n\nThreadListItemMorePrimitiveRoot.displayName =\n \"ThreadListItemMorePrimitive.Root\";\n"],"mappings":";;;;;;;;AAaA,MAAMY,mCAAmCV,oBAEjC,CAAC,CAAC;AAEV,MAAaW,qCAA+B;CAAA,OAEvCP,WAAWM,gCAAgC;AAAC;AAEjD,MAAME,4CAA4CZ,cAAc,KAAK;AAErE,MAAaa,8CAAwC;CAAA,OACnDT,WAAWQ,yCAAyC;AAAC;;;;;;;;AAqBvD,MAAaE,mCAETI,OAAA;CAAA,MAAAC,IAAApB,EAAA,EAAA;CAAA,IAAAqB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAP,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAE,2BAAAO,MAAAH,UAAAH,aAAAE,cAAAN,kBAAAS,IAAAE,OAAAN,cAAAG,QAAAP;EAQgDC,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAA;EAAAN,4BAAAD,EAAA;EAAAE,cAAAF,EAAA;EAAAG,YAAAH,EAAA;EAAAI,eAAAJ,EAAA;EAAAK,WAAAL,EAAA;EAAAM,OAAAN,EAAA;EAAAO,KAAAP,EAAA;CAAA;CAHnD,MAAAF,mBAAAS,OAAAG,KAAAA,IAAA,QAAAH;CAIA,MAAAE,QAAcX,mBAAA,QAA4BK,aAAA;CAC1C,MAAAQ,QAAcrB,qBAAqBW,yBAAyB;CAG7C,MAAAW,KAAAV,eAAA;CAAoB,IAAAW;CAAA,IAAAb,EAAA,OAAAI,cAAA;EAE7BS,KAAAT,eAAA,EAAAU,UAA2BV,aAAkB,IAA7C,CAA6C;EAACJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAe;CAAA,IAAAf,EAAA,QAAAK,YAAAL,EAAA,QAAAY,MAAAZ,EAAA,QAAAa,IAAA;EAJPE,KAAA;GAAAC,MACrCX;GAAQY,aACDL;GAAoBM,QACzB;GAAkC,GACtCL;EACN;EAACb,EAAA,MAAAK;EAAAL,EAAA,MAAAY;EAAAZ,EAAA,MAAAa;EAAAb,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CALD,MAAA,CAAAQ,MAAAW,WAAwB/B,qBAAqB2B,EAK5C;CAAE,IAAAK;CAAA,IAAApB,EAAA,QAAAS,SAAAT,EAAA,QAAAQ,QAAAR,EAAA,QAAAM,QAAAN,EAAA,QAAAW,SAAAX,EAAA,QAAAmB,SAAA;EAOGC,KAAA,oBAAA,aAAA,MAAA;GAAA,GACMT;GAAK,GACLL;GACGG;GACDD;GACQW,cAAAA;EAAO,CAAA;EACrBnB,EAAA,MAAAS;EAAAT,EAAA,MAAAQ;EAAAR,EAAA,MAAAM;EAAAN,EAAA,MAAAW;EAAAX,EAAA,MAAAmB;EAAAnB,EAAA,MAAAoB;CAAA,OAAAA,KAAApB,EAAA;CAAA,IAAAqB;CAAA,IAAArB,EAAA,QAAAmB,WAAAnB,EAAA,QAAAoB,IAAA;EAPJC,KAAA,oBAAA,iCAAA,UAAA;GAAkDF,OAAAA;
|
|
1
|
+
{"version":3,"file":"ThreadListItemMoreRoot.js","names":["c","_c","createContext","Dispatch","FC","SetStateAction","useContext","DropdownMenu","DropdownMenuPrimitive","useControllableState","ScopedProps","useDropdownMenuScope","ThreadListItemMoreSetOpenContext","useThreadListItemMoreSetOpen","ThreadListItemMoreSharedFocusGroupContext","useThreadListItemMoreSharedFocusGroup","ThreadListItemMorePrimitiveRoot","Props","DropdownMenuProps","sharedFocusGroup","t0","$","__scopeThreadListItemMore","defaultOpen","modalProp","onOpenChange","openProp","rest","t1","open","modal","undefined","scope","t2","t3","onChange","t4","prop","defaultProp","caller","setOpen","t5","t6","t7","displayName"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n type Dispatch,\n type FC,\n type SetStateAction,\n useContext,\n} from \"react\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nconst ThreadListItemMoreSetOpenContext = createContext<\n Dispatch<SetStateAction<boolean>>\n>(() => {});\n\nexport const useThreadListItemMoreSetOpen = (): Dispatch<\n SetStateAction<boolean>\n> => useContext(ThreadListItemMoreSetOpenContext);\n\nconst ThreadListItemMoreSharedFocusGroupContext = createContext(false);\n\nexport const useThreadListItemMoreSharedFocusGroup = (): boolean =>\n useContext(ThreadListItemMoreSharedFocusGroupContext);\n\nexport namespace ThreadListItemMorePrimitiveRoot {\n export type Props = DropdownMenuPrimitive.DropdownMenuProps & {\n /**\n * Join the menu to the thread list's focus group: Right opens it, Left/Escape\n * close it and return focus to the trigger (mirrored in RTL). Forces the menu\n * non-modal, since a focus trap can't let focus cross the trigger/menu\n * boundary. Defaults to a standalone modal dropdown.\n */\n sharedFocusGroup?: boolean | undefined;\n };\n}\n\n/**\n * Root container for the overflow menu, built on Radix DropdownMenu.\n *\n * Defaults to a standard, self-contained modal dropdown. Pass\n * {@link ThreadListItemMorePrimitiveRoot.Props.sharedFocusGroup} to fold it into\n * the thread list's keyboard navigation instead.\n */\nexport const ThreadListItemMorePrimitiveRoot: FC<\n ThreadListItemMorePrimitiveRoot.Props\n> = ({\n __scopeThreadListItemMore,\n open: openProp,\n defaultOpen,\n onOpenChange,\n sharedFocusGroup = false,\n modal: modalProp,\n ...rest\n}: ScopedProps<ThreadListItemMorePrimitiveRoot.Props>) => {\n const modal = sharedFocusGroup ? false : (modalProp ?? true);\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n caller: \"ThreadListItemMorePrimitive.Root\",\n ...(onOpenChange ? { onChange: onOpenChange } : {}),\n });\n\n return (\n <ThreadListItemMoreSharedFocusGroupContext.Provider\n value={sharedFocusGroup}\n >\n <ThreadListItemMoreSetOpenContext.Provider value={setOpen}>\n <DropdownMenuPrimitive.Root\n {...scope}\n {...rest}\n modal={modal}\n open={open}\n onOpenChange={setOpen}\n />\n </ThreadListItemMoreSetOpenContext.Provider>\n </ThreadListItemMoreSharedFocusGroupContext.Provider>\n );\n};\n\nThreadListItemMorePrimitiveRoot.displayName =\n \"ThreadListItemMorePrimitive.Root\";\n"],"mappings":";;;;;;;;AAaA,MAAMY,mCAAmCV,oBAEjC,CAAC,CAAC;AAEV,MAAaW,qCAA+B;CAAA,OAEvCP,WAAWM,gCAAgC;AAAC;AAEjD,MAAME,4CAA4CZ,cAAc,KAAK;AAErE,MAAaa,8CAAwC;CAAA,OACnDT,WAAWQ,yCAAyC;AAAC;;;;;;;;AAqBvD,MAAaE,mCAETI,OAAA;CAAA,MAAAC,IAAApB,EAAA,EAAA;CAAA,IAAAqB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAP,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAE,2BAAAO,MAAAH,UAAAH,aAAAE,cAAAN,kBAAAS,IAAAE,OAAAN,cAAAG,QAAAP;EAQgDC,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAA;EAAAN,4BAAAD,EAAA;EAAAE,cAAAF,EAAA;EAAAG,YAAAH,EAAA;EAAAI,eAAAJ,EAAA;EAAAK,WAAAL,EAAA;EAAAM,OAAAN,EAAA;EAAAO,KAAAP,EAAA;CAAA;CAHnD,MAAAF,mBAAAS,OAAAG,KAAAA,IAAA,QAAAH;CAIA,MAAAE,QAAcX,mBAAA,QAA4BK,aAAA;CAC1C,MAAAQ,QAAcrB,qBAAqBW,yBAAyB;CAG7C,MAAAW,KAAAV,eAAA;CAAoB,IAAAW;CAAA,IAAAb,EAAA,OAAAI,cAAA;EAE7BS,KAAAT,eAAA,EAAAU,UAA2BV,aAAkB,IAA7C,CAA6C;EAACJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAe;CAAA,IAAAf,EAAA,QAAAK,YAAAL,EAAA,QAAAY,MAAAZ,EAAA,QAAAa,IAAA;EAJPE,KAAA;GAAAC,MACrCX;GAAQY,aACDL;GAAoBM,QACzB;GAAkC,GACtCL;EACN;EAACb,EAAA,MAAAK;EAAAL,EAAA,MAAAY;EAAAZ,EAAA,MAAAa;EAAAb,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CALD,MAAA,CAAAQ,MAAAW,WAAwB/B,qBAAqB2B,EAK5C;CAAE,IAAAK;CAAA,IAAApB,EAAA,QAAAS,SAAAT,EAAA,QAAAQ,QAAAR,EAAA,QAAAM,QAAAN,EAAA,QAAAW,SAAAX,EAAA,QAAAmB,SAAA;EAOGC,KAAA,oBAAA,aAAA,MAAA;GAAA,GACMT;GAAK,GACLL;GACGG;GACDD;GACQW,cAAAA;EAAO,CAAA;EACrBnB,EAAA,MAAAS;EAAAT,EAAA,MAAAQ;EAAAR,EAAA,MAAAM;EAAAN,EAAA,MAAAW;EAAAX,EAAA,MAAAmB;EAAAnB,EAAA,MAAAoB;CAAA,OAAAA,KAAApB,EAAA;CAAA,IAAAqB;CAAA,IAAArB,EAAA,QAAAmB,WAAAnB,EAAA,QAAAoB,IAAA;EAPJC,KAAA,oBAAA,iCAAA,UAAA;GAAkDF,OAAAA;GAChDC,UAAAA;EAOF,CAAA;EAA4CpB,EAAA,MAAAmB;EAAAnB,EAAA,MAAAoB;EAAApB,EAAA,MAAAqB;CAAA,OAAAA,KAAArB,EAAA;CAAA,IAAAsB;CAAA,IAAAtB,EAAA,QAAAF,oBAAAE,EAAA,QAAAqB,IAAA;EAX9CC,KAAA,oBAAA,0CAAA,UAAA;GACSxB,OAAAA;GAEPuB,UAAAA;EASF,CAAA;EAAqDrB,EAAA,MAAAF;EAAAE,EAAA,MAAAqB;EAAArB,EAAA,MAAAsB;CAAA,OAAAA,KAAAtB,EAAA;CAAA,OAZrDsB;AAYqD;AAIzD3B,gCAAgC4B,cAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemMoreSeparator.d.ts","names":[],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreSeparator.tsx"],"mappings":";;;;kBAQiB;OACH,UAAU,oBAAoB,aAAsB;OACpD,QAAQ,2BACX,aAAsB;;cAIpB,sDAAoC,0BAAA,KAAA,aAAA,6CAAA,cAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListItemMoreSeparator.d.ts","names":[],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreSeparator.tsx"],"mappings":";;;;kBAQiB;OACH,UAAU,oBAAoB,aAAsB;OACpD,QAAQ,2BACX,aAAsB;;cAIpB,sDAAoC,0BAAA,KAAA,aAAA,6CAAA,cAAA;;oBAehD,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItemMoreTrigger.d.ts","names":[],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreTrigger.tsx"],"mappings":";;;;kBAkBiB;OACH,UAAU,oBAAoB,aAAsB;OACpD,QAAQ,2BAA2B,aAAsB;;cAG1D,oDAAkC,0BAAA,KAAA,aAAA,2CAAA,cAAA"}
|
|
1
|
+
{"version":3,"file":"ThreadListItemMoreTrigger.d.ts","names":[],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreTrigger.tsx"],"mappings":";;;;kBAkBiB;OACH,UAAU,oBAAoB,aAAsB;OACpD,QAAQ,2BAA2B,aAAsB;;cAG1D,oDAAkC,0BAAA,KAAA,aAAA,2CAAA,cAAA;;oBAgC9C,cAAA"}
|
package/dist/tests/setup.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Primitive.d.ts","names":[],"sources":["../../src/utils/Primitive.tsx"],"mappings":";;;;;;;;;;;;cA0BM;KAmBD,wBAAwB;KAExB,oBAAoB,UAAU,eACjC,yBAAyB;EACvB,SAAS;;KAGR,eAAe,UAAU,iBAAiB,4BACrC,aAAgB;iBAajB,eAAe,UAAU,aAAa,WAAW,IAwCtC,0BAChB,oBAAoB,KAAK,cAAc,aAAa;cAclD;;;;
|
|
1
|
+
{"version":3,"file":"Primitive.d.ts","names":[],"sources":["../../src/utils/Primitive.tsx"],"mappings":";;;;;;;;;;;;cA0BM;KAmBD,wBAAwB;KAExB,oBAAoB,UAAU,eACjC,yBAAyB;EACvB,SAAS;;KAGR,eAAe,UAAU,iBAAiB,4BACrC,aAAgB;iBAajB,eAAe,UAAU,aAAa,WAAW,IAwCtC,0BAChB,oBAAoB,KAAK,cAAc,aAAa;cAclD;;;;IAxEO,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA;;;;;IAAA,SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Primitive.js","names":["ComponentPropsWithoutRef","ComponentRef","ElementType","ForwardRefExoticComponent","PropsWithoutRef","ReactElement","ReactNode","RefAttributes","cloneElement","forwardRef","isValidElement","Primitive","RadixPrimitive","NODES","const","PrimitiveNode","WithRenderPropProps","T","render","PrimitiveProps","E","WithRenderPropRuntimeProps","asChild","children","PrimitiveRef","withRenderProp","Component","Wrapped","t0","ref","$","_c","rest","Comp","renderChildren","undefined","props","Record","t1","t2","t3","componentName","displayName","name","createPrimitive","node","RadixComp","reduce","acc","ReturnType","K"],"sources":["../../src/utils/Primitive.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n type ElementType,\n type ForwardRefExoticComponent,\n type PropsWithoutRef,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n cloneElement,\n forwardRef,\n isValidElement,\n} from \"react\";\nimport { Primitive as RadixPrimitive } from \"@radix-ui/react-primitive\";\n\n/**\n * Thin wrapper around `@radix-ui/react-primitive` that adds `render` prop support.\n *\n * When `render` is provided, it is converted to the equivalent `asChild` pattern:\n * render={<Comp props />} + children → asChild + <Comp props>{children}</Comp>\n *\n * All prop merging, ref composition, and event handler chaining remain handled\n * by Radix's battle-tested Slot implementation — we add zero custom logic for that.\n */\n\n// Match @radix-ui/react-primitive's full element set\nconst NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\",\n] as const;\ntype PrimitiveNode = (typeof NODES)[number];\n\ntype WithRenderPropProps<T extends ElementType> =\n ComponentPropsWithoutRef<T> & {\n render?: ReactElement | undefined;\n };\n\ntype PrimitiveProps<E extends PrimitiveNode> = WithRenderPropProps<\n (typeof RadixPrimitive)[E]\n>;\n\ntype WithRenderPropRuntimeProps<T extends ElementType> =\n WithRenderPropProps<T> & {\n asChild?: boolean | undefined;\n children?: ReactNode | undefined;\n };\n\ntype PrimitiveRef<E extends PrimitiveNode> = ComponentRef<\n (typeof RadixPrimitive)[E]\n>;\n\nfunction withRenderProp<T extends ElementType>(Component: T) {\n const Wrapped = forwardRef<ComponentRef<T>, WithRenderPropRuntimeProps<T>>(\n (\n {\n render,\n asChild,\n children,\n ...rest\n }: PropsWithoutRef<WithRenderPropRuntimeProps<T>>,\n ref,\n ) => {\n const Comp = Component as any;\n\n if (render && isValidElement(render)) {\n const renderChildren =\n children !== undefined\n ? children\n : ((render.props as Record<string, unknown>).children as ReactNode);\n\n return (\n <Comp {...(rest as any)} asChild ref={ref}>\n {cloneElement(render, undefined, renderChildren)}\n </Comp>\n );\n }\n\n return (\n <Comp {...(rest as any)} asChild={asChild} ref={ref}>\n {children}\n </Comp>\n );\n },\n );\n\n const componentName =\n typeof Component === \"string\"\n ? Component\n : (Component.displayName ?? Component.name ?? \"Component\");\n Wrapped.displayName = componentName;\n\n return Wrapped as ForwardRefExoticComponent<\n WithRenderPropProps<T> & RefAttributes<ComponentRef<T>>\n >;\n}\n\nfunction createPrimitive<E extends PrimitiveNode>(node: E) {\n const RadixComp = RadixPrimitive[node];\n const Component = withRenderProp(RadixComp);\n\n Component.displayName = `Primitive.${node}`;\n return Component as ForwardRefExoticComponent<\n PrimitiveProps<E> & RefAttributes<PrimitiveRef<E>>\n >;\n}\n\nconst Primitive = NODES.reduce(\n (acc, node) => {\n acc[node] = createPrimitive(node);\n return acc;\n },\n {} as {\n [K in PrimitiveNode]: ReturnType<typeof createPrimitive<K>>;\n },\n);\n\nexport { Primitive, withRenderProp };\nexport type { PrimitiveProps, WithRenderPropProps };\n"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAMa,QAAQ;CACZ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAI;AAuBN,SAASY,eAAsCC,WAAc;CAC3D,MAAMC,UAAUlB,YACdmB,IAAAC,QAAA;EAAA,MAAAC,IAAAC,EAAA,EAAA;EAAA,IAAAT;EAAA,IAAAC;EAAA,IAAAL;EAAA,IAAAc;EAAA,IAAAF,EAAA,OAAAF,IAAA;GACE,CAAA,CAAAV,QAAAI,SAAAC,aAAAS,QAAAJ;GAKiDE,EAAA,KAAAF;GAAAE,EAAA,KAAAR;GAAAQ,EAAA,KAAAP;GAAAO,EAAA,KAAAZ;GAAAY,EAAA,KAAAE;EAAA,OAAA;GAAAV,UAAAQ,EAAA;GAAAP,WAAAO,EAAA;GAAAZ,SAAAY,EAAA;GAAAE,OAAAF,EAAA;EAAA;EAGjD,MAAAG,OAAaP;EAEb,IAAIR,UAAUR,eAAeQ,MAAM,GAAC;GAClC,MAAAgB,iBACEX,aAAaY,KAAAA,IAAbZ,WAEML,OAAMkB,MAAiCb;GAGlC,MAAAe,KAAAN;GAAW,IAAAO;GAAA,IAAAT,EAAA,OAAAZ,UAAAY,EAAA,OAAAI,gBAAA;IACnBK,KAAA/B,aAAaU,QAAQiB,KAAAA,GAAWD,cAAc;IAACJ,EAAA,KAAAZ;IAAAY,EAAA,KAAAI;IAAAJ,EAAA,KAAAS;GAAA,OAAAA,KAAAT,EAAA;GAAA,IAAAU;GAAA,IAAAV,EAAA,OAAAD,OAAAC,EAAA,OAAAQ,MAAAR,EAAA,QAAAS,IAAA;IADlDC,KAAA,oBAAC,MAAD;KAAK,GAAMF;KAAc,SAAA;KAAaT;
|
|
1
|
+
{"version":3,"file":"Primitive.js","names":["ComponentPropsWithoutRef","ComponentRef","ElementType","ForwardRefExoticComponent","PropsWithoutRef","ReactElement","ReactNode","RefAttributes","cloneElement","forwardRef","isValidElement","Primitive","RadixPrimitive","NODES","const","PrimitiveNode","WithRenderPropProps","T","render","PrimitiveProps","E","WithRenderPropRuntimeProps","asChild","children","PrimitiveRef","withRenderProp","Component","Wrapped","t0","ref","$","_c","rest","Comp","renderChildren","undefined","props","Record","t1","t2","t3","componentName","displayName","name","createPrimitive","node","RadixComp","reduce","acc","ReturnType","K"],"sources":["../../src/utils/Primitive.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n type ElementType,\n type ForwardRefExoticComponent,\n type PropsWithoutRef,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n cloneElement,\n forwardRef,\n isValidElement,\n} from \"react\";\nimport { Primitive as RadixPrimitive } from \"@radix-ui/react-primitive\";\n\n/**\n * Thin wrapper around `@radix-ui/react-primitive` that adds `render` prop support.\n *\n * When `render` is provided, it is converted to the equivalent `asChild` pattern:\n * render={<Comp props />} + children → asChild + <Comp props>{children}</Comp>\n *\n * All prop merging, ref composition, and event handler chaining remain handled\n * by Radix's battle-tested Slot implementation — we add zero custom logic for that.\n */\n\n// Match @radix-ui/react-primitive's full element set\nconst NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\",\n] as const;\ntype PrimitiveNode = (typeof NODES)[number];\n\ntype WithRenderPropProps<T extends ElementType> =\n ComponentPropsWithoutRef<T> & {\n render?: ReactElement | undefined;\n };\n\ntype PrimitiveProps<E extends PrimitiveNode> = WithRenderPropProps<\n (typeof RadixPrimitive)[E]\n>;\n\ntype WithRenderPropRuntimeProps<T extends ElementType> =\n WithRenderPropProps<T> & {\n asChild?: boolean | undefined;\n children?: ReactNode | undefined;\n };\n\ntype PrimitiveRef<E extends PrimitiveNode> = ComponentRef<\n (typeof RadixPrimitive)[E]\n>;\n\nfunction withRenderProp<T extends ElementType>(Component: T) {\n const Wrapped = forwardRef<ComponentRef<T>, WithRenderPropRuntimeProps<T>>(\n (\n {\n render,\n asChild,\n children,\n ...rest\n }: PropsWithoutRef<WithRenderPropRuntimeProps<T>>,\n ref,\n ) => {\n const Comp = Component as any;\n\n if (render && isValidElement(render)) {\n const renderChildren =\n children !== undefined\n ? children\n : ((render.props as Record<string, unknown>).children as ReactNode);\n\n return (\n <Comp {...(rest as any)} asChild ref={ref}>\n {cloneElement(render, undefined, renderChildren)}\n </Comp>\n );\n }\n\n return (\n <Comp {...(rest as any)} asChild={asChild} ref={ref}>\n {children}\n </Comp>\n );\n },\n );\n\n const componentName =\n typeof Component === \"string\"\n ? Component\n : (Component.displayName ?? Component.name ?? \"Component\");\n Wrapped.displayName = componentName;\n\n return Wrapped as ForwardRefExoticComponent<\n WithRenderPropProps<T> & RefAttributes<ComponentRef<T>>\n >;\n}\n\nfunction createPrimitive<E extends PrimitiveNode>(node: E) {\n const RadixComp = RadixPrimitive[node];\n const Component = withRenderProp(RadixComp);\n\n Component.displayName = `Primitive.${node}`;\n return Component as ForwardRefExoticComponent<\n PrimitiveProps<E> & RefAttributes<PrimitiveRef<E>>\n >;\n}\n\nconst Primitive = NODES.reduce(\n (acc, node) => {\n acc[node] = createPrimitive(node);\n return acc;\n },\n {} as {\n [K in PrimitiveNode]: ReturnType<typeof createPrimitive<K>>;\n },\n);\n\nexport { Primitive, withRenderProp };\nexport type { PrimitiveProps, WithRenderPropProps };\n"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAMa,QAAQ;CACZ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAI;AAuBN,SAASY,eAAsCC,WAAc;CAC3D,MAAMC,UAAUlB,YACdmB,IAAAC,QAAA;EAAA,MAAAC,IAAAC,EAAA,EAAA;EAAA,IAAAT;EAAA,IAAAC;EAAA,IAAAL;EAAA,IAAAc;EAAA,IAAAF,EAAA,OAAAF,IAAA;GACE,CAAA,CAAAV,QAAAI,SAAAC,aAAAS,QAAAJ;GAKiDE,EAAA,KAAAF;GAAAE,EAAA,KAAAR;GAAAQ,EAAA,KAAAP;GAAAO,EAAA,KAAAZ;GAAAY,EAAA,KAAAE;EAAA,OAAA;GAAAV,UAAAQ,EAAA;GAAAP,WAAAO,EAAA;GAAAZ,SAAAY,EAAA;GAAAE,OAAAF,EAAA;EAAA;EAGjD,MAAAG,OAAaP;EAEb,IAAIR,UAAUR,eAAeQ,MAAM,GAAC;GAClC,MAAAgB,iBACEX,aAAaY,KAAAA,IAAbZ,WAEML,OAAMkB,MAAiCb;GAGlC,MAAAe,KAAAN;GAAW,IAAAO;GAAA,IAAAT,EAAA,OAAAZ,UAAAY,EAAA,OAAAI,gBAAA;IACnBK,KAAA/B,aAAaU,QAAQiB,KAAAA,GAAWD,cAAc;IAACJ,EAAA,KAAAZ;IAAAY,EAAA,KAAAI;IAAAJ,EAAA,KAAAS;GAAA,OAAAA,KAAAT,EAAA;GAAA,IAAAU;GAAA,IAAAV,EAAA,OAAAD,OAAAC,EAAA,OAAAQ,MAAAR,EAAA,QAAAS,IAAA;IADlDC,KAAA,oBAAC,MAAD;KAAK,GAAMF;KAAc,SAAA;KAAaT;KACnCU,UAAAA;IADE,CAAA;IAEET,EAAA,KAAAD;IAAAC,EAAA,KAAAQ;IAAAR,EAAA,MAAAS;IAAAT,EAAA,MAAAU;GAAA,OAAAA,KAAAV,EAAA;GAAA,OAFPU;EAEO;EAKE,MAAAF,KAAAN;EAAW,IAAAO;EAAA,IAAAT,EAAA,QAAAR,WAAAQ,EAAA,QAAAP,YAAAO,EAAA,QAAAD,OAAAC,EAAA,QAAAQ,IAAA;GAAtBC,KAAA,oBAAC,MAAD;IAAK,GAAMD;IAAuBhB;IAAcO;IAC7CN;GADE,CAAA;GAEEO,EAAA,MAAAR;GAAAQ,EAAA,MAAAP;GAAAO,EAAA,MAAAD;GAAAC,EAAA,MAAAQ;GAAAR,EAAA,MAAAS;EAAA,OAAAA,KAAAT,EAAA;EAAA,OAFPS;CAEO,CAGb;CAMAZ,QAAQe,cAHN,OAAOhB,cAAc,WACjBA,YACCA,UAAUgB,eAAehB,UAAUiB,QAAQ;CAGlD,OAAOhB;AAGT;AAEA,SAASiB,gBAAyCC,MAAS;CACzD,MAAMC,YAAYlC,YAAeiC;CACjC,MAAMnB,YAAYD,eAAeqB,SAAS;CAE1CpB,UAAUgB,cAAc,aAAaG;CACrC,OAAOnB;AAGT;AAEA,MAAMf,YAAYE,MAAMkC,QACrBC,KAAKH,SAAS;CACbG,IAAIH,QAAQD,gBAAgBC,IAAI;CAChC,OAAOG;AACT,GACA,CAAC,CAGH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createActionButton.d.ts","names":[],"sources":["../../src/utils/createActionButton.tsx"],"mappings":";;;KASK,qBAAqB,WACxB,OAAO,WACJ,kBAAkB;KAElB,uBAAuB,gCAAgC,UAAU;KAE1D,kBAAkB,SAAS,wBACpC,gBAAe,aAAa,sBAAqB;KAExC,sBAAsB,oBAAoB,UAAU;cAEnD,qBAAsB,QACjC,qBACA,iBAAiB,qBAAqB,SACtC,sBAAqB,YAAY,+BAAe,0CAAA,gBAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
|
|
1
|
+
{"version":3,"file":"createActionButton.d.ts","names":[],"sources":["../../src/utils/createActionButton.tsx"],"mappings":";;;KASK,qBAAqB,WACxB,OAAO,WACJ,kBAAkB;KAElB,uBAAuB,gCAAgC,UAAU;KAE1D,kBAAkB,SAAS,wBACpC,gBAAe,aAAa,sBAAqB;KAExC,sBAAsB,oBAAoB,UAAU;cAEnD,qBAAsB,QACjC,qBACA,iBAAiB,qBAAqB,SACtC,sBAAqB,YAAY,+BAAe,0CAAA,gBAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;oBAgCjD,cAAA,6BAAA,0BAAA,cAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useManagedRef } from "./useManagedRef.js";
|
|
2
2
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
|
+
import "@assistant-ui/tap/react-shim";
|
|
3
4
|
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
|
|
4
5
|
//#region src/utils/hooks/useOnResizeContent.ts
|
|
5
6
|
const useOnResizeContent = (callback) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOnResizeContent.js","names":["useCallbackRef","useCallback","useManagedRef","useOnResizeContent","callback","$","_c","callbackRef","t0","el","resizeObserver","ResizeObserver","mutationObserver","MutationObserver","mutations","hasRelevantMutation","some","_temp","observe","childList","subtree","attributes","characterData","disconnect","refCallback","m","type","attributeName"],"sources":["../../../src/utils/hooks/useOnResizeContent.ts"],"sourcesContent":["import { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\n\nexport const useOnResizeContent = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n\n const refCallback = useCallback(\n (el: HTMLElement) => {\n const resizeObserver = new ResizeObserver(() => {\n callbackRef();\n });\n\n const mutationObserver = new MutationObserver((mutations) => {\n // Filter out style-only attribute mutations to prevent feedback loops\n // with code paths that write styles in response to viewport changes.\n const hasRelevantMutation = mutations.some(\n (m) => m.type !== \"attributes\" || m.attributeName !== \"style\",\n );\n if (hasRelevantMutation) {\n callbackRef();\n }\n });\n\n resizeObserver.observe(el);\n mutationObserver.observe(el, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n },\n [callbackRef],\n );\n\n return useManagedRef(refCallback);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOnResizeContent.js","names":["useCallbackRef","useCallback","useManagedRef","useOnResizeContent","callback","$","_c","callbackRef","t0","el","resizeObserver","ResizeObserver","mutationObserver","MutationObserver","mutations","hasRelevantMutation","some","_temp","observe","childList","subtree","attributes","characterData","disconnect","refCallback","m","type","attributeName"],"sources":["../../../src/utils/hooks/useOnResizeContent.ts"],"sourcesContent":["import { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\n\nexport const useOnResizeContent = (callback: () => void) => {\n const callbackRef = useCallbackRef(callback);\n\n const refCallback = useCallback(\n (el: HTMLElement) => {\n const resizeObserver = new ResizeObserver(() => {\n callbackRef();\n });\n\n const mutationObserver = new MutationObserver((mutations) => {\n // Filter out style-only attribute mutations to prevent feedback loops\n // with code paths that write styles in response to viewport changes.\n const hasRelevantMutation = mutations.some(\n (m) => m.type !== \"attributes\" || m.attributeName !== \"style\",\n );\n if (hasRelevantMutation) {\n callbackRef();\n }\n });\n\n resizeObserver.observe(el);\n mutationObserver.observe(el, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n },\n [callbackRef],\n );\n\n return useManagedRef(refCallback);\n};\n"],"mappings":";;;;;AAIA,MAAaG,sBAAqBC,aAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAChC,MAAAC,cAAoBP,eAAeI,QAAQ;CAAE,IAAAI;CAAA,IAAAH,EAAA,OAAAE,aAAA;EAG3CC,MAAAC,OAAA;GACE,MAAAC,iBAAuB,IAAIC,qBAAe;IACxCJ,YAAY;GAAC,CACd;GAED,MAAAK,mBAAyB,IAAIC,kBAAiBC,cAAA;IAM5C,IAH4BA,UAASE,KACnCC,KAEEF,GACFR,YAAY;GACb,CACF;GAEDG,eAAcQ,QAAST,EAAE;GACzBG,iBAAgBM,QAAST,IAAI;IAAAU,WAChB;IAAIC,SACN;IAAIC,YACD;IAAIC,eACD;GACjB,CAAC;GAAC,aAEK;IACLZ,eAAca,WAAY;IAC1BX,iBAAgBW,WAAY;GAAC;EAC9B;EACFlB,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAED,OAEKH,cAAcsB,EAAW;AAAC;AApCD,SAAAP,MAAAQ,GAAA;CAAA,OAajBA,EAACC,SAAU,gBAAgBD,EAACE,kBAAmB;AAAO"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useManagedRef } from "./useManagedRef.js";
|
|
3
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
4
|
+
import "@assistant-ui/tap/react-shim";
|
|
4
5
|
//#region src/utils/hooks/useSizeHandle.ts
|
|
5
6
|
/**
|
|
6
7
|
* Hook that creates a ref for tracking element size via a SizeHandle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSizeHandle.js","names":["c","_c","useCallback","useManagedRef","SizeHandle","useSizeHandle","register","getHeight","$","t0","el","sizeHandle","updateHeight","height","offsetHeight","setHeight","ro","ResizeObserver","observe","disconnect","unregister","callbackRef"],"sources":["../../../src/utils/hooks/useSizeHandle.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\nimport type { SizeHandle } from \"../../context/stores/ThreadViewport\";\n\n/**\n * Hook that creates a ref for tracking element size via a SizeHandle.\n * Automatically sets up ResizeObserver and reports height changes.\n *\n * @param register - Function that returns a SizeHandle (e.g., registerContentInset)\n * @param getHeight - Optional function to compute height (defaults to el.offsetHeight)\n * @returns A ref callback to attach to the element\n */\nexport const useSizeHandle = (\n register: (() => SizeHandle) | null | undefined,\n getHeight?: (el: HTMLElement) => number,\n) => {\n const callbackRef = useCallback(\n (el: HTMLElement) => {\n if (!register) return;\n\n const sizeHandle = register();\n\n const updateHeight = () => {\n const height = getHeight ? getHeight(el) : el.offsetHeight;\n sizeHandle.setHeight(height);\n };\n\n const ro = new ResizeObserver(updateHeight);\n ro.observe(el);\n updateHeight();\n\n return () => {\n ro.disconnect();\n sizeHandle.unregister();\n };\n },\n [register, getHeight],\n );\n\n return useManagedRef(callbackRef);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSizeHandle.js","names":["c","_c","useCallback","useManagedRef","SizeHandle","useSizeHandle","register","getHeight","$","t0","el","sizeHandle","updateHeight","height","offsetHeight","setHeight","ro","ResizeObserver","observe","disconnect","unregister","callbackRef"],"sources":["../../../src/utils/hooks/useSizeHandle.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback } from \"react\";\nimport { useManagedRef } from \"./useManagedRef\";\nimport type { SizeHandle } from \"../../context/stores/ThreadViewport\";\n\n/**\n * Hook that creates a ref for tracking element size via a SizeHandle.\n * Automatically sets up ResizeObserver and reports height changes.\n *\n * @param register - Function that returns a SizeHandle (e.g., registerContentInset)\n * @param getHeight - Optional function to compute height (defaults to el.offsetHeight)\n * @returns A ref callback to attach to the element\n */\nexport const useSizeHandle = (\n register: (() => SizeHandle) | null | undefined,\n getHeight?: (el: HTMLElement) => number,\n) => {\n const callbackRef = useCallback(\n (el: HTMLElement) => {\n if (!register) return;\n\n const sizeHandle = register();\n\n const updateHeight = () => {\n const height = getHeight ? getHeight(el) : el.offsetHeight;\n sizeHandle.setHeight(height);\n };\n\n const ro = new ResizeObserver(updateHeight);\n ro.observe(el);\n updateHeight();\n\n return () => {\n ro.disconnect();\n sizeHandle.unregister();\n };\n },\n [register, getHeight],\n );\n\n return useManagedRef(callbackRef);\n};\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAaK,iBAAgBC,UAAAC,cAAA;CAAA,MAAAC,IAAAP,EAAA,CAAA;CAAA,IAAAQ;CAAA,IAAAD,EAAA,OAAAD,aAAAC,EAAA,OAAAF,UAAA;EAKzBG,MAAAC,OAAA;GACE,IAAI,CAACJ,UAAQ;GAEb,MAAAK,aAAmBL,SAAS;GAE5B,MAAAM,qBAAqB;IACnB,MAAAC,SAAeN,YAAYA,UAAUG,EAAoB,IAAdA,GAAEI;IAC7CH,WAAUI,UAAWF,MAAM;GAAC;GAG9B,MAAAG,KAAW,IAAIC,eAAeL,YAAY;GAC1CI,GAAEE,QAASR,EAAE;GACbE,aAAa;GAAC,aAEP;IACLI,GAAEG,WAAY;IACdR,WAAUS,WAAY;GAAC;EACxB;EACFZ,EAAA,KAAAD;EAAAC,EAAA,KAAAF;EAAAE,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAED,OAEKL,cAAckB,EAAW;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSmooth.d.ts","names":[],"sources":["../../../src/utils/smooth/useSmooth.ts"],"mappings":";;;;;KAkBY;;;;;;EAMV;;;;;;EAMA;;;;;EAKA;;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useSmooth.d.ts","names":[],"sources":["../../../src/utils/smooth/useSmooth.ts"],"mappings":";;;;;KAkBY;;;;;;EAMV;;;;;;EAMA;;;;;EAKA;;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;cA6GW,YACX,OAAO,oBAAoB,kBAAkB,uBAC7C,mBAAkB,kBACjB,oBAAoB,kBAAkB"}
|
|
@@ -9,8 +9,6 @@ import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
|
|
|
9
9
|
const DEFAULT_DRAIN_MS = 250;
|
|
10
10
|
const DEFAULT_MAX_CHAR_INTERVAL_MS = 5;
|
|
11
11
|
var TextStreamAnimator = class {
|
|
12
|
-
currentText;
|
|
13
|
-
setText;
|
|
14
12
|
animationFrameId = null;
|
|
15
13
|
lastUpdateTime = Date.now();
|
|
16
14
|
lastCommitTime = 0;
|
|
@@ -19,6 +17,8 @@ var TextStreamAnimator = class {
|
|
|
19
17
|
maxCharIntervalMs = DEFAULT_MAX_CHAR_INTERVAL_MS;
|
|
20
18
|
maxCharsPerFrame = Infinity;
|
|
21
19
|
minCommitMs = 0;
|
|
20
|
+
currentText;
|
|
21
|
+
setText;
|
|
22
22
|
constructor(currentText, setText) {
|
|
23
23
|
this.currentText = currentText;
|
|
24
24
|
this.setText = setText;
|