@assistant-ui/react 0.15.23 → 0.15.24

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.
Files changed (135) hide show
  1. package/README.md +44 -23
  2. package/dist/assistant-transport.js.map +1 -1
  3. package/dist/cloud-renderer/CloudRendererHost.js.map +1 -1
  4. package/dist/context/providers/MessageProvider.js.map +1 -1
  5. package/dist/context/providers/ThreadViewportProvider.js.map +1 -1
  6. package/dist/hooks/useToolCallElapsed.js.map +1 -1
  7. package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
  8. package/dist/mcp-apps/app-frame.js.map +1 -1
  9. package/dist/model-context/frame/useAssistantFrameHost.js.map +1 -1
  10. package/dist/model-context/makeAssistantVisible.js.map +1 -1
  11. package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
  12. package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
  13. package/dist/primitives/actionBar/ActionBarExportMarkdown.js.map +1 -1
  14. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
  15. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
  16. package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
  17. package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
  18. package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
  19. package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
  20. package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
  21. package/dist/primitives/actionBarMore/ActionBarMoreContent.js.map +1 -1
  22. package/dist/primitives/actionBarMore/ActionBarMoreItem.js.map +1 -1
  23. package/dist/primitives/actionBarMore/ActionBarMoreRoot.js.map +1 -1
  24. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js.map +1 -1
  25. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js.map +1 -1
  26. package/dist/primitives/actionBarMore/scope.js.map +1 -1
  27. package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
  28. package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
  29. package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
  30. package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
  31. package/dist/primitives/assistantModal/popoverRenderPrimitives.js.map +1 -1
  32. package/dist/primitives/assistantModal/scope.js.map +1 -1
  33. package/dist/primitives/attachment/AttachmentName.js.map +1 -1
  34. package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
  35. package/dist/primitives/attachment/AttachmentRoot.js.map +1 -1
  36. package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
  37. package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
  38. package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
  39. package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
  40. package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
  41. package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
  42. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
  43. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js.map +1 -1
  44. package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
  45. package/dist/primitives/composer/ComposerCancel.js.map +1 -1
  46. package/dist/primitives/composer/ComposerDictate.js.map +1 -1
  47. package/dist/primitives/composer/ComposerDictationTranscript.js.map +1 -1
  48. package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
  49. package/dist/primitives/composer/ComposerInput.js +3 -2
  50. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  51. package/dist/primitives/composer/ComposerInputPluginContext.js.map +1 -1
  52. package/dist/primitives/composer/ComposerQuote.js.map +1 -1
  53. package/dist/primitives/composer/ComposerRoot.js.map +1 -1
  54. package/dist/primitives/composer/ComposerSend.js.map +1 -1
  55. package/dist/primitives/composer/ComposerStopDictation.js.map +1 -1
  56. package/dist/primitives/composer/trigger/TriggerPopover.js.map +1 -1
  57. package/dist/primitives/composer/trigger/TriggerPopoverAction.js.map +1 -1
  58. package/dist/primitives/composer/trigger/TriggerPopoverBack.js.map +1 -1
  59. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js.map +1 -1
  60. package/dist/primitives/composer/trigger/TriggerPopoverDirective.js.map +1 -1
  61. package/dist/primitives/composer/trigger/TriggerPopoverItems.js.map +1 -1
  62. package/dist/primitives/composer/trigger/TriggerPopoverResource.js.map +1 -1
  63. package/dist/primitives/composer/trigger/TriggerPopoverRootContext.js.map +1 -1
  64. package/dist/primitives/composer/trigger/index.js.map +1 -1
  65. package/dist/primitives/composer/trigger/triggerDetectionResource.js.map +1 -1
  66. package/dist/primitives/composer/trigger/triggerKeyboardResource.js.map +1 -1
  67. package/dist/primitives/composer/trigger/triggerNavigationResource.js.map +1 -1
  68. package/dist/primitives/composer/trigger/triggerSelectionResource.js.map +1 -1
  69. package/dist/primitives/composer/useComposerInputState.js.map +1 -1
  70. package/dist/primitives/dropdownMenuRenderPrimitives.js.map +1 -1
  71. package/dist/primitives/error/ErrorMessage.js.map +1 -1
  72. package/dist/primitives/error/ErrorRoot.js.map +1 -1
  73. package/dist/primitives/message/MessageIf.js.map +1 -1
  74. package/dist/primitives/message/MessageParts.js.map +1 -1
  75. package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
  76. package/dist/primitives/message/MessagePartsGrouped.js +42 -17
  77. package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
  78. package/dist/primitives/message/MessageRoot.js.map +1 -1
  79. package/dist/primitives/messagePart/MessagePartImage.js.map +1 -1
  80. package/dist/primitives/queueItem/QueueItemRemove.js.map +1 -1
  81. package/dist/primitives/queueItem/QueueItemSteer.js.map +1 -1
  82. package/dist/primitives/queueItem/QueueItemText.js.map +1 -1
  83. package/dist/primitives/reasoning/useScrollLock.js.map +1 -1
  84. package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js.map +1 -1
  85. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -1
  86. package/dist/primitives/suggestion/SuggestionDescription.js.map +1 -1
  87. package/dist/primitives/suggestion/SuggestionTitle.js.map +1 -1
  88. package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -1
  89. package/dist/primitives/thread/ThreadIf.js.map +1 -1
  90. package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
  91. package/dist/primitives/thread/ThreadRoot.js +2 -0
  92. package/dist/primitives/thread/ThreadRoot.js.map +1 -1
  93. package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
  94. package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
  95. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  96. package/dist/primitives/thread/ThreadViewportFooter.js.map +1 -1
  97. package/dist/primitives/thread/topAnchor/useTopAnchorReserve.js.map +1 -1
  98. package/dist/primitives/threadList/ThreadListLoadMore.js.map +1 -1
  99. package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
  100. package/dist/primitives/threadList/ThreadListRoot.js.map +1 -1
  101. package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
  102. package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
  103. package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
  104. package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
  105. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
  106. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js.map +1 -1
  107. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js.map +1 -1
  108. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js.map +1 -1
  109. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js.map +1 -1
  110. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js.map +1 -1
  111. package/dist/primitives/threadListItemMore/scope.js.map +1 -1
  112. package/dist/sandbox-host/SandboxHost.js.map +1 -1
  113. package/dist/unstable/useModelContextSnapshot.js.map +1 -1
  114. package/dist/unstable/webmcp/WebMcpRegistrationResource.js.map +1 -1
  115. package/dist/unstable/webmcp/useWebMcpProvider.js.map +1 -1
  116. package/dist/utils/Primitive.js.map +1 -1
  117. package/dist/utils/createActionButton.js.map +1 -1
  118. package/dist/utils/hooks/useManagedRef.js.map +1 -1
  119. package/dist/utils/hooks/useMediaQuery.js.map +1 -1
  120. package/dist/utils/hooks/useOnResizeContent.js.map +1 -1
  121. package/dist/utils/hooks/useOnScrollToBottom.js.map +1 -1
  122. package/dist/utils/hooks/useSizeHandle.js.map +1 -1
  123. package/dist/utils/isCompositionKey.d.ts +2 -0
  124. package/dist/utils/isCompositionKey.d.ts.map +1 -0
  125. package/dist/utils/isCompositionKey.js +6 -0
  126. package/dist/utils/isCompositionKey.js.map +1 -0
  127. package/dist/utils/smooth/SmoothContext.js.map +1 -1
  128. package/package.json +11 -11
  129. package/src/primitives/composer/ComposerInput.test.tsx +33 -1
  130. package/src/primitives/composer/ComposerInput.tsx +3 -2
  131. package/src/primitives/message/MessagePartsGrouped.test.tsx +271 -1
  132. package/src/primitives/message/MessagePartsGrouped.tsx +14 -6
  133. package/src/primitives/thread/ThreadRoot.test.tsx +33 -0
  134. package/src/primitives/thread/ThreadRoot.tsx +3 -0
  135. package/src/utils/isCompositionKey.ts +5 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadViewport.js","names":["c","_c","useComposedRefs","Primitive","ComponentRef","forwardRef","ComponentPropsWithoutRef","useCallback","useLayoutEffect","useMemo","useAuiState","useManagedRef","useThreadViewportAutoScroll","ThreadPrimitiveViewportProvider","useSizeHandle","useThreadViewport","useThreadViewportStore","useTopAnchorReserve","getActiveTopAnchorAnchorId","getActiveTopAnchorTargetId","isTopAnchorTurnValid","ThreadPrimitiveViewport","Element","div","Props","autoScroll","turnAnchor","topAnchorMessageClamp","tallerThan","visibleHeight","scrollToBottomOnRunStart","scrollToBottomOnInitialize","scrollToBottomOnThreadSwitch","useViewportSizeRef","register","_temp","getHeight","_temp2","useViewportElementRef","registerViewportElement","_temp3","useTopAnchorTurn","enabled","$","threadViewportStore","t0","s","thread","activeAnchorId","t1","s_0","activeTargetId","topAnchorTurn","_temp4","t2","bb0","t3","anchorId","targetId","activeTurn","s_2","messages","topAnchorTurnIsValid","t4","t5","getState","setTopAnchorTurn","t6","t7","state","current","ThreadPrimitiveViewportScrollable","forwardedRef","children","rest","autoScrollRef","viewportSizeRef","viewportElementRef","topAnchorEnabled","ref","displayName","props","registerViewport","el","clientHeight","s_1"],"sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"radix-ui/internal\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n useCallback,\n useLayoutEffect,\n useMemo,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { useManagedRef } from \"../../utils/hooks/useManagedRef\";\nimport { useThreadViewportAutoScroll } from \"./useThreadViewportAutoScroll\";\nimport { ThreadPrimitiveViewportProvider } from \"../../context/providers/ThreadViewportProvider\";\nimport { useSizeHandle } from \"../../utils/hooks/useSizeHandle\";\nimport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"../../context/react/ThreadViewportContext\";\nimport { useTopAnchorReserve } from \"./topAnchor/useTopAnchorReserve\";\nimport {\n getActiveTopAnchorAnchorId,\n getActiveTopAnchorTargetId,\n isTopAnchorTurnValid,\n} from \"./topAnchor/topAnchorTurn\";\n\nexport namespace ThreadPrimitiveViewport {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {\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 * Controls scroll anchoring behavior for new messages.\n * - \"bottom\" (default): Messages anchor at the bottom, classic chat behavior.\n * - \"top\": New user messages anchor at the top of the viewport for a focused reading experience.\n */\n turnAnchor?: \"top\" | \"bottom\" | undefined;\n\n /**\n * Clamps tall user messages so the assistant response stays in view.\n *\n * @default { tallerThan: \"10em\", visibleHeight: \"6em\" }\n */\n topAnchorMessageClamp?: {\n /**\n * Clamp messages taller than this. Supports `px`, `em`, and `rem`.\n *\n * @default \"10em\"\n */\n tallerThan?: string;\n /**\n * Visible portion of clamped messages. Supports `px`, `em`, and `rem`.\n *\n * @default \"6em\"\n */\n visibleHeight?: string;\n };\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 thread history is first loaded.\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\nconst useViewportSizeRef = () => {\n const register = useThreadViewport((s) => s.registerViewport);\n const getHeight = useCallback((el: HTMLElement) => el.clientHeight, []);\n return useSizeHandle(register, getHeight);\n};\n\nconst useViewportElementRef = () => {\n const registerViewportElement = useThreadViewport(\n (s) => s.registerViewportElement,\n );\n\n return useManagedRef(registerViewportElement);\n};\n\nconst useTopAnchorTurn = (enabled: boolean) => {\n const threadViewportStore = useThreadViewportStore();\n const activeAnchorId = useAuiState((s) => {\n if (!enabled) return undefined;\n return getActiveTopAnchorAnchorId(s.thread);\n });\n const activeTargetId = useAuiState((s) => {\n if (!enabled) return undefined;\n return getActiveTopAnchorTargetId(s.thread);\n });\n const topAnchorTurn = useThreadViewport((s) => s.topAnchorTurn);\n const activeTurn = useMemo(() => {\n if (!activeAnchorId || !activeTargetId) return null;\n return { anchorId: activeAnchorId, targetId: activeTargetId };\n }, [activeAnchorId, activeTargetId]);\n\n const topAnchorTurnIsValid = useAuiState(\n (s) =>\n enabled &&\n !!topAnchorTurn &&\n isTopAnchorTurnValid(topAnchorTurn, s.thread.messages),\n );\n\n useLayoutEffect(() => {\n if (!topAnchorTurn || topAnchorTurnIsValid) return;\n\n threadViewportStore.getState().setTopAnchorTurn(null);\n }, [threadViewportStore, topAnchorTurn, topAnchorTurnIsValid]);\n\n useLayoutEffect(() => {\n if (!activeTurn) return;\n\n const state = threadViewportStore.getState();\n const current = state.topAnchorTurn;\n if (\n current?.anchorId === activeTurn.anchorId &&\n current.targetId === activeTurn.targetId\n ) {\n return;\n }\n\n state.setTopAnchorTurn(activeTurn);\n }, [activeTurn, threadViewportStore]);\n};\n\nconst ThreadPrimitiveViewportScrollable = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>(\n (\n {\n autoScroll,\n scrollToBottomOnRunStart,\n scrollToBottomOnInitialize,\n scrollToBottomOnThreadSwitch,\n children,\n ...rest\n },\n forwardedRef,\n ) => {\n const autoScrollRef = useThreadViewportAutoScroll<HTMLDivElement>({\n autoScroll,\n scrollToBottomOnRunStart,\n scrollToBottomOnInitialize,\n scrollToBottomOnThreadSwitch,\n });\n const viewportSizeRef = useViewportSizeRef();\n const viewportElementRef = useViewportElementRef();\n const threadViewportStore = useThreadViewportStore();\n const turnAnchor = threadViewportStore.getState().turnAnchor;\n const topAnchorEnabled = turnAnchor === \"top\";\n useTopAnchorTurn(topAnchorEnabled);\n useTopAnchorReserve(topAnchorEnabled);\n const ref = useComposedRefs(\n forwardedRef,\n autoScrollRef,\n viewportSizeRef,\n viewportElementRef,\n );\n\n return (\n <Primitive.div {...rest} ref={ref}>\n {children}\n </Primitive.div>\n );\n },\n);\n\nThreadPrimitiveViewportScrollable.displayName =\n \"ThreadPrimitive.ViewportScrollable\";\n\n/**\n * A scrollable viewport container for thread messages.\n *\n * This component provides a scrollable area for displaying thread messages with\n * automatic scrolling capabilities. It manages the viewport state and provides\n * context for child components to access viewport-related functionality.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Viewport turnAnchor=\"top\">\n * <ThreadPrimitive.Messages>\n * {() => <MyMessage />}\n * </ThreadPrimitive.Messages>\n * </ThreadPrimitive.Viewport>\n * ```\n */\nexport const ThreadPrimitiveViewport = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>(({ turnAnchor, topAnchorMessageClamp, ...props }, ref) => {\n return (\n <ThreadPrimitiveViewportProvider\n options={{ turnAnchor, topAnchorMessageClamp }}\n >\n <ThreadPrimitiveViewportScrollable {...props} ref={ref} />\n </ThreadPrimitiveViewportProvider>\n );\n});\n\nThreadPrimitiveViewport.displayName = \"ThreadPrimitive.Viewport\";\n"],"mappings":";;;;;;;;;;;;;;;AAyFA,MAAMiC,2BAAqB;CACzB,MAAAC,WAAiBnB,kBAAkBoB,KAAyB;CACY,OACjErB,cAAcoB,UAAUE,MAAS;AAAC;AAG3C,MAAME,8BAAwB;CAC5B,MAAAC,0BAAgCxB,kBAC9ByB,MACF;CAAE,OAEK7B,cAAc4B,uBAAuB;AAAC;AAG/C,MAAME,oBAAmBC,YAAA;CAAA,MAAAC,IAAA1C,EAAA,EAAA;CACvB,MAAA2C,sBAA4B5B,uBAAuB;CAAE,IAAA6B;CAAA,IAAAF,EAAA,OAAAD,SAAA;EAClBG,MAAAC,MAAA;GACjC,IAAI,CAACJ,SAAO;GAAmB,OACxBxB,2BAA2B4B,EAACC,MAAO;EAAC;EAC5CJ,EAAA,KAAAD;EAAAC,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAHD,MAAAK,iBAAuBtC,YAAYmC,EAGlC;CAAE,IAAAI;CAAA,IAAAN,EAAA,OAAAD,SAAA;EACgCO,MAAAC,QAAA;GACjC,IAAI,CAACR,SAAO;GAAmB,OACxBvB,2BAA2B2B,IAACC,MAAO;EAAC;EAC5CJ,EAAA,KAAAD;EAAAC,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAHD,MAAAQ,iBAAuBzC,YAAYuC,EAGlC;CACD,MAAAG,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AAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,OAAAhB,yBAAAgB,EAAA,OAAAjB,YAAA;EAGnCuB,KAAA;GAAAvB;GAAAC;EAAoC;EAACgB,EAAA,KAAAhB;EAAAgB,EAAA,KAAAjB;EAAAiB,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAsC,SAAAtC,EAAA,OAAAoC,KAAA;EAE9CzB,KAAA,oBAAC,mCAAD;GAAkC,GAAK2B;GAAYF;EAAG,CAAA;EAAIpC,EAAA,KAAAsC;EAAAtC,EAAA,KAAAoC;EAAApC,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,QAAAM,MAAAN,EAAA,QAAAW,IAAA;EAH5DE,KAAA,oBAAC,iCAAD;GACW,SAAAP;GAETK,UAAAA;EAH8B,CAAA;EAIEX,EAAA,MAAAM;EAAAN,EAAA,MAAAW;EAAAX,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAJlCa;AAIkC,CAErC;AAEDnC,wBAAwB2D,cAAc;AAtIX,SAAA7C,MAAAW,GAAA;CAAA,OACiBA,EAACoC;AAAiB;AADnC,SAAA7C,OAAA8C,IAAA;CAAA,OAE0BA,GAAEC;AAAa;AAItC,SAAA5C,OAAAM,GAAA;CAAA,OAEnBA,EAACP;AAAwB;AAMX,SAAAc,OAAAgC,KAAA;CAAA,OAUwBvC,IAACM;AAAc"}
1
+ {"version":3,"file":"ThreadViewport.js","names":["c","_c","useComposedRefs","Primitive","ComponentRef","forwardRef","ComponentPropsWithoutRef","useCallback","useLayoutEffect","useMemo","useAuiState","useManagedRef","useThreadViewportAutoScroll","ThreadPrimitiveViewportProvider","useSizeHandle","useThreadViewport","useThreadViewportStore","useTopAnchorReserve","getActiveTopAnchorAnchorId","getActiveTopAnchorTargetId","isTopAnchorTurnValid","ThreadPrimitiveViewport","Element","div","Props","autoScroll","turnAnchor","topAnchorMessageClamp","tallerThan","visibleHeight","scrollToBottomOnRunStart","scrollToBottomOnInitialize","scrollToBottomOnThreadSwitch","useViewportSizeRef","register","_temp","getHeight","_temp2","useViewportElementRef","registerViewportElement","_temp3","useTopAnchorTurn","enabled","$","threadViewportStore","t0","s","thread","activeAnchorId","t1","s_0","activeTargetId","topAnchorTurn","_temp4","t2","bb0","t3","anchorId","targetId","activeTurn","s_2","messages","topAnchorTurnIsValid","t4","t5","getState","setTopAnchorTurn","t6","t7","state","current","ThreadPrimitiveViewportScrollable","forwardedRef","children","rest","autoScrollRef","viewportSizeRef","viewportElementRef","topAnchorEnabled","ref","displayName","props","registerViewport","el","clientHeight","s_1","getHeight","_c","Primitive"],"sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"radix-ui/internal\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n useCallback,\n useLayoutEffect,\n useMemo,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { useManagedRef } from \"../../utils/hooks/useManagedRef\";\nimport { useThreadViewportAutoScroll } from \"./useThreadViewportAutoScroll\";\nimport { ThreadPrimitiveViewportProvider } from \"../../context/providers/ThreadViewportProvider\";\nimport { useSizeHandle } from \"../../utils/hooks/useSizeHandle\";\nimport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"../../context/react/ThreadViewportContext\";\nimport { useTopAnchorReserve } from \"./topAnchor/useTopAnchorReserve\";\nimport {\n getActiveTopAnchorAnchorId,\n getActiveTopAnchorTargetId,\n isTopAnchorTurnValid,\n} from \"./topAnchor/topAnchorTurn\";\n\nexport namespace ThreadPrimitiveViewport {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {\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 * Controls scroll anchoring behavior for new messages.\n * - \"bottom\" (default): Messages anchor at the bottom, classic chat behavior.\n * - \"top\": New user messages anchor at the top of the viewport for a focused reading experience.\n */\n turnAnchor?: \"top\" | \"bottom\" | undefined;\n\n /**\n * Clamps tall user messages so the assistant response stays in view.\n *\n * @default { tallerThan: \"10em\", visibleHeight: \"6em\" }\n */\n topAnchorMessageClamp?: {\n /**\n * Clamp messages taller than this. Supports `px`, `em`, and `rem`.\n *\n * @default \"10em\"\n */\n tallerThan?: string;\n /**\n * Visible portion of clamped messages. Supports `px`, `em`, and `rem`.\n *\n * @default \"6em\"\n */\n visibleHeight?: string;\n };\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 thread history is first loaded.\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\nconst useViewportSizeRef = () => {\n const register = useThreadViewport((s) => s.registerViewport);\n const getHeight = useCallback((el: HTMLElement) => el.clientHeight, []);\n return useSizeHandle(register, getHeight);\n};\n\nconst useViewportElementRef = () => {\n const registerViewportElement = useThreadViewport(\n (s) => s.registerViewportElement,\n );\n\n return useManagedRef(registerViewportElement);\n};\n\nconst useTopAnchorTurn = (enabled: boolean) => {\n const threadViewportStore = useThreadViewportStore();\n const activeAnchorId = useAuiState((s) => {\n if (!enabled) return undefined;\n return getActiveTopAnchorAnchorId(s.thread);\n });\n const activeTargetId = useAuiState((s) => {\n if (!enabled) return undefined;\n return getActiveTopAnchorTargetId(s.thread);\n });\n const topAnchorTurn = useThreadViewport((s) => s.topAnchorTurn);\n const activeTurn = useMemo(() => {\n if (!activeAnchorId || !activeTargetId) return null;\n return { anchorId: activeAnchorId, targetId: activeTargetId };\n }, [activeAnchorId, activeTargetId]);\n\n const topAnchorTurnIsValid = useAuiState(\n (s) =>\n enabled &&\n !!topAnchorTurn &&\n isTopAnchorTurnValid(topAnchorTurn, s.thread.messages),\n );\n\n useLayoutEffect(() => {\n if (!topAnchorTurn || topAnchorTurnIsValid) return;\n\n threadViewportStore.getState().setTopAnchorTurn(null);\n }, [threadViewportStore, topAnchorTurn, topAnchorTurnIsValid]);\n\n useLayoutEffect(() => {\n if (!activeTurn) return;\n\n const state = threadViewportStore.getState();\n const current = state.topAnchorTurn;\n if (\n current?.anchorId === activeTurn.anchorId &&\n current.targetId === activeTurn.targetId\n ) {\n return;\n }\n\n state.setTopAnchorTurn(activeTurn);\n }, [activeTurn, threadViewportStore]);\n};\n\nconst ThreadPrimitiveViewportScrollable = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>(\n (\n {\n autoScroll,\n scrollToBottomOnRunStart,\n scrollToBottomOnInitialize,\n scrollToBottomOnThreadSwitch,\n children,\n ...rest\n },\n forwardedRef,\n ) => {\n const autoScrollRef = useThreadViewportAutoScroll<HTMLDivElement>({\n autoScroll,\n scrollToBottomOnRunStart,\n scrollToBottomOnInitialize,\n scrollToBottomOnThreadSwitch,\n });\n const viewportSizeRef = useViewportSizeRef();\n const viewportElementRef = useViewportElementRef();\n const threadViewportStore = useThreadViewportStore();\n const turnAnchor = threadViewportStore.getState().turnAnchor;\n const topAnchorEnabled = turnAnchor === \"top\";\n useTopAnchorTurn(topAnchorEnabled);\n useTopAnchorReserve(topAnchorEnabled);\n const ref = useComposedRefs(\n forwardedRef,\n autoScrollRef,\n viewportSizeRef,\n viewportElementRef,\n );\n\n return (\n <Primitive.div {...rest} ref={ref}>\n {children}\n </Primitive.div>\n );\n },\n);\n\nThreadPrimitiveViewportScrollable.displayName =\n \"ThreadPrimitive.ViewportScrollable\";\n\n/**\n * A scrollable viewport container for thread messages.\n *\n * This component provides a scrollable area for displaying thread messages with\n * automatic scrolling capabilities. It manages the viewport state and provides\n * context for child components to access viewport-related functionality.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Viewport turnAnchor=\"top\">\n * <ThreadPrimitive.Messages>\n * {() => <MyMessage />}\n * </ThreadPrimitive.Messages>\n * </ThreadPrimitive.Viewport>\n * ```\n */\nexport const ThreadPrimitiveViewport = forwardRef<\n ThreadPrimitiveViewport.Element,\n ThreadPrimitiveViewport.Props\n>(({ turnAnchor, topAnchorMessageClamp, ...props }, ref) => {\n return (\n <ThreadPrimitiveViewportProvider\n options={{ turnAnchor, topAnchorMessageClamp }}\n >\n <ThreadPrimitiveViewportScrollable {...props} ref={ref} />\n </ThreadPrimitiveViewportProvider>\n );\n});\n\nThreadPrimitiveViewport.displayName = \"ThreadPrimitive.Viewport\";\n"],"mappings":";;;;;;;;;;;;;;;AAyFA,MAAMiC,2BAAqB;CACzB,MAAAC,WAAiBnB,kBAAkBoB,KAAyB;CACY,OACjErB,cAAcoB,UAAUE,MAAS;AAAC;AAG3C,MAAME,8BAAwB;CAC5B,MAAAC,0BAAgCxB,kBAC9ByB,MACF;CAAE,OAEK7B,cAAc4B,uBAAuB;AAAC;AAG/C,MAAME,oBAAmBC,YAAA;CAAA,MAAAC,IAAA1C,EAAA,EAAA;CACvB,MAAA2C,sBAA4B5B,uBAAuB;CAAE,IAAA6B;CAAA,IAAAF,EAAA,OAAAD,SAAA;EAClBG,MAAAC,MAAA;GACjC,IAAI,CAACJ,SAAO;GAAmB,OACxBxB,2BAA2B4B,EAACC,MAAO;EAAC;EAC5CJ,EAAA,KAAAD;EAAAC,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAHD,MAAAK,iBAAuBtC,YAAYmC,EAGlC;CAAE,IAAAI;CAAA,IAAAN,EAAA,OAAAD,SAAA;EACgCO,MAAAC,QAAA;GACjC,IAAI,CAACR,SAAO;GAAmB,OACxBvB,2BAA2B2B,IAACC,MAAO;EAAC;EAC5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AAA,KAAAhB;EAAAgB,EAAA,KAAAjB;CAAA,OAAA;EAAAuD,QAAAtC,EAAA;EAAAhB,wBAAAgB,EAAA;EAAAjB,aAAAiB,EAAA;CAAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,OAAAhB,yBAAAgB,EAAA,OAAAjB,YAAA;EAGnCuB,KAAA;GAAAvB;GAAAC;EAAoC;EAACgB,EAAA,KAAAhB;EAAAgB,EAAA,KAAAjB;EAAAiB,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAsC,SAAAtC,EAAA,OAAAoC,KAAA;EAE9CzB,KAAA,oBAAC,mCAAD;GAAkC,GAAK2B;GAAYF;EAAG,CAAA;EAAIpC,EAAA,KAAAsC;EAAAtC,EAAA,KAAAoC;EAAApC,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,QAAAM,MAAAN,EAAA,QAAAW,IAAA;EAH5DE,KAAA,oBAAC,iCAAD;GACW,SAAAP;GAETK,UAAAA;EAH8B,CAAA;EAIEX,EAAA,MAAAM;EAAAN,EAAA,MAAAW;EAAAX,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAJlCa;AAIkC,CAErC;AAEDnC,wBAAwB2D,cAAc;AAtIX,SAAA7C,MAAAW,GAAA;CAAA,OACiBA,EAACoC;AAAiB;AADnC,SAAA7C,OAAA8C,IAAA;CAAA,OAE0BA,GAAEC;AAAa;AAItC,SAAA5C,OAAAM,GAAA;CAAA,OAEnBA,EAACP;AAAwB;AAMX,SAAAc,OAAAgC,KAAA;CAAA,OAUwBvC,IAACM;AAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadViewportFooter.js","names":["c","_c","useComposedRefs","Primitive","ComponentRef","forwardRef","ComponentPropsWithoutRef","useCallback","useSizeHandle","useThreadViewport","ThreadPrimitiveViewportFooter","Element","div","Props","props","forwardedRef","$","register","_temp","getHeight","_temp2","resizeRef","ref","t0","displayName","s","registerContentInset","el","marginTop","parseFloat","getComputedStyle","offsetHeight"],"sources":["../../../src/primitives/thread/ThreadViewportFooter.tsx"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"radix-ui/internal\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n useCallback,\n} from \"react\";\nimport { useSizeHandle } from \"../../utils/hooks/useSizeHandle\";\nimport { useThreadViewport } from \"../../context/react/ThreadViewportContext\";\n\nexport namespace ThreadPrimitiveViewportFooter {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * A footer container that measures its height for scroll calculations.\n *\n * This component measures its height and provides it to the viewport context\n * so the auto-scroll system can account for any sticky footer overlapping the\n * message list.\n *\n * Multiple ViewportFooter components can be used - their heights are summed.\n *\n * Typically used with `className=\"sticky bottom-0\"` to keep the footer\n * visible at the bottom of the viewport while scrolling.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Viewport>\n * <ThreadPrimitive.Messages>\n * {() => <MyMessage />}\n * </ThreadPrimitive.Messages>\n * <ThreadPrimitive.ViewportFooter className=\"sticky bottom-0\">\n * <Composer />\n * </ThreadPrimitive.ViewportFooter>\n * </ThreadPrimitive.Viewport>\n * ```\n */\nexport const ThreadPrimitiveViewportFooter = forwardRef<\n ThreadPrimitiveViewportFooter.Element,\n ThreadPrimitiveViewportFooter.Props\n>((props, forwardedRef) => {\n const register = useThreadViewport((s) => s.registerContentInset);\n const getHeight = useCallback((el: HTMLElement) => {\n const marginTop = parseFloat(getComputedStyle(el).marginTop) || 0;\n return el.offsetHeight + marginTop;\n }, []);\n\n const resizeRef = useSizeHandle(register, getHeight);\n\n const ref = useComposedRefs(forwardedRef, resizeRef);\n\n return <Primitive.div {...props} ref={ref} />;\n});\n\nThreadPrimitiveViewportFooter.displayName = \"ThreadPrimitive.ViewportFooter\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaU,gCAAgCL,YAG3CS,OAAAC,iBAAA;CAAA,MAAAC,IAAAf,EAAA,CAAA;CACA,MAAAgB,WAAiBR,kBAAkBS,KAA6B;CAMhE,MAAAG,YAAkBb,cAAcS,UAAUE,MAAS;CAEnD,MAAAG,MAAYpB,gBAAgBa,cAAcM,SAAS;CAAE,IAAAE;CAAA,IAAAP,EAAA,OAAAF,SAAAE,EAAA,OAAAM,KAAA;EAE9CC,KAAA,oBAAA,YAAA,KAAA;GAAA,GAAmBT;GAAYQ;EAAG,CAAA;EAAIN,EAAA,KAAAF;EAAAE,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAAtCO;AAAsC,CAC9C;AAEDb,8BAA8Bc,cAAc;AAd1C,SAAAN,MAAAO,GAAA;CAAA,OAC0CA,EAACC;AAAqB;AADhE,SAAAN,OAAAO,IAAA;CAGE,MAAAC,YAAkBC,WAAWC,iBAAiBH,EAAE,CAAC,CAAAC,SAAe,KAA9C;CAAgD,OAC3DD,GAAEI,eAAgBH;AAAS"}
1
+ {"version":3,"file":"ThreadViewportFooter.js","names":["c","_c","useComposedRefs","Primitive","ComponentRef","forwardRef","ComponentPropsWithoutRef","useCallback","useSizeHandle","useThreadViewport","ThreadPrimitiveViewportFooter","Element","div","Props","props","forwardedRef","$","register","_temp","getHeight","_temp2","resizeRef","ref","t0","displayName","s","registerContentInset","el","marginTop","parseFloat","getComputedStyle","offsetHeight","_c","getHeight","Primitive"],"sources":["../../../src/primitives/thread/ThreadViewportFooter.tsx"],"sourcesContent":["\"use client\";\n\nimport { useComposedRefs } from \"radix-ui/internal\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport {\n type ComponentRef,\n forwardRef,\n type ComponentPropsWithoutRef,\n useCallback,\n} from \"react\";\nimport { useSizeHandle } from \"../../utils/hooks/useSizeHandle\";\nimport { useThreadViewport } from \"../../context/react/ThreadViewportContext\";\n\nexport namespace ThreadPrimitiveViewportFooter {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * A footer container that measures its height for scroll calculations.\n *\n * This component measures its height and provides it to the viewport context\n * so the auto-scroll system can account for any sticky footer overlapping the\n * message list.\n *\n * Multiple ViewportFooter components can be used - their heights are summed.\n *\n * Typically used with `className=\"sticky bottom-0\"` to keep the footer\n * visible at the bottom of the viewport while scrolling.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Viewport>\n * <ThreadPrimitive.Messages>\n * {() => <MyMessage />}\n * </ThreadPrimitive.Messages>\n * <ThreadPrimitive.ViewportFooter className=\"sticky bottom-0\">\n * <Composer />\n * </ThreadPrimitive.ViewportFooter>\n * </ThreadPrimitive.Viewport>\n * ```\n */\nexport const ThreadPrimitiveViewportFooter = forwardRef<\n ThreadPrimitiveViewportFooter.Element,\n ThreadPrimitiveViewportFooter.Props\n>((props, forwardedRef) => {\n const register = useThreadViewport((s) => s.registerContentInset);\n const getHeight = useCallback((el: HTMLElement) => {\n const marginTop = parseFloat(getComputedStyle(el).marginTop) || 0;\n return el.offsetHeight + marginTop;\n }, []);\n\n const resizeRef = useSizeHandle(register, getHeight);\n\n const ref = useComposedRefs(forwardedRef, resizeRef);\n\n return <Primitive.div {...props} ref={ref} />;\n});\n\nThreadPrimitiveViewportFooter.displayName = \"ThreadPrimitive.ViewportFooter\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaU,gCAAgCL,YAG3CS,OAAAC,iBAAA;CAAA,MAAAC,IAAAf,EAAA,CAAA;CACA,MAAAgB,WAAiBR,kBAAkBS,KAA6B;CAMhE,MAAAG,YAAkBb,cAAcS,UAAUE,MAAS;CAEnD,MAAAG,MAAYpB,gBAAgBa,cAAcM,SAAS;CAAE,IAAAE;CAAA,IAAAP,EAAA,OAAAF,SAAAE,EAAA,OAAAM,KAAA;EAE9CC,KAAA,oBAAAW,YAAA,KAAA;GAAA,GAAmBpB;GAAYQ;EAAG,CAAA;EAAIN,EAAA,KAAAF;EAAAE,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAAtCO;AAAsC,CAC9C;AAEDb,8BAA8Bc,cAAc;AAd1C,SAAAN,MAAAO,GAAA;CAAA,OAC0CA,EAACC;AAAqB;AADhE,SAAAN,OAAAO,IAAA;CAGE,MAAAC,YAAkBC,WAAWC,iBAAiBH,EAAE,CAAC,CAAAC,SAAe,KAA9C;CAAgD,OAC3DD,GAAEI,eAAgBH;AAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTopAnchorReserve.js","names":["c","_c","useLayoutEffect","useThreadViewportStore","mountTopAnchorReserve","useTopAnchorReserve","enabled","$","threadViewportStore","t0","t1"],"sources":["../../../../src/primitives/thread/topAnchor/useTopAnchorReserve.ts"],"sourcesContent":["\"use client\";\n\nimport { useLayoutEffect } from \"react\";\nimport { useThreadViewportStore } from \"../../../context/react/ThreadViewportContext\";\nimport { mountTopAnchorReserve } from \"./mountTopAnchorReserve\";\n\n/**\n * Mounts the top-turn-anchor reserve element against the active\n * `ThreadViewport` store. Call this from inside the scrollable viewport so\n * the reserve `<div>` is appended next to the streaming assistant message.\n */\nexport const useTopAnchorReserve = (enabled: boolean) => {\n const threadViewportStore = useThreadViewportStore();\n\n useLayoutEffect(() => {\n if (!enabled) return;\n return mountTopAnchorReserve(threadViewportStore);\n }, [enabled, threadViewportStore]);\n};\n"],"mappings":";;;;;;;;;;;AAWA,MAAaK,uBAAsBC,YAAA;CAAA,MAAAC,IAAAN,EAAA,CAAA;CACjC,MAAAO,sBAA4BL,uBAAuB;CAAE,IAAAM;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,WAAAC,EAAA,OAAAC,qBAAA;EAErCC,WAAA;GACd,IAAI,CAACH,SAAO;GAAS,OACdF,sBAAsBI,mBAAmB;EAAC;EAChDE,KAAA,CAACJ,SAASE,mBAAmB;EAACD,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAD,KAAAF,EAAA;EAAAG,KAAAH,EAAA;CAAA;CAHjCL,gBAAgBO,IAGbC,EAA8B;AAAC"}
1
+ {"version":3,"file":"useTopAnchorReserve.js","names":["c","_c","useLayoutEffect","useThreadViewportStore","mountTopAnchorReserve","useTopAnchorReserve","enabled","$","threadViewportStore","t0","t1","_c"],"sources":["../../../../src/primitives/thread/topAnchor/useTopAnchorReserve.ts"],"sourcesContent":["\"use client\";\n\nimport { useLayoutEffect } from \"react\";\nimport { useThreadViewportStore } from \"../../../context/react/ThreadViewportContext\";\nimport { mountTopAnchorReserve } from \"./mountTopAnchorReserve\";\n\n/**\n * Mounts the top-turn-anchor reserve element against the active\n * `ThreadViewport` store. Call this from inside the scrollable viewport so\n * the reserve `<div>` is appended next to the streaming assistant message.\n */\nexport const useTopAnchorReserve = (enabled: boolean) => {\n const threadViewportStore = useThreadViewportStore();\n\n useLayoutEffect(() => {\n if (!enabled) return;\n return mountTopAnchorReserve(threadViewportStore);\n }, [enabled, threadViewportStore]);\n};\n"],"mappings":";;;;;;;;;;;AAWA,MAAaK,uBAAsBC,YAAA;CAAA,MAAAC,IAAAN,EAAA,CAAA;CACjC,MAAAO,sBAA4BL,uBAAuB;CAAE,IAAAM;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,WAAAC,EAAA,OAAAC,qBAAA;EAErCC,WAAA;GACd,IAAI,CAACH,SAAO;GAAS,OACdF,sBAAsBI,mBAAmB;EAAC;EAChDE,KAAA,CAACJ,SAASE,mBAAmB;EAACD,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAD,KAAAF,EAAA;EAAAG,KAAAH,EAAA;CAAA;CAHjCL,gBAAgBO,IAGbC,EAA8B;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadListLoadMore.js","names":["ActionButtonElement","ActionButtonProps","createActionButton","useThreadListLoadMore","useThreadListLoadMoreBehavior","loadMore","disabled","ThreadListPrimitiveLoadMore","Element","Props"],"sources":["../../../src/primitives/threadList/ThreadListLoadMore.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListLoadMore as useThreadListLoadMoreBehavior } from \"@assistant-ui/core/react\";\n\nconst useThreadListLoadMore = () => {\n const { loadMore, disabled } = useThreadListLoadMoreBehavior();\n if (disabled) return null;\n return loadMore;\n};\n\nexport namespace ThreadListPrimitiveLoadMore {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListLoadMore>;\n}\n\nexport const ThreadListPrimitiveLoadMore = createActionButton(\n \"ThreadListPrimitive.LoadMore\",\n useThreadListLoadMore,\n);\n"],"mappings":";;;;AASA,MAAMG,gCAAwB;CAC5B,MAAA,EAAAE,UAAAC,aAA+BF,sBAA8B;CAC7D,IAAIE,UAAQ,OAAS;CAAK,OACnBD;AAAQ;AAQjB,MAAaE,8BAA8BL,mBACzC,gCACAC,uBACF"}
1
+ {"version":3,"file":"ThreadListLoadMore.js","names":["ActionButtonElement","ActionButtonProps","createActionButton","useThreadListLoadMore","useThreadListLoadMoreBehavior","loadMore","disabled","ThreadListPrimitiveLoadMore","Element","Props","useThreadListLoadMore","useThreadListLoadMoreBehavior"],"sources":["../../../src/primitives/threadList/ThreadListLoadMore.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListLoadMore as useThreadListLoadMoreBehavior } from \"@assistant-ui/core/react\";\n\nconst useThreadListLoadMore = () => {\n const { loadMore, disabled } = useThreadListLoadMoreBehavior();\n if (disabled) return null;\n return loadMore;\n};\n\nexport namespace ThreadListPrimitiveLoadMore {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListLoadMore>;\n}\n\nexport const ThreadListPrimitiveLoadMore = createActionButton(\n \"ThreadListPrimitive.LoadMore\",\n useThreadListLoadMore,\n);\n"],"mappings":";;;;AASA,MAAMG,gCAAwB;CAC5B,MAAA,EAAAE,UAAAC,aAA+BF,sBAA8B;CAC7D,IAAIE,UAAQ,OAAS;CAAK,OACnBD;AAAQ;AAQjB,MAAaE,8BAA8BL,mBACzC,gCACAC,uBACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadListNew.js","names":["c","_c","ActionButtonElement","ActionButtonProps","forwardRef","Primitive","composeEventHandlers","useAuiState","useThreadListNew","useThreadListNewBehavior","ThreadListPrimitiveNew","Element","Props","t0","forwardedRef","$","disabled","onClick","props","isMain","_temp","switchToNewThread","t1","t2","t3","displayName","s","threads","newThreadId","mainThreadId"],"sources":["../../../src/primitives/threadList/ThreadListNew.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n ActionButtonElement,\n ActionButtonProps,\n} from \"../../utils/createActionButton\";\nimport { forwardRef } from \"react\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport { composeEventHandlers } from \"radix-ui/internal\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { useThreadListNew as useThreadListNewBehavior } from \"@assistant-ui/core/react\";\n\nexport namespace ThreadListPrimitiveNew {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<() => void>;\n}\n\nexport const ThreadListPrimitiveNew = forwardRef<\n ThreadListPrimitiveNew.Element,\n ThreadListPrimitiveNew.Props\n>(({ onClick, disabled, ...props }, forwardedRef) => {\n const isMain = useAuiState(\n (s) => s.threads.newThreadId === s.threads.mainThreadId,\n );\n\n const { switchToNewThread } = useThreadListNewBehavior();\n\n return (\n <Primitive.button\n type=\"button\"\n {...(isMain ? { \"data-active\": \"true\", \"aria-current\": \"true\" } : null)}\n {...props}\n ref={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AC,EAAA,MAAAG;EAAAH,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAPFS;AAOE,CAEL;AAEDd,uBAAuBe,cAAc;AAnBnC,SAAAL,MAAAM,GAAA;CAAA,OAESA,EAACC,QAAQC,gBAAiBF,EAACC,QAAQE;AAAa"}
1
+ {"version":3,"file":"ThreadListNew.js","names":["c","_c","ActionButtonElement","ActionButtonProps","forwardRef","Primitive","composeEventHandlers","useAuiState","useThreadListNew","useThreadListNewBehavior","ThreadListPrimitiveNew","Element","Props","t0","forwardedRef","$","disabled","onClick","props","isMain","_temp","switchToNewThread","t1","t2","t3","displayName","s","threads","newThreadId","mainThreadId","_c","useThreadListNewBehavior","Primitive"],"sources":["../../../src/primitives/threadList/ThreadListNew.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n ActionButtonElement,\n ActionButtonProps,\n} from \"../../utils/createActionButton\";\nimport { forwardRef } from \"react\";\nimport { Primitive } from \"../../utils/Primitive\";\nimport { composeEventHandlers } from \"radix-ui/internal\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { useThreadListNew as useThreadListNewBehavior } from \"@assistant-ui/core/react\";\n\nexport namespace ThreadListPrimitiveNew {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<() => void>;\n}\n\nexport const ThreadListPrimitiveNew = forwardRef<\n ThreadListPrimitiveNew.Element,\n ThreadListPrimitiveNew.Props\n>(({ onClick, disabled, ...props }, forwardedRef) => {\n const isMain = useAuiState(\n (s) => s.threads.newThreadId === s.threads.mainThreadId,\n );\n\n const { switchToNewThread } = useThreadListNewBehavior();\n\n return (\n <Primitive.button\n type=\"button\"\n {...(isMain ? { \"data-active\": \"true\", \"aria-current\": \"true\" } : null)}\n {...props}\n ref={forwardedRef}\n disabled={disabled}\n onClick={composeEventHandlers(onClick, switchToNewThread)}\n />\n );\n});\n\nThreadListPrimitiveNew.displayName = \"ThreadListPrimitive.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A;CAAA,OAPFS;AAOE,CAEL;AAEDd,uBAAuBe,cAAc;AAnBnC,SAAAL,MAAAM,GAAA;CAAA,OAESA,EAACC,QAAQC,gBAAiBF,EAACC,QAAQE;AAAa"}
@@ -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;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
+ {"version":3,"file":"ThreadListRoot.js","names":["c","_c","Primitive","ComponentPropsWithoutRef","ComponentRef","forwardRef","ThreadListCollection","PrimitiveDivProps","div","ThreadListPrimitiveRoot","Element","Props","props","ref","$","t0","undefined","displayName","_c"],"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":"ThreadListItemArchive.js","names":["ActionButtonElement","ActionButtonProps","createActionButton","useThreadListItemArchive","useThreadListItemArchiveBehavior","archive","ThreadListItemPrimitiveArchive","Element","Props"],"sources":["../../../src/primitives/threadListItem/ThreadListItemArchive.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemArchive as useThreadListItemArchiveBehavior } from \"@assistant-ui/core/react\";\n\nconst useThreadListItemArchive = () => {\n const { archive } = useThreadListItemArchiveBehavior();\n return archive;\n};\n\nexport namespace ThreadListItemPrimitiveArchive {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemArchive>;\n}\n\nexport const ThreadListItemPrimitiveArchive = createActionButton(\n \"ThreadListItemPrimitive.Archive\",\n useThreadListItemArchive,\n);\n"],"mappings":";;;;AASA,MAAMG,mCAA2B;CAC/B,MAAA,EAAAE,YAAoBD,yBAAiC;CAAE,OAChDC;AAAO;AAQhB,MAAaC,iCAAiCJ,mBAC5C,mCACAC,0BACF"}
1
+ {"version":3,"file":"ThreadListItemArchive.js","names":["ActionButtonElement","ActionButtonProps","createActionButton","useThreadListItemArchive","useThreadListItemArchiveBehavior","archive","ThreadListItemPrimitiveArchive","Element","Props","useThreadListItemArchive","useThreadListItemArchiveBehavior"],"sources":["../../../src/primitives/threadListItem/ThreadListItemArchive.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemArchive as useThreadListItemArchiveBehavior } from \"@assistant-ui/core/react\";\n\nconst useThreadListItemArchive = () => {\n const { archive } = useThreadListItemArchiveBehavior();\n return archive;\n};\n\nexport namespace ThreadListItemPrimitiveArchive {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemArchive>;\n}\n\nexport const ThreadListItemPrimitiveArchive = createActionButton(\n \"ThreadListItemPrimitive.Archive\",\n useThreadListItemArchive,\n);\n"],"mappings":";;;;AASA,MAAMG,mCAA2B;CAC/B,MAAA,EAAAE,YAAoBD,yBAAiC;CAAE,OAChDC;AAAO;AAQhB,MAAaC,iCAAiCJ,mBAC5C,mCACAC,0BACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadListItemDelete.js","names":["ActionButtonElement","ActionButtonProps","createActionButton","useThreadListItemDelete","useThreadListItemDeleteBehavior","delete","deleteThread","ThreadListItemPrimitiveDelete","Element","Props"],"sources":["../../../src/primitives/threadListItem/ThreadListItemDelete.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemDelete as useThreadListItemDeleteBehavior } from \"@assistant-ui/core/react\";\n\nconst useThreadListItemDelete = () => {\n const { delete: deleteThread } = useThreadListItemDeleteBehavior();\n return deleteThread;\n};\n\nexport namespace ThreadListItemPrimitiveDelete {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemDelete>;\n}\n\nexport const ThreadListItemPrimitiveDelete = createActionButton(\n \"ThreadListItemPrimitive.Delete\",\n useThreadListItemDelete,\n);\n"],"mappings":";;;;AASA,MAAMG,kCAA0B;CAC9B,MAAA,EAAAE,QAAAC,iBAAiCF,wBAAgC;CAAE,OAC5DE;AAAY;AAQrB,MAAaC,gCAAgCL,mBAC3C,kCACAC,yBACF"}
1
+ {"version":3,"file":"ThreadListItemDelete.js","names":["ActionButtonElement","ActionButtonProps","createActionButton","useThreadListItemDelete","useThreadListItemDeleteBehavior","delete","deleteThread","ThreadListItemPrimitiveDelete","Element","Props","useThreadListItemDelete","useThreadListItemDeleteBehavior"],"sources":["../../../src/primitives/threadListItem/ThreadListItemDelete.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemDelete as useThreadListItemDeleteBehavior } from \"@assistant-ui/core/react\";\n\nconst useThreadListItemDelete = () => {\n const { delete: deleteThread } = useThreadListItemDeleteBehavior();\n return deleteThread;\n};\n\nexport namespace ThreadListItemPrimitiveDelete {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemDelete>;\n}\n\nexport const ThreadListItemPrimitiveDelete = createActionButton(\n \"ThreadListItemPrimitive.Delete\",\n useThreadListItemDelete,\n);\n"],"mappings":";;;;AASA,MAAMG,kCAA0B;CAC9B,MAAA,EAAAE,QAAAC,iBAAiCF,wBAAgC;CAAE,OAC5DE;AAAY;AAQrB,MAAaC,gCAAgCL,mBAC3C,kCACAC,yBACF"}
@@ -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","altKey","ctrlKey","metaKey","shiftKey","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/internal\";\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 if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)\n return;\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,IAAIA,MAAME,UAAUF,MAAMG,WAAWH,MAAMI,WAAWJ,MAAMK,UAC1D;EACF,MAAMC,aAAaT,cAAc,QAAQ,cAAc;EACvD,MAAMU,UAAUV,cAAc,QAAQ,eAAe;EACrD,MAAMW,UAAUjB,WAAWkB;EAC3B,MAAMC,OAAOjB,QAAQgB;EAErB,IAAID,WAAWR,MAAMW,WAAWH,SAAS;GACvC,IAAIR,MAAMY,QAAQ,eAAeZ,MAAMY,QAAQ,WAAW;IACxD,MAAMC,WAAWlB,SAAS,CAAC,CACxBmB,KAAKC,SAASA,KAAK/B,IAAIyB,OAAO,CAAC,CAC/BO,QAAQC,SAAoCA,SAAS,IAAI;IAC5D,MAAMC,OACJL,SACEA,SAASM,QAAQX,OAAO,KAAKR,MAAMY,QAAQ,cAAc,IAAI;IAEjE,IAAIM,MAAM;KACRA,KAAKxB,MAAM;KACXM,MAAMoB,eAAe;IACvB;GACF,OAAO,IAAIpB,MAAMY,QAAQN,cAAcI,MAAM;IAC3CA,KAAKhB,MAAM;IACXM,MAAMoB,eAAe;GACvB;EACF,OAAO,IAAIV,QAAQV,MAAMW,WAAWD,QAAQV,MAAMY,QAAQL,SAAS;GACjEC,SAASd,MAAM;GACfM,MAAMoB,eAAe;EACvB;CACF;CAEA,OACE,oBAAC,6BAAD;EAA6B,OAAO1B;EAClC,UAAA,oBAAC,YAAU,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,4BAA4ByC,cAAc"}
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","altKey","ctrlKey","metaKey","shiftKey","forwardKey","backKey","trigger","current","more","target","key","triggers","map","item","filter","node","next","indexOf","preventDefault","displayName","Primitive"],"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/internal\";\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 if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)\n return;\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,a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AA;CAEgB,CAAA;AAEjC,CAAC;AAEDJ,4BAA4ByC,cAAc"}
@@ -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/internal\";\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;CACA,MAAAkB,QAAcT,uBAAuB;CACrC,MAAAU,MAAYjB,gBAAgBc,cAAcE,OAAKE,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
+ {"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","useThreadListItemTrigger","useThreadListItemTriggerBehavior","_c"],"sources":["../../../src/primitives/threadListItem/ThreadListItemTrigger.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { useComposedRefs } from \"radix-ui/internal\";\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;CACA,MAAAkB,QAAcT,uBAAuB;CACrC,MAAAU,MAAYjB,gBAAgBc,cAAcE,OAAKE,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.js","names":["ActionButtonElement","ActionButtonProps","createActionButton","useThreadListItemUnarchive","useThreadListItemUnarchiveBehavior","unarchive","ThreadListItemPrimitiveUnarchive","Element","Props"],"sources":["../../../src/primitives/threadListItem/ThreadListItemUnarchive.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemUnarchive as useThreadListItemUnarchiveBehavior } from \"@assistant-ui/core/react\";\n\nconst useThreadListItemUnarchive = () => {\n const { unarchive } = useThreadListItemUnarchiveBehavior();\n return unarchive;\n};\n\nexport namespace ThreadListItemPrimitiveUnarchive {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemUnarchive>;\n}\n\nexport const ThreadListItemPrimitiveUnarchive = createActionButton(\n \"ThreadListItemPrimitive.Unarchive\",\n useThreadListItemUnarchive,\n);\n"],"mappings":";;;;AASA,MAAMG,qCAA6B;CACjC,MAAA,EAAAE,cAAsBD,2BAAmC;CAAE,OACpDC;AAAS;AAQlB,MAAaC,mCAAmCJ,mBAC9C,qCACAC,4BACF"}
1
+ {"version":3,"file":"ThreadListItemUnarchive.js","names":["ActionButtonElement","ActionButtonProps","createActionButton","useThreadListItemUnarchive","useThreadListItemUnarchiveBehavior","unarchive","ThreadListItemPrimitiveUnarchive","Element","Props","useThreadListItemUnarchive","useThreadListItemUnarchiveBehavior"],"sources":["../../../src/primitives/threadListItem/ThreadListItemUnarchive.ts"],"sourcesContent":["\"use client\";\n\nimport {\n type ActionButtonElement,\n type ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemUnarchive as useThreadListItemUnarchiveBehavior } from \"@assistant-ui/core/react\";\n\nconst useThreadListItemUnarchive = () => {\n const { unarchive } = useThreadListItemUnarchiveBehavior();\n return unarchive;\n};\n\nexport namespace ThreadListItemPrimitiveUnarchive {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemUnarchive>;\n}\n\nexport const ThreadListItemPrimitiveUnarchive = createActionButton(\n \"ThreadListItemPrimitive.Unarchive\",\n useThreadListItemUnarchive,\n);\n"],"mappings":";;;;AASA,MAAMG,qCAA6B;CACjC,MAAA,EAAAE,cAAsBD,2BAAmC;CAAE,OACpDC;AAAS;AAQlB,MAAaC,mCAAmCJ,mBAC9C,qCACAC,4BACF"}
@@ -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","altKey","ctrlKey","metaKey","shiftKey","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/internal\";\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 if (\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n )\n 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;CAC5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A,QAAA4B,IAAA;EAnBJE,KAAA,oBAAC,IAAD;GAA0B,GACpBxB;GAAK,GACLF;GACO,WAAAqB;GAaM,iBAAAG;GAIZ7B,KAAAA;GACOG;EAAU,CAAA;EACtBF,EAAA,KAAAc;EAAAd,EAAA,KAAAD;EAAAC,EAAA,MAAAI;EAAAJ,EAAA,MAAAM;EAAAN,EAAA,MAAAE;EAAAF,EAAA,MAAAyB;EAAAzB,EAAA,MAAA4B;EAAA5B,EAAA,MAAA8B;CAAA,OAAAA,KAAA9B,EAAA;CAAA,IAAA+B;CAAA,IAAA/B,EAAA,QAAAJ,eAAAI,EAAA,QAAAM,SAAAN,EAAA,QAAAa,GAAAhB,UAAAG,EAAA,QAAA8B,IAAA;EAvBJC,KAAA,oBAAA,GAAA,QAAA;GAAA,GAAkCzB;GAAK,GAAMV;GAC3CkC,UAAAA;EAuBF,CAAA;EAA+B9B,EAAA,MAAAJ;EAAAI,EAAA,MAAAM;EAAAN,EAAA,MAAAa,GAAAhB;EAAAG,EAAA,MAAA8B;EAAA9B,EAAA,MAAA+B;CAAA,OAAAA,KAAA/B,EAAA;CAAA,OAxB/B+B;AAwB+B,CAGrC;AAEAvC,mCAAmCwC,cACjC"}
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","altKey","ctrlKey","metaKey","shiftKey","preventDefault","current","t4","onKeyDown","t5","t6","onEscapeKeyDown","t7","t8","displayName","_c","DropdownMenuPrimitive"],"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/internal\";\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 if (\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n )\n 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/C,IACEK,MAAKE,UACLF,MAAKG,WACLH,MAAKI,WACLJ,MAAKK,UAAS;GAGhBL,MAAKM,eAAgB;GACrBhB,QAAQ,KAAK;GACbC,OAAKQ,QAAiBQ,SAAOhB,MAAC;EAAC;EAChCR,EAAA,KAAAY;EAAAZ,EAAA,KAAAQ,OAAAQ;EAAAhB,EAAA,KAAAO;EAAAP,EAAA,KAAAS;EAAAT,EAAA,KAAAe;CAAA,OAAAA,KAAAf,EAA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B,EAAA;CAAA,OAxB/B+B;AAwB+B,CAGrC;AAEAvC,mCAAmCwC,cACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadListItemMoreItem.js","names":["c","_c","ComponentRef","forwardRef","DropdownMenu","DropdownMenuPrimitive","WithRenderPropProps","DropdownMenuRenderItem","ScopedProps","useDropdownMenuScope","ThreadListItemMorePrimitiveItem","Element","Item","Props","t0","ref","$","__scopeThreadListItemMore","rest","scope","t1","displayName"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreItem.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentRef, forwardRef } from \"react\";\nimport type { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport type { WithRenderPropProps } from \"../../utils/Primitive\";\nimport { DropdownMenuRenderItem } from \"../dropdownMenuRenderPrimitives\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nexport namespace ThreadListItemMorePrimitiveItem {\n export type Element = ComponentRef<typeof DropdownMenuPrimitive.Item>;\n export type Props = WithRenderPropProps<typeof DropdownMenuPrimitive.Item>;\n}\n\nexport const ThreadListItemMorePrimitiveItem = forwardRef<\n ThreadListItemMorePrimitiveItem.Element,\n ThreadListItemMorePrimitiveItem.Props\n>(\n (\n {\n __scopeThreadListItemMore,\n ...rest\n }: ScopedProps<ThreadListItemMorePrimitiveItem.Props>,\n ref,\n ) => {\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n\n return <DropdownMenuRenderItem {...scope} {...rest} ref={ref} />;\n },\n);\n\nThreadListItemMorePrimitiveItem.displayName =\n \"ThreadListItemMorePrimitive.Item\";\n"],"mappings":";;;;;;;AAaA,MAAaU,kCAAkCP,YAI7CW,IAAAC,QAAA;CAAA,MAAAC,IAAAf,EAAA,CAAA;CAAA,IAAAgB;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAF,IAAA;EACE,CAAA,CAAAG,2BAAA,GAAAC,QAAAJ;EAGqDE,EAAA,KAAAF;EAAAE,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAA;EAAAD,4BAAAD,EAAA;EAAAE,OAAAF,EAAA;CAAA;CAGrD,MAAAG,QAAcV,qBAAqBQ,yBAAyB;CAAE,IAAAG;CAAA,IAAAJ,EAAA,OAAAD,OAAAC,EAAA,OAAAE,QAAAF,EAAA,OAAAG,OAAA;EAEvDC,KAAA,oBAAC,wBAAD;GAAuB,GAAKD;GAAK,GAAMD;GAAWH;EAAG,CAAA;EAAIC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,OAAzDI;AAAyD,CAEpE;AAEAV,gCAAgCW,cAC9B"}
1
+ {"version":3,"file":"ThreadListItemMoreItem.js","names":["c","_c","ComponentRef","forwardRef","DropdownMenu","DropdownMenuPrimitive","WithRenderPropProps","DropdownMenuRenderItem","ScopedProps","useDropdownMenuScope","ThreadListItemMorePrimitiveItem","Element","Item","Props","t0","ref","$","__scopeThreadListItemMore","rest","scope","t1","displayName","_c"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreItem.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentRef, forwardRef } from \"react\";\nimport type { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport type { WithRenderPropProps } from \"../../utils/Primitive\";\nimport { DropdownMenuRenderItem } from \"../dropdownMenuRenderPrimitives\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nexport namespace ThreadListItemMorePrimitiveItem {\n export type Element = ComponentRef<typeof DropdownMenuPrimitive.Item>;\n export type Props = WithRenderPropProps<typeof DropdownMenuPrimitive.Item>;\n}\n\nexport const ThreadListItemMorePrimitiveItem = forwardRef<\n ThreadListItemMorePrimitiveItem.Element,\n ThreadListItemMorePrimitiveItem.Props\n>(\n (\n {\n __scopeThreadListItemMore,\n ...rest\n }: ScopedProps<ThreadListItemMorePrimitiveItem.Props>,\n ref,\n ) => {\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n\n return <DropdownMenuRenderItem {...scope} {...rest} ref={ref} />;\n },\n);\n\nThreadListItemMorePrimitiveItem.displayName =\n \"ThreadListItemMorePrimitive.Item\";\n"],"mappings":";;;;;;;AAaA,MAAaU,kCAAkCP,YAI7CW,IAAAC,QAAA;CAAA,MAAAC,IAAAf,EAAA,CAAA;CAAA,IAAAgB;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAF,IAAA;EACE,CAAA,CAAAG,2BAAA,GAAAC,QAAAJ;EAGqDE,EAAA,KAAAF;EAAAE,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAA;EAAAD,4BAAAD,EAAA;EAAAE,OAAAF,EAAA;CAAA;CAGrD,MAAAG,QAAcV,qBAAqBQ,yBAAyB;CAAE,IAAAG;CAAA,IAAAJ,EAAA,OAAAD,OAAAC,EAAA,OAAAE,QAAAF,EAAA,OAAAG,OAAA;EAEvDC,KAAA,oBAAC,wBAAD;GAAuB,GAAKD;GAAK,GAAMD;GAAWH;EAAG,CAAA;EAAIC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,OAAzDI;AAAyD,CAEpE;AAEAV,gCAAgCW,cAC9B"}
@@ -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/internal\";\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,WAAA,GAAAG,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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oB;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
+ {"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","_c","DropdownMenuPrimitive"],"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/internal\";\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,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CL;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,oBAAAK,aAAA,MAAA;GAAA,GACMd;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.js","names":["c","_c","ComponentRef","forwardRef","DropdownMenu","DropdownMenuPrimitive","WithRenderPropProps","DropdownMenuRenderSeparator","ScopedProps","useDropdownMenuScope","ThreadListItemMorePrimitiveSeparator","Element","Separator","Props","t0","ref","$","__scopeThreadListItemMore","rest","scope","t1","displayName"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreSeparator.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentRef, forwardRef } from \"react\";\nimport type { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport type { WithRenderPropProps } from \"../../utils/Primitive\";\nimport { DropdownMenuRenderSeparator } from \"../dropdownMenuRenderPrimitives\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nexport namespace ThreadListItemMorePrimitiveSeparator {\n export type Element = ComponentRef<typeof DropdownMenuPrimitive.Separator>;\n export type Props = WithRenderPropProps<\n typeof DropdownMenuPrimitive.Separator\n >;\n}\n\nexport const ThreadListItemMorePrimitiveSeparator = forwardRef<\n ThreadListItemMorePrimitiveSeparator.Element,\n ThreadListItemMorePrimitiveSeparator.Props\n>(\n (\n {\n __scopeThreadListItemMore,\n ...rest\n }: ScopedProps<ThreadListItemMorePrimitiveSeparator.Props>,\n ref,\n ) => {\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n\n return <DropdownMenuRenderSeparator {...scope} {...rest} ref={ref} />;\n },\n);\n\nThreadListItemMorePrimitiveSeparator.displayName =\n \"ThreadListItemMorePrimitive.Separator\";\n"],"mappings":";;;;;;;AAeA,MAAaU,uCAAuCP,YAIlDW,IAAAC,QAAA;CAAA,MAAAC,IAAAf,EAAA,CAAA;CAAA,IAAAgB;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAF,IAAA;EACE,CAAA,CAAAG,2BAAA,GAAAC,QAAAJ;EAG0DE,EAAA,KAAAF;EAAAE,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAA;EAAAD,4BAAAD,EAAA;EAAAE,OAAAF,EAAA;CAAA;CAG1D,MAAAG,QAAcV,qBAAqBQ,yBAAyB;CAAE,IAAAG;CAAA,IAAAJ,EAAA,OAAAD,OAAAC,EAAA,OAAAE,QAAAF,EAAA,OAAAG,OAAA;EAEvDC,KAAA,oBAAC,6BAAD;GAA4B,GAAKD;GAAK,GAAMD;GAAWH;EAAG,CAAA;EAAIC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,OAA9DI;AAA8D,CAEzE;AAEAV,qCAAqCW,cACnC"}
1
+ {"version":3,"file":"ThreadListItemMoreSeparator.js","names":["c","_c","ComponentRef","forwardRef","DropdownMenu","DropdownMenuPrimitive","WithRenderPropProps","DropdownMenuRenderSeparator","ScopedProps","useDropdownMenuScope","ThreadListItemMorePrimitiveSeparator","Element","Separator","Props","t0","ref","$","__scopeThreadListItemMore","rest","scope","t1","displayName","_c"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreSeparator.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentRef, forwardRef } from \"react\";\nimport type { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport type { WithRenderPropProps } from \"../../utils/Primitive\";\nimport { DropdownMenuRenderSeparator } from \"../dropdownMenuRenderPrimitives\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nexport namespace ThreadListItemMorePrimitiveSeparator {\n export type Element = ComponentRef<typeof DropdownMenuPrimitive.Separator>;\n export type Props = WithRenderPropProps<\n typeof DropdownMenuPrimitive.Separator\n >;\n}\n\nexport const ThreadListItemMorePrimitiveSeparator = forwardRef<\n ThreadListItemMorePrimitiveSeparator.Element,\n ThreadListItemMorePrimitiveSeparator.Props\n>(\n (\n {\n __scopeThreadListItemMore,\n ...rest\n }: ScopedProps<ThreadListItemMorePrimitiveSeparator.Props>,\n ref,\n ) => {\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n\n return <DropdownMenuRenderSeparator {...scope} {...rest} ref={ref} />;\n },\n);\n\nThreadListItemMorePrimitiveSeparator.displayName =\n \"ThreadListItemMorePrimitive.Separator\";\n"],"mappings":";;;;;;;AAeA,MAAaU,uCAAuCP,YAIlDW,IAAAC,QAAA;CAAA,MAAAC,IAAAf,EAAA,CAAA;CAAA,IAAAgB;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAF,IAAA;EACE,CAAA,CAAAG,2BAAA,GAAAC,QAAAJ;EAG0DE,EAAA,KAAAF;EAAAE,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAA;EAAAD,4BAAAD,EAAA;EAAAE,OAAAF,EAAA;CAAA;CAG1D,MAAAG,QAAcV,qBAAqBQ,yBAAyB;CAAE,IAAAG;CAAA,IAAAJ,EAAA,OAAAD,OAAAC,EAAA,OAAAE,QAAAF,EAAA,OAAAG,OAAA;EAEvDC,KAAA,oBAAC,6BAAD;GAA4B,GAAKD;GAAK,GAAMD;GAAWH;EAAG,CAAA;EAAIC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,OAA9DI;AAA8D,CAEzE;AAEAV,qCAAqCW,cACnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadListItemMoreTrigger.js","names":["c","_c","ComponentRef","forwardRef","Direction","DropdownMenu","DropdownMenuPrimitive","useComposedRefs","composeEventHandlers","WithRenderPropProps","DropdownMenuRenderTrigger","useThreadListItemFocus","useThreadListItemMoreSharedFocusGroup","useThreadListItemMoreSetOpen","ScopedProps","useDropdownMenuScope","ThreadListItemMorePrimitiveTrigger","Element","Trigger","Props","t0","ref","$","__scopeThreadListItemMore","rest","scope","focus","setOpen","sharedFocusGroup","composedRef","moreRef","direction","useDirection","openKey","T0","t1","event","key","altKey","ctrlKey","metaKey","shiftKey","preventDefault","t2","onKeyDown","t3","displayName"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreTrigger.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentRef, forwardRef } from \"react\";\nimport {\n Direction,\n type DropdownMenu as DropdownMenuPrimitive,\n} from \"radix-ui\";\nimport { useComposedRefs } from \"radix-ui/internal\";\nimport { composeEventHandlers } from \"radix-ui/internal\";\nimport type { WithRenderPropProps } from \"../../utils/Primitive\";\nimport { DropdownMenuRenderTrigger } from \"../dropdownMenuRenderPrimitives\";\nimport { useThreadListItemFocus } from \"../threadListFocusGroup\";\nimport {\n useThreadListItemMoreSharedFocusGroup,\n useThreadListItemMoreSetOpen,\n} from \"./ThreadListItemMoreRoot\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nexport namespace ThreadListItemMorePrimitiveTrigger {\n export type Element = ComponentRef<typeof DropdownMenuPrimitive.Trigger>;\n export type Props = WithRenderPropProps<typeof DropdownMenuPrimitive.Trigger>;\n}\n\nexport const ThreadListItemMorePrimitiveTrigger = forwardRef<\n ThreadListItemMorePrimitiveTrigger.Element,\n ThreadListItemMorePrimitiveTrigger.Props\n>(\n (\n {\n __scopeThreadListItemMore,\n ...rest\n }: ScopedProps<ThreadListItemMorePrimitiveTrigger.Props>,\n ref,\n ) => {\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n const focus = useThreadListItemFocus();\n const setOpen = useThreadListItemMoreSetOpen();\n const sharedFocusGroup = useThreadListItemMoreSharedFocusGroup();\n const composedRef = useComposedRefs(ref, focus?.moreRef);\n const direction = Direction.useDirection();\n const openKey = direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n\n return (\n <DropdownMenuRenderTrigger\n {...scope}\n {...rest}\n onKeyDown={composeEventHandlers(rest.onKeyDown, (event) => {\n if (!sharedFocusGroup || event.key !== openKey) return;\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)\n return;\n event.preventDefault();\n setOpen(true);\n })}\n ref={composedRef}\n />\n );\n },\n);\n\nThreadListItemMorePrimitiveTrigger.displayName =\n \"ThreadListItemMorePrimitive.Trigger\";\n"],"mappings":";;;;;;;;;;;AAuBA,MAAagB,qCAAqCb,YAI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jC"}
1
+ {"version":3,"file":"ThreadListItemMoreTrigger.js","names":["c","_c","ComponentRef","forwardRef","Direction","DropdownMenu","DropdownMenuPrimitive","useComposedRefs","composeEventHandlers","WithRenderPropProps","DropdownMenuRenderTrigger","useThreadListItemFocus","useThreadListItemMoreSharedFocusGroup","useThreadListItemMoreSetOpen","ScopedProps","useDropdownMenuScope","ThreadListItemMorePrimitiveTrigger","Element","Trigger","Props","t0","ref","$","__scopeThreadListItemMore","rest","scope","focus","setOpen","sharedFocusGroup","composedRef","moreRef","direction","useDirection","openKey","T0","t1","event","key","altKey","ctrlKey","metaKey","shiftKey","preventDefault","t2","onKeyDown","t3","displayName","_c"],"sources":["../../../src/primitives/threadListItemMore/ThreadListItemMoreTrigger.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentRef, forwardRef } from \"react\";\nimport {\n Direction,\n type DropdownMenu as DropdownMenuPrimitive,\n} from \"radix-ui\";\nimport { useComposedRefs } from \"radix-ui/internal\";\nimport { composeEventHandlers } from \"radix-ui/internal\";\nimport type { WithRenderPropProps } from \"../../utils/Primitive\";\nimport { DropdownMenuRenderTrigger } from \"../dropdownMenuRenderPrimitives\";\nimport { useThreadListItemFocus } from \"../threadListFocusGroup\";\nimport {\n useThreadListItemMoreSharedFocusGroup,\n useThreadListItemMoreSetOpen,\n} from \"./ThreadListItemMoreRoot\";\nimport { type ScopedProps, useDropdownMenuScope } from \"./scope\";\n\nexport namespace ThreadListItemMorePrimitiveTrigger {\n export type Element = ComponentRef<typeof DropdownMenuPrimitive.Trigger>;\n export type Props = WithRenderPropProps<typeof DropdownMenuPrimitive.Trigger>;\n}\n\nexport const ThreadListItemMorePrimitiveTrigger = forwardRef<\n ThreadListItemMorePrimitiveTrigger.Element,\n ThreadListItemMorePrimitiveTrigger.Props\n>(\n (\n {\n __scopeThreadListItemMore,\n ...rest\n }: ScopedProps<ThreadListItemMorePrimitiveTrigger.Props>,\n ref,\n ) => {\n const scope = useDropdownMenuScope(__scopeThreadListItemMore);\n const focus = useThreadListItemFocus();\n const setOpen = useThreadListItemMoreSetOpen();\n const sharedFocusGroup = useThreadListItemMoreSharedFocusGroup();\n const composedRef = useComposedRefs(ref, focus?.moreRef);\n const direction = Direction.useDirection();\n const openKey = direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n\n return (\n <DropdownMenuRenderTrigger\n {...scope}\n {...rest}\n onKeyDown={composeEventHandlers(rest.onKeyDown, (event) => {\n if (!sharedFocusGroup || event.key !== openKey) return;\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)\n return;\n event.preventDefault();\n setOpen(true);\n })}\n ref={composedRef}\n />\n );\n },\n);\n\nThreadListItemMorePrimitiveTrigger.displayName =\n \"ThreadListItemMorePrimitive.Trigger\";\n"],"mappings":";;;;;;;;;;;AAuBA,MAAagB,qCAAqCb,YAIhDiB,IAAAC,QAAA;CAAA,MAAAC,IAAArB,EAAA,EAAA;CACE,MAAA,EAAAsB,2BAAA,GAAAC,SAAAJ;CAMA,MAAAK,QAAcV,qBAAqBQ,yBAAyB;CAC5D,MAAAG,QAAcf,uBAAuB;CACrC,MAAAgB,UAAgBd,6BAA6B;CAC7C,MAAAe,mBAAyBhB,sCAAsC;CAC/D,MAAAiB,cAAoBtB,gBAAgBc,KAAKK,OAAKI,OAAS;CAEvD,MAAAG,UADkB7B,UAAS4B,aACXD,MAAc,QAAd,cAAA;CAGb,MAAAG,KAAAxB;CAAyB,IAAAyB;CAAA,IAAAb,EAAA,OAAAW,WAAAX,EAAA,OAAAK,WAAAL,EAAA,OAAAM,kBAAA;EAGwBO,MAAAC,UAAA;GAC9C,IAAI,CAACR,oBAAoBQ,MAAKC,QAASJ,SAAO;GAC9C,IAAIG,MAAKE,UAAWF,MAAKG,WAAYH,MAAKI,WAAYJ,MAAKK,UAAS;GAEpEL,MAAKM,eAAgB;GACrBf,QAAQ,IAAI;EAAC;EACdL,EAAA,KAAAW;EAAAX,EAAA,KAAAK;EAAAL,EAAA,KAAAM;EAAAN,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CANU,MAAAqB,KAAAnC,qBAAqBgB,KAAIoB,WAAYT,EAM/C;CAAC,IAAAU;CAAA,IAAAvB,EAAA,OAAAY,MAAAZ,EAAA,OAAAO,eAAAP,EAAA,OAAAE,QAAAF,EAAA,OAAAG,SAAAH,EAAA,OAAAqB,IAAA;EATJE,KAAA,oBAAC,IAAD;GAA0B,GACpBpB;GAAK,GACLD;GACO,WAAAmB;GAONd,KAAAA;EAAW,CAAA;EAChBP,EAAA,KAAAY;EAAAZ,EAAA,KAAAO;EAAAP,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAqB;EAAArB,EAAA,KAAAuB;CAAA,OAAAA,KAAAvB,EAAA;CAAA,OAXFuB;AAWE,CAGR;AAEA7B,mCAAmC8B,cACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","names":["DropdownMenu","DropdownMenuPrimitive","Context","useDropdownMenuScope","ReturnType","createDropdownMenuScope","ScopedProps","P","__scopeThreadListItemMore","Scope"],"sources":["../../../src/primitives/threadListItemMore/scope.ts"],"sourcesContent":["import { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport type { Context } from \"radix-ui/internal\";\n\nexport const useDropdownMenuScope: ReturnType<\n typeof DropdownMenuPrimitive.createDropdownMenuScope\n> = DropdownMenuPrimitive.createDropdownMenuScope();\n\nexport type ScopedProps<P> = P & { __scopeThreadListItemMore?: Context.Scope };\n"],"mappings":";;AAGA,MAAaG,uBAETF,aAAsBI,wBAAwB"}
1
+ {"version":3,"file":"scope.js","names":["DropdownMenu","DropdownMenuPrimitive","Context","useDropdownMenuScope","ReturnType","createDropdownMenuScope","ScopedProps","P","__scopeThreadListItemMore","Scope","DropdownMenuPrimitive"],"sources":["../../../src/primitives/threadListItemMore/scope.ts"],"sourcesContent":["import { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nimport type { Context } from \"radix-ui/internal\";\n\nexport const useDropdownMenuScope: ReturnType<\n typeof DropdownMenuPrimitive.createDropdownMenuScope\n> = DropdownMenuPrimitive.createDropdownMenuScope();\n\nexport type ScopedProps<P> = P & { __scopeThreadListItemMore?: Context.Scope };\n"],"mappings":";;AAGA,MAAaG,uBAETF,aAAsBI,wBAAwB"}
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxHost.js","names":["c","_c","CSSProperties","useEffect","useLayoutEffect","useRef","useState","isShimLoadError","RenderedFrame","SafeContentFrame","SandboxOption","invokeUserCallback","DEFAULT_PRODUCT","DEFAULT_MAX_HEIGHT","LOAD_TIMEOUT_MS","SandboxHostConfig","sandbox","useShadowDom","enableBrowserCaching","salt","product","className","style","unsafeDocumentWrite","SandboxHostFrame","Pick","SandboxHostApi","setHeight","height","SandboxBridge","onMessage","event","MessageEvent","dispose","SandboxContent","html","SandboxHostProps","content","contentKey","maxHeight","createBridge","frame","host","onError","error","Error","containerProps","Record","isSandboxFrameMessage","iframe","HTMLIFrameElement","origin","source","contentWindow","LiveSnapshot","SandboxHost","t0","$","t1","undefined","containerRef","contentHeight","setContentHeight","t2","liveRef","t3","t4","current","t5","Symbol","for","container","cancelled","bridge","liveContent","sb","reportError","err","String","bind","scf","renderOpts","renderHtml","then","rendered","hostApi","Number","isFinite","sendMessage","window","addEventListener","fullyLoadedPromiseWithTimeout","catch","err_0","code","err_1","cleanupFailed","cleanupError","runCleanup","cleanup","t6","console","listener","removeEventListener","bridgeToDispose","frameToDispose","resolvedHeight","Math","min","t7","mergedStyle","t8","t9"],"sources":["../../src/sandbox-host/SandboxHost.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport {\n isShimLoadError,\n type RenderedFrame,\n SafeContentFrame,\n type SandboxOption,\n} from \"safe-content-frame\";\nimport { invokeUserCallback } from \"@assistant-ui/core/internal\";\n\nconst DEFAULT_PRODUCT = \"assistant-ui-sandbox\";\nconst DEFAULT_MAX_HEIGHT = 800;\nconst LOAD_TIMEOUT_MS = 10_000;\n\nexport type SandboxHostConfig = {\n sandbox?: SandboxOption[];\n useShadowDom?: boolean;\n enableBrowserCaching?: boolean;\n salt?: string;\n product?: string;\n className?: string;\n style?: CSSProperties;\n unsafeDocumentWrite?: boolean;\n};\n\nexport type SandboxHostFrame = Pick<\n RenderedFrame,\n \"iframe\" | \"origin\" | \"sendMessage\"\n>;\n\nexport type SandboxHostApi = {\n setHeight: (height: number) => void;\n};\n\nexport type SandboxBridge = {\n onMessage: (event: MessageEvent) => void;\n dispose: () => void;\n};\n\nexport type SandboxContent = { html: string };\n\nexport type SandboxHostProps = {\n content: SandboxContent;\n contentKey: string;\n sandbox?: SandboxHostConfig | undefined;\n maxHeight?: number | undefined;\n createBridge: (\n frame: SandboxHostFrame,\n host: SandboxHostApi,\n ) => SandboxBridge;\n onError?: ((error: Error) => void) | undefined;\n containerProps?: Record<string, string | undefined> | undefined;\n};\n\nexport function isSandboxFrameMessage(\n event: MessageEvent,\n frame: { iframe: HTMLIFrameElement; origin: string },\n): boolean {\n return (\n event.source === frame.iframe.contentWindow && event.origin === frame.origin\n );\n}\n\ntype LiveSnapshot = {\n content: SandboxContent;\n sandbox: SandboxHostConfig | undefined;\n createBridge: SandboxHostProps[\"createBridge\"];\n onError: SandboxHostProps[\"onError\"];\n};\n\nexport function SandboxHost({\n content,\n contentKey,\n sandbox,\n maxHeight = DEFAULT_MAX_HEIGHT,\n createBridge,\n onError,\n containerProps,\n}: SandboxHostProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState<number | undefined>(\n undefined,\n );\n\n const liveRef = useRef<LiveSnapshot>({\n content,\n sandbox,\n createBridge,\n onError,\n });\n useLayoutEffect(() => {\n liveRef.current = { content, sandbox, createBridge, onError };\n }, [content, sandbox, createBridge, onError]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n let cancelled = false;\n let frame: RenderedFrame | null = null;\n let bridge: SandboxBridge | null = null;\n let onMessage: ((event: MessageEvent) => void) | null = null;\n\n const { content: liveContent, sandbox: sb } = liveRef.current;\n\n const reportError = (err: unknown) => {\n const error = err instanceof Error ? err : new Error(String(err));\n invokeUserCallback(\n \"assistant-ui\",\n \"SandboxHost onError\",\n liveRef.current.onError?.bind(liveRef.current),\n error,\n );\n };\n\n const scf = new SafeContentFrame(sb?.product ?? DEFAULT_PRODUCT, {\n ...(sb?.sandbox !== undefined && { sandbox: sb.sandbox }),\n ...(sb?.useShadowDom !== undefined && { useShadowDom: sb.useShadowDom }),\n ...(sb?.enableBrowserCaching !== undefined && {\n enableBrowserCaching: sb.enableBrowserCaching,\n }),\n ...(sb?.salt !== undefined && { salt: sb.salt }),\n });\n\n const renderOpts =\n sb?.unsafeDocumentWrite !== undefined\n ? { unsafeDocumentWrite: sb.unsafeDocumentWrite }\n : undefined;\n\n scf\n .renderHtml(liveContent.html, container, renderOpts)\n .then((rendered) => {\n if (cancelled) {\n rendered.dispose();\n return;\n }\n frame = rendered;\n\n const hostApi: SandboxHostApi = {\n setHeight: (height) => {\n if (\n typeof height === \"number\" &&\n Number.isFinite(height) &&\n height > 0\n ) {\n setContentHeight(height);\n }\n },\n };\n\n bridge = liveRef.current.createBridge(\n {\n iframe: rendered.iframe,\n origin: rendered.origin,\n sendMessage: rendered.sendMessage,\n },\n hostApi,\n );\n\n // Single owner of the window listener; the cross-origin guard runs\n // here so the bridge only sees frame-validated messages.\n onMessage = (event) => {\n if (!isSandboxFrameMessage(event, rendered)) return;\n bridge?.onMessage(event);\n };\n window.addEventListener(\"message\", onMessage);\n\n // renderHtml resolves at iframe load, which a shim that was never\n // served also reaches, so a completed render is only known once the\n // frame says so. render-timeout is excluded because the shim is\n // running and the guest may still paint, and reporting it would leave\n // a host that renders an error state showing one over a frame that\n // recovers.\n rendered.fullyLoadedPromiseWithTimeout(LOAD_TIMEOUT_MS).catch((err) => {\n if (cancelled) return;\n if (isShimLoadError(err) && err.code === \"render-timeout\") return;\n reportError(err);\n });\n })\n .catch((err) => {\n if (cancelled) return;\n frame?.dispose();\n frame = null;\n reportError(err);\n });\n\n return () => {\n cancelled = true;\n let cleanupFailed = false;\n let cleanupError: unknown;\n const runCleanup = (cleanup: () => void) => {\n try {\n cleanup();\n } catch (error) {\n if (cleanupFailed) {\n console.error(error);\n } else {\n cleanupFailed = true;\n cleanupError = error;\n }\n }\n };\n\n if (onMessage) {\n const listener = onMessage;\n onMessage = null;\n runCleanup(() => window.removeEventListener(\"message\", listener));\n }\n const bridgeToDispose = bridge;\n bridge = null;\n if (bridgeToDispose) runCleanup(() => bridgeToDispose.dispose());\n const frameToDispose = frame;\n frame = null;\n if (frameToDispose) runCleanup(() => frameToDispose.dispose());\n runCleanup(() => setContentHeight(undefined));\n\n if (cleanupFailed) throw cleanupError;\n };\n // oxlint-disable-next-line react/exhaustive-deps -- re-init only on contentKey change; live values flow through liveRef\n }, [contentKey]);\n\n const resolvedHeight =\n contentHeight != null ? Math.min(contentHeight, maxHeight) : undefined;\n const mergedStyle =\n resolvedHeight != null\n ? { ...sandbox?.style, height: resolvedHeight }\n : sandbox?.style;\n\n return (\n <div\n {...containerProps}\n ref={containerRef}\n className={sandbox?.className}\n style={mergedStyle}\n />\n );\n}\n"],"mappings":";;;;;;;AAiBA,MAAMY,kBAAkB;AACxB,MAAMC,qBAAqB;AAC3B,MAAMC,kBAAkB;AA0CxB,SAAgBkC,sBACdjB,OACAU,OACS;CACT,OACEV,MAAMqB,WAAWX,MAAMQ,OAAOI,iBAAiBtB,MAAMoB,WAAWV,MAAMU;AAE1E;AASA,SAAOI,YAAAC,IAAA;CAAA,MAAAC,IAAAxD,EAAA,EAAA;CAAqB,MAAA,EAAAoC,SAAAC,YAAAtB,SAAAuB,WAAAmB,IAAAlB,cAAAG,SAAAG,mBAAAU;CAI1B,MAAAjB,YAAAmB,OAAAC,KAAAA,IAAA9C,qBAAA6C;CAKA,MAAAE,eAAqBvD,OAAuB,IAAI;CAChD,MAA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AAjD,EAAA,QAAAzC,SAAAM,OAAA;EAEvEuF,KAAAH,kBAAkB,OAAlB;GAAA,GACS1F,SAAOM;GAAOM,QAAU8E;EAChB,IAAb1F,SAAOM;EAAOmC,EAAA,MAAAiD;EAAAjD,EAAA,MAAAzC,SAAAM;EAAAmC,EAAA,MAAAoD;CAAA,OAAAA,KAAApD,EAAA;CAHpB,MAAAqD,cACED;CAQa,MAAAE,KAAA/F,SAAOK;CAAW,IAAA2F;CAAA,IAAAvD,EAAA,QAAAX,kBAAAW,EAAA,QAAAqD,eAAArD,EAAA,QAAAsD,IAAA;EAH/BC,KAAA,oBAAA,OAAA;GAKE,GAJIlE;GACCc,KAAAA;GACM,WAAAmD;GACJD,OAAAA;EAAW,CAAA;EAClBrD,EAAA,MAAAX;EAAAW,EAAA,MAAAqD;EAAArD,EAAA,MAAAsD;EAAAtD,EAAA,MAAAuD;CAAA,OAAAA,KAAAvD,EAAA;CAAA,OALFuD;AAKE"}
1
+ {"version":3,"file":"SandboxHost.js","names":["c","_c","CSSProperties","useEffect","useLayoutEffect","useRef","useState","isShimLoadError","RenderedFrame","SafeContentFrame","SandboxOption","invokeUserCallback","DEFAULT_PRODUCT","DEFAULT_MAX_HEIGHT","LOAD_TIMEOUT_MS","SandboxHostConfig","sandbox","useShadowDom","enableBrowserCaching","salt","product","className","style","unsafeDocumentWrite","SandboxHostFrame","Pick","SandboxHostApi","setHeight","height","SandboxBridge","onMessage","event","MessageEvent","dispose","SandboxContent","html","SandboxHostProps","content","contentKey","maxHeight","createBridge","frame","host","onError","error","Error","containerProps","Record","isSandboxFrameMessage","iframe","HTMLIFrameElement","origin","source","contentWindow","LiveSnapshot","SandboxHost","t0","$","t1","undefined","containerRef","contentHeight","setContentHeight","t2","liveRef","t3","t4","current","t5","Symbol","for","container","cancelled","bridge","liveContent","sb","reportError","err","String","bind","scf","renderOpts","renderHtml","then","rendered","hostApi","Number","isFinite","sendMessage","window","addEventListener","fullyLoadedPromiseWithTimeout","catch","err_0","code","err_1","cleanupFailed","cleanupError","runCleanup","cleanup","t6","console","listener","removeEventListener","bridgeToDispose","frameToDispose","resolvedHeight","Math","min","t7","mergedStyle","t8","t9","_c"],"sources":["../../src/sandbox-host/SandboxHost.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport {\n isShimLoadError,\n type RenderedFrame,\n SafeContentFrame,\n type SandboxOption,\n} from \"safe-content-frame\";\nimport { invokeUserCallback } from \"@assistant-ui/core/internal\";\n\nconst DEFAULT_PRODUCT = \"assistant-ui-sandbox\";\nconst DEFAULT_MAX_HEIGHT = 800;\nconst LOAD_TIMEOUT_MS = 10_000;\n\nexport type SandboxHostConfig = {\n sandbox?: SandboxOption[];\n useShadowDom?: boolean;\n enableBrowserCaching?: boolean;\n salt?: string;\n product?: string;\n className?: string;\n style?: CSSProperties;\n unsafeDocumentWrite?: boolean;\n};\n\nexport type SandboxHostFrame = Pick<\n RenderedFrame,\n \"iframe\" | \"origin\" | \"sendMessage\"\n>;\n\nexport type SandboxHostApi = {\n setHeight: (height: number) => void;\n};\n\nexport type SandboxBridge = {\n onMessage: (event: MessageEvent) => void;\n dispose: () => void;\n};\n\nexport type SandboxContent = { html: string };\n\nexport type SandboxHostProps = {\n content: SandboxContent;\n contentKey: string;\n sandbox?: SandboxHostConfig | undefined;\n maxHeight?: number | undefined;\n createBridge: (\n frame: SandboxHostFrame,\n host: SandboxHostApi,\n ) => SandboxBridge;\n onError?: ((error: Error) => void) | undefined;\n containerProps?: Record<string, string | undefined> | undefined;\n};\n\nexport function isSandboxFrameMessage(\n event: MessageEvent,\n frame: { iframe: HTMLIFrameElement; origin: string },\n): boolean {\n return (\n event.source === frame.iframe.contentWindow && event.origin === frame.origin\n );\n}\n\ntype LiveSnapshot = {\n content: SandboxContent;\n sandbox: SandboxHostConfig | undefined;\n createBridge: SandboxHostProps[\"createBridge\"];\n onError: SandboxHostProps[\"onError\"];\n};\n\nexport function SandboxHost({\n content,\n contentKey,\n sandbox,\n maxHeight = DEFAULT_MAX_HEIGHT,\n createBridge,\n onError,\n containerProps,\n}: SandboxHostProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState<number | undefined>(\n undefined,\n );\n\n const liveRef = useRef<LiveSnapshot>({\n content,\n sandbox,\n createBridge,\n onError,\n });\n useLayoutEffect(() => {\n liveRef.current = { content, sandbox, createBridge, onError };\n }, [content, sandbox, createBridge, onError]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n let cancelled = false;\n let frame: RenderedFrame | null = null;\n let bridge: SandboxBridge | null = null;\n let onMessage: ((event: MessageEvent) => void) | null = null;\n\n const { content: liveContent, sandbox: sb } = liveRef.current;\n\n const reportError = (err: unknown) => {\n const error = err instanceof Error ? err : new Error(String(err));\n invokeUserCallback(\n \"assistant-ui\",\n \"SandboxHost onError\",\n liveRef.current.onError?.bind(liveRef.current),\n error,\n );\n };\n\n const scf = new SafeContentFrame(sb?.product ?? DEFAULT_PRODUCT, {\n ...(sb?.sandbox !== undefined && { sandbox: sb.sandbox }),\n ...(sb?.useShadowDom !== undefined && { useShadowDom: sb.useShadowDom }),\n ...(sb?.enableBrowserCaching !== undefined && {\n enableBrowserCaching: sb.enableBrowserCaching,\n }),\n ...(sb?.salt !== undefined && { salt: sb.salt }),\n });\n\n const renderOpts =\n sb?.unsafeDocumentWrite !== undefined\n ? { unsafeDocumentWrite: sb.unsafeDocumentWrite }\n : undefined;\n\n scf\n .renderHtml(liveContent.html, container, renderOpts)\n .then((rendered) => {\n if (cancelled) {\n rendered.dispose();\n return;\n }\n frame = rendered;\n\n const hostApi: SandboxHostApi = {\n setHeight: (height) => {\n if (\n typeof height === \"number\" &&\n Number.isFinite(height) &&\n height > 0\n ) {\n setContentHeight(height);\n }\n },\n };\n\n bridge = liveRef.current.createBridge(\n {\n iframe: rendered.iframe,\n origin: rendered.origin,\n sendMessage: rendered.sendMessage,\n },\n hostApi,\n );\n\n // Single owner of the window listener; the cross-origin guard runs\n // here so the bridge only sees frame-validated messages.\n onMessage = (event) => {\n if (!isSandboxFrameMessage(event, rendered)) return;\n bridge?.onMessage(event);\n };\n window.addEventListener(\"message\", onMessage);\n\n // renderHtml resolves at iframe load, which a shim that was never\n // served also reaches, so a completed render is only known once the\n // frame says so. render-timeout is excluded because the shim is\n // running and the guest may still paint, and reporting it would leave\n // a host that renders an error state showing one over a frame that\n // recovers.\n rendered.fullyLoadedPromiseWithTimeout(LOAD_TIMEOUT_MS).catch((err) => {\n if (cancelled) return;\n if (isShimLoadError(err) && err.code === \"render-timeout\") return;\n reportError(err);\n });\n })\n .catch((err) => {\n if (cancelled) return;\n frame?.dispose();\n frame = null;\n reportError(err);\n });\n\n return () => {\n cancelled = true;\n let cleanupFailed = false;\n let cleanupError: unknown;\n const runCleanup = (cleanup: () => void) => {\n try {\n cleanup();\n } catch (error) {\n if (cleanupFailed) {\n console.error(error);\n } else {\n cleanupFailed = true;\n cleanupError = error;\n }\n }\n };\n\n if (onMessage) {\n const listener = onMessage;\n onMessage = null;\n runCleanup(() => window.removeEventListener(\"message\", listener));\n }\n const bridgeToDispose = bridge;\n bridge = null;\n if (bridgeToDispose) runCleanup(() => bridgeToDispose.dispose());\n const frameToDispose = frame;\n frame = null;\n if (frameToDispose) runCleanup(() => frameToDispose.dispose());\n runCleanup(() => setContentHeight(undefined));\n\n if (cleanupFailed) throw cleanupError;\n };\n // oxlint-disable-next-line react/exhaustive-deps -- re-init only on contentKey change; live values flow through liveRef\n }, [contentKey]);\n\n const resolvedHeight =\n contentHeight != null ? Math.min(contentHeight, maxHeight) : undefined;\n const mergedStyle =\n resolvedHeight != null\n ? { ...sandbox?.style, height: resolvedHeight }\n : sandbox?.style;\n\n return (\n <div\n {...containerProps}\n ref={containerRef}\n className={sandbox?.className}\n style={mergedStyle}\n />\n );\n}\n"],"mappings":";;;;;;;AAiBA,MAAMY,kBAAkB;AACxB,MAAMC,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C,IAAIqC,eAAe,MAAMC;GAAa;EACvC;EAEFxC,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAA2C;CAAA,IAAA3C,EAAA,QAAAnB,YAAA;EAAE8D,KAAA,CAAC9D,UAAU;EAACmB,EAAA,MAAAnB;EAAAmB,EAAA,MAAA2C;CAAA,OAAAA,KAAA3C,EAAA;CA7HftD,UAAUiE,IA6HPgC,EAAY;CAEf,MAAAM,iBACE7C,iBAAiB,OAAO8C,KAAIC,IAAK/C,eAAetB,SAAqB,IAArEoB,KAAAA;CAAuE,IAAAkD;CAAA,IAAApD,EAAA,QAAAiD,kBAAAjD,EAAA,QAAAzC,SAAAM,OAAA;EAEvEuF,KAAAH,kBAAkB,OAAlB;GAAA,GACS1F,SAAOM;GAAOM,QAAU8E;EAChB,IAAb1F,SAAOM;EAAOmC,EAAA,MAAAiD;EAAAjD,EAAA,MAAAzC,SAAAM;EAAAmC,EAAA,MAAAoD;CAAA,OAAAA,KAAApD,EAAA;CAHpB,MAAAqD,cACED;CAQa,MAAAE,KAAA/F,SAAOK;CAAW,IAAA2F;CAAA,IAAAvD,EAAA,QAAAX,kBAAAW,EAAA,QAAAqD,eAAArD,EAAA,QAAAsD,IAAA;EAH/BC,KAAA,oBAAA,OAAA;GAKE,GAJIlE;GACCc,KAAAA;GACM,WAAAmD;GACJD,OAAAA;EAAW,CAAA;EAClBrD,EAAA,MAAAX;EAAAW,EAAA,MAAAqD;EAAArD,EAAA,MAAAsD;EAAAtD,EAAA,MAAAuD;CAAA,OAAAA,KAAAvD,EAAA;CAAA,OALFuD;AAKE"}
@@ -1 +1 @@
1
- {"version":3,"file":"useModelContextSnapshot.js","names":["c","_c","useEffect","useState","AssistantClient","Unsubscribe","ModelContextSnapshotSource","empty","T","read","aui","subscribe","onChange","isEqual","previous","next","useModelContextSnapshot","enabled","source","$","t0","snapshot","setSnapshot","t1","t2","shallowEqualRecords","Readonly","Record","keys","Object","length","every","key","hasOwn"],"sources":["../../src/unstable/useModelContextSnapshot.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport type { AssistantClient } from \"@assistant-ui/store\";\nimport type { Unsubscribe } from \"@assistant-ui/core\";\n\n/**\n * Where a snapshot comes from and what counts as a change to it. Declared once\n * per consumer at module scope: the subscription effect keys on this object, so\n * an inline source without an `isEqual` re-reads itself into a render loop.\n */\nexport type ModelContextSnapshotSource<T> = {\n /** Seeds the snapshot when it starts disabled. */\n readonly empty: T;\n /** Projects the fields the consumer observes out of the live model context. */\n read(aui: AssistantClient): T;\n subscribe(aui: AssistantClient, onChange: () => void): Unsubscribe;\n /**\n * An equal pair keeps the previous reference. Omitted by a consumer that\n * re-derives on every notification, where a caller republishing an unchanged\n * tool set is how it asks to be re-run.\n */\n isEqual?(previous: T, next: T): boolean;\n};\n\n/**\n * `getModelContext()` rebuilds its result on every call, so a projection of the\n * fields a consumer observes is held in state and refreshed on notification\n * rather than read during render. Keeping the previous reference for an equal\n * projection is what stops a notification carrying no observable change from\n * invalidating everything derived from it.\n */\nexport const useModelContextSnapshot = <T>(\n aui: AssistantClient,\n enabled: boolean,\n source: ModelContextSnapshotSource<T>,\n): T => {\n const [snapshot, setSnapshot] = useState(() =>\n enabled ? source.read(aui) : source.empty,\n );\n\n useEffect(() => {\n if (!enabled) return undefined;\n const read = () => {\n const next = source.read(aui);\n setSnapshot((previous) =>\n source.isEqual?.(previous, next) ? previous : next,\n );\n };\n read();\n return source.subscribe(aui, read);\n }, [aui, enabled, source]);\n\n return snapshot;\n};\n\n/** Shallow own-key comparison, for a projection whose values are records. */\nexport const shallowEqualRecords = (\n previous: Readonly<Record<string, unknown>>,\n next: Readonly<Record<string, unknown>>,\n): boolean => {\n const keys = Object.keys(previous);\n if (keys.length !== Object.keys(next).length) return false;\n return keys.every(\n (key) => Object.hasOwn(next, key) && previous[key] === next[key],\n );\n};\n"],"mappings":";;;;;;;;;;;AAgCA,MAAagB,2BAA0BN,KAAAO,SAAAC,WAAA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","useState","AssistantClient","Unsubscribe","ModelContextSnapshotSource","empty","T","read","aui","subscribe","onChange","isEqual","previous","next","useModelContextSnapshot","enabled","source","$","t0","snapshot","setSnapshot","t1","t2","shallowEqualRecords","Readonly","Record","keys","Object","length","every","key","hasOwn","_c"],"sources":["../../src/unstable/useModelContextSnapshot.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport type { AssistantClient } from \"@assistant-ui/store\";\nimport type { Unsubscribe } from \"@assistant-ui/core\";\n\n/**\n * Where a snapshot comes from and what counts as a change to it. Declared once\n * per consumer at module scope: the subscription effect keys on this object, so\n * an inline source without an `isEqual` re-reads itself into a render loop.\n */\nexport type ModelContextSnapshotSource<T> = {\n /** Seeds the snapshot when it starts disabled. */\n readonly empty: T;\n /** Projects the fields the consumer observes out of the live model context. */\n read(aui: AssistantClient): T;\n subscribe(aui: AssistantClient, onChange: () => void): Unsubscribe;\n /**\n * An equal pair keeps the previous reference. Omitted by a consumer that\n * re-derives on every notification, where a caller republishing an unchanged\n * tool set is how it asks to be re-run.\n */\n isEqual?(previous: T, next: T): boolean;\n};\n\n/**\n * `getModelContext()` rebuilds its result on every call, so a projection of the\n * fields a consumer observes is held in state and refreshed on notification\n * rather than read during render. Keeping the previous reference for an equal\n * projection is what stops a notification carrying no observable change from\n * invalidating everything derived from it.\n */\nexport const useModelContextSnapshot = <T>(\n aui: AssistantClient,\n enabled: boolean,\n source: ModelContextSnapshotSource<T>,\n): T => {\n const [snapshot, setSnapshot] = useState(() =>\n enabled ? source.read(aui) : source.empty,\n );\n\n useEffect(() => {\n if (!enabled) return undefined;\n const read = () => {\n const next = source.read(aui);\n setSnapshot((previous) =>\n source.isEqual?.(previous, next) ? previous : next,\n );\n };\n read();\n return source.subscribe(aui, read);\n }, [aui, enabled, source]);\n\n return snapshot;\n};\n\n/** Shallow own-key comparison, for a projection whose values are records. */\nexport const shallowEqualRecords = (\n previous: Readonly<Record<string, unknown>>,\n next: Readonly<Record<string, unknown>>,\n): boolean => {\n const keys = Object.keys(previous);\n if (keys.length !== Object.keys(next).length) return false;\n return keys.every(\n (key) => Object.hasOwn(next, key) && previous[key] === next[key],\n );\n};\n"],"mappings":";;;;;;;;;;;AAgCA,MAAagB,2BAA0BN,KAAAO,SAAAC,WAAA;CAAA,MAAAC,IAAAlB,EAAA,CAAA;CAAA,IAAAmB;CAAA,IAAAD,EAAA,OAAAT,OAAAS,EAAA,OAAAF,WAAAE,EAAA,OAAAD,QAAA;EAKIE,WACvCH,UAAUC,OAAMT,KAAMC,GAAkB,IAAXQ,OAAMX;EAAMY,EAAA,KAAAT;EAAAS,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAD3C,MAAA,CAAAE,UAAAC,eAAgCnB,SAASiB,EAEzC;CAAE,IAAAG;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAT,OAAAS,EAAA,OAAAF,WAAAE,EAAA,OAAAD,QAAA;EAEQK,WAAA;GACR,IAAI,CAACN,SAAO;GACZ,MAAAR,aAAa;IACX,MAAAM,OAAaG,OAAMT,KAAMC,GAAG;IAC5BY,aAAYR,aACVI,OAAML,UAAWC,UAAUC,IAAsB,IAAjDD,WAAAC,IACF;GAAC;GAEHN,KAAK;GAAC,OACCS,OAAMP,UAAWD,KAAKD,IAAI;EAAC;EACjCe,KAAA;GAACd;GAAKO;GAASC;EAAM;EAACC,EAAA,KAAAT;EAAAS,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAA;EAAAD,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;CAAA;CAVzBjB,UAAUqB,IAUPC,EAAsB;CAAC,OAEnBH;AAAQ;;AAIjB,MAAaI,uBACXX,UACAC,SACY;CACZ,MAAMa,OAAOC,OAAOD,KAAKd,QAAQ;CACjC,IAAIc,KAAKE,WAAWD,OAAOD,KAAKb,IAAI,CAAC,CAACe,QAAQ,OAAO;CACrD,OAAOF,KAAKG,OACTC,QAAQH,OAAOI,OAAOlB,MAAMiB,GAAG,KAAKlB,SAASkB,SAASjB,KAAKiB,IAC9D;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"WebMcpRegistrationResource.js","names":["useEffect","useRef","useState","resource","Tool","toWebMcpTool","WebMcpHost","WebMcpRegistrationProps","host","name","signature","tool","getCurrentTool","notPermitted","error","notPermittedMessage","useWebMcpRegistration","t0","$","_c","refused","setRefused","fallbackToolRef","t1","lifecycle","AbortController","live","dispose","refuse","message","console","warn","registerTool","current","signal","error_1","t2","abort","t3","WebMcpRegistrationResource"],"sources":["../../../src/unstable/webmcp/WebMcpRegistrationResource.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type { Tool } from \"assistant-stream\";\nimport { toWebMcpTool } from \"./convertTools\";\nimport type { WebMcpHost } from \"./webmcp-host\";\n\nexport type WebMcpRegistrationProps = {\n host: WebMcpHost;\n name: string;\n /** Re-registers when it changes; an execute-only edit reads through instead. */\n signature: string;\n tool: Tool<any, any>;\n getCurrentTool: (name: string) => Tool<any, any> | undefined;\n};\n\n// The explainer specifies NotAllowedError for a page whose tools permission is\n// off, which a cross-origin iframe without allow=\"tools\" reaches routinely. It\n// documents no rejection for a name already taken, so that stays a hedge.\nconst notPermitted = (error: unknown) =>\n (error as { name?: unknown } | null | undefined)?.name === \"NotAllowedError\";\n\nconst notPermittedMessage = (name: string) =>\n `[assistant-ui] WebMCP registration for tool \"${name}\" was not permitted; the page's tools permission is disabled.`;\n\nconst useWebMcpRegistration = ({\n host,\n name,\n signature,\n tool,\n getCurrentTool,\n}: WebMcpRegistrationProps): string | null => {\n // A refused name is remembered for as long as the tool stays in the model\n // context, so a permanent collision warns once rather than on every sync.\n const [refused, setRefused] = useState(false);\n const fallbackToolRef = useRef(tool);\n\n useEffect(() => {\n if (refused) return undefined;\n\n const lifecycle = new AbortController();\n let live = true;\n let dispose: (() => void) | undefined;\n\n const refuse = (message: string, error: unknown) => {\n if (!live) return;\n live = false;\n setRefused(true);\n console.warn(message, error);\n };\n\n try {\n dispose = host.registerTool(\n toWebMcpTool(\n name,\n () => getCurrentTool(name) ?? fallbackToolRef.current,\n lifecycle.signal,\n ),\n (error) =>\n refuse(\n notPermitted(error)\n ? notPermittedMessage(name)\n : `[assistant-ui] WebMCP registration for tool \"${name}\" failed (name may already be registered).`,\n error,\n ),\n );\n } catch (error) {\n refuse(\n notPermitted(error)\n ? notPermittedMessage(name)\n : `[assistant-ui] Skipping WebMCP registration for tool \"${name}\": registerTool failed (name may already be registered).`,\n error,\n );\n return undefined;\n }\n\n return () => {\n live = false;\n lifecycle.abort();\n try {\n dispose();\n } catch (error) {\n console.warn(\n `[assistant-ui] Unregistering WebMCP tool \"${name}\" failed.`,\n error,\n );\n }\n };\n }, [getCurrentTool, host, name, signature, refused]);\n\n return refused ? null : name;\n};\n\nexport const WebMcpRegistrationResource = resource(useWebMcpRegistration);\n"],"mappings":";;;;;AAkBA,MAAMa,gBAAgBC,UACnBA,OAAiDL,SAAS;AAE7D,MAAMM,uBAAuBN,SAC3B,gDAAgDA,KAAI;AAEtD,MAAMO,yBAAwBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAC,MAAA,EAAAX,MAAAC,MAAAC,WAAAC,MAAAC,mBAAAK;CAS7B,MAAA,CAAAG,SAAAC,cAA8BnB,SAAS,KAAK;CAC5C,MAAAoB,kBAAwBrB,OAAOU,IAAI;CAAE,IAAAY;CAAA,IAAAL,EAAA,OAAAN,kBAAAM,EAAA,OAAAV,QAAAU,EAAA,OAAAT,QAAAS,EAAA,OAAAE,SAAA;EAE3BG,WAAA;GACR,IAAIH,SAAO;GAEX,MAAAI,YAAkB,IAAIC,gBAAgB;GACtC,IAAAC,OAAW;GACPC,IAAAA;GAEJ,MAAAC,UAAeC,SAAAf,UAAA;IACb,IAAI,CAACY,MAAI;IACTA,OAAO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Tool","WebMcpHost","WebMcpRegistrationProps","host","name","signature","tool","getCurrentTool","notPermitted","error","notPermittedMessage","useWebMcpRegistration","t0","$","_c","refused","setRefused","fallbackToolRef","t1","lifecycle","AbortController","live","dispose","refuse","message","console","warn","registerTool","current","signal","error_1","t2","abort","t3","WebMcpRegistrationResource","_c"],"sources":["../../../src/unstable/webmcp/WebMcpRegistrationResource.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type { Tool } from \"assistant-stream\";\nimport { toWebMcpTool } from \"./convertTools\";\nimport type { WebMcpHost } from \"./webmcp-host\";\n\nexport type WebMcpRegistrationProps = {\n host: WebMcpHost;\n name: string;\n /** Re-registers when it changes; an execute-only edit reads through instead. */\n signature: string;\n tool: Tool<any, any>;\n getCurrentTool: (name: string) => Tool<any, any> | undefined;\n};\n\n// The explainer specifies NotAllowedError for a page whose tools permission is\n// off, which a cross-origin iframe without allow=\"tools\" reaches routinely. It\n// documents no rejection for a name already taken, so that stays a hedge.\nconst notPermitted = (error: unknown) =>\n (error as { name?: unknown } | null | undefined)?.name === \"NotAllowedError\";\n\nconst notPermittedMessage = (name: string) =>\n `[assistant-ui] WebMCP registration for tool \"${name}\" was not permitted; the page's tools permission is disabled.`;\n\nconst useWebMcpRegistration = ({\n host,\n name,\n signature,\n tool,\n getCurrentTool,\n}: WebMcpRegistrationProps): string | null => {\n // A refused name is remembered for as long as the tool stays in the model\n // context, so a permanent collision warns once rather than on every sync.\n const [refused, setRefused] = useState(false);\n const fallbackToolRef = useRef(tool);\n\n useEffect(() => {\n if (refused) return undefined;\n\n const lifecycle = new AbortController();\n let live = true;\n let dispose: (() => void) | undefined;\n\n const refuse = (message: string, error: unknown) => {\n if (!live) return;\n live = false;\n setRefused(true);\n console.warn(message, error);\n };\n\n try {\n dispose = host.registerTool(\n toWebMcpTool(\n name,\n () => getCurrentTool(name) ?? fallbackToolRef.current,\n lifecycle.signal,\n ),\n (error) =>\n refuse(\n notPermitted(error)\n ? notPermittedMessage(name)\n : `[assistant-ui] WebMCP registration for tool \"${name}\" failed (name may already be registered).`,\n error,\n ),\n );\n } catch (error) {\n refuse(\n notPermitted(error)\n ? notPermittedMessage(name)\n : `[assistant-ui] Skipping WebMCP registration for tool \"${name}\": registerTool failed (name may already be registered).`,\n error,\n );\n return undefined;\n }\n\n return () => {\n live = false;\n lifecycle.abort();\n try {\n dispose();\n } catch (error) {\n console.warn(\n `[assistant-ui] Unregistering WebMCP tool \"${name}\" failed.`,\n error,\n );\n }\n };\n }, [getCurrentTool, host, name, signature, refused]);\n\n return refused ? null : name;\n};\n\nexport const WebMcpRegistrationResource = resource(useWebMcpRegistration);\n"],"mappings":";;;;;AAkBA,MAAMa,gBAAgBC,UACnBA,OAAiDL,SAAS;AAE7D,MAAMM,uBAAuBN,SAC3B,gDAAgDA,KAAI;AAEtD,MAAMO,yBAAwBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAC,MAAA,EAAAX,MAAAC,MAAAC,WAAAC,MAAAC,mBAAAK;CAS7B,MAAA,CAAAG,SAAAC,cAA8BnB,SAAS,KAAK;CAC5C,MAAAoB,kBAAwBrB,OAAOU,IAAI;CAAE,IAAAY;CAAA,IAAAL,EAAA,OAAAN,kBAAAM,EAAA,OAAAV,QAAAU,EAAA,OAAAT,QAAAS,EAAA,OAAAE,SAAA;EAE3BG,WAAA;GACR,IAAIH,SAAO;GAEX,MAAAI,YAAkB,IAAIC,gBAAgB;GACtC,IAAAC,OAAW;GACPC,IAAAA;GAEJ,MAAAC,UAAeC,SAAAf,UAAA;IACb,IAAI,CAACY,MAAI;IACTA,OAAOA;IACPL,WAAW,IAAI;IACfS,QAAOC,KAAMF,SAASf,KAAK;GAAC;GAG9B,IAAA;IACEa,UAAUnB,KAAIwB,aACZ3B,aACEI,YACMG,eAAeH,IAA+B,KAAtBa,gBAAeW,SAC7CT,UAASU,MACX,IACAC,YACEP,OACEf,aAAaC,OAEsF,IAD/FC,oBAAoBN,IAC2E,IAFnG,gDAEoDA,KAAI,6CACxDK,OACF,CACJ;GAbO,SAAAsB,IAAA;IAcAtB,MAAAA,UAAAA;IACPc,OACEf,aAAaC,OAE6G,IADtHC,oBAAoBN,IACkG,IAF1H,yDAE6DA,KAAI,2DACjEK,OACF;IAAC;GAAA;GAEF,aAEM;IACLY,OAAOA;IACPF,UAASa,MAAO;IAChB,IAAA;KACEV,QAAQ;IAAC,SAAAW,IAAA;KACFxB,MAAAA,UAAAA;KACPgB,QAAOC,KACL,6CAA6CtB,KAAI,YACjDK,OACF;IAAC;GACF;EACF;EACFI,EAAA,KAAAN;EAAAM,EAAA,KAAAV;EAAAU,EAAA,KAAAT;EAAAS,EAAA,KAAAE;EAAAF,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAkB;CAAA,IAAAlB,EAAA,OAAAN,kBAAAM,EAAA,OAAAV,QAAAU,EAAA,OAAAT,QAAAS,EAAA,OAAAE,WAAAF,EAAA,OAAAR,WAAA;EAAE0B,KAAA;GAACxB;GAAgBJ;GAAMC;GAAMC;GAAWU;EAAO;EAACF,EAAA,KAAAN;EAAAM,EAAA,KAAAV;EAAAU,EAAA,KAAAT;EAAAS,EAAA,KAAAE;EAAAF,EAAA,KAAAR;EAAAQ,EAAA,MAAAkB;CAAA,OAAAA,KAAAlB,EAAA;CAnDnDlB,UAAUuB,IAmDPa,EAAgD;CAAC,OAE7ChB,UAAA,OAAAX;AAAqB;AAG9B,MAAa8B,6BAA6BpC,SAASa,qBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useWebMcpProvider.js","names":["c","_c","useCallback","useEffect","useInsertionEffect","useRef","useState","useSyncExternalStore","useResources","useTapRoot","withKey","useAui","Tool","getDefaultWebMcpHost","WebMcpHost","defaultWebMcpFilter","toWebMcpInputSchema","WebMcpRegistrationResource","shallowEqual","useModelContextSnapshot","ModelContextSnapshotSource","Unstable_WebMcpProviderOptions","filter","name","tool","Unstable_WebMcpProviderResult","status","registeredToolNames","EMPTY_NAMES","Object","freeze","EMPTY_TOOLS","Record","warned","WeakSet","signatures","WeakMap","description","signature","signatureOf","cached","get","JSON","stringify","set","NO_SUBSCRIPTION","modelContextToolSource","empty","read","aui","modelContext","getModelContext","tools","subscribe","onChange","useStableNames","names","cell","next","sort","previous","useWebMcpRegistry","t0","$","host","getCurrentTool","elements","entries","push","t1","error","has","add","console","warn","unstable_useWebMcpProvider","options","available","currentToolsRef","current","root","WebMcpProviderRoot","getValue","published","setPublished"],"sources":["../../../src/unstable/webmcp/useWebMcpProvider.ts"],"sourcesContent":["\"use client\";\n\nimport {\n useCallback,\n useEffect,\n useInsertionEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport { useResources, useTapRoot, withKey } from \"@assistant-ui/tap\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { Tool } from \"assistant-stream\";\nimport { getDefaultWebMcpHost, type WebMcpHost } from \"./webmcp-host\";\nimport { defaultWebMcpFilter, toWebMcpInputSchema } from \"./convertTools\";\nimport { WebMcpRegistrationResource } from \"./WebMcpRegistrationResource\";\nimport { shallowEqual } from \"@assistant-ui/store/internal\";\nimport {\n useModelContextSnapshot,\n type ModelContextSnapshotSource,\n} from \"../useModelContextSnapshot\";\n\nexport type Unstable_WebMcpProviderOptions = {\n filter?: (name: string, tool: Tool<any, any>) => boolean;\n};\n\nexport type Unstable_WebMcpProviderResult = {\n status: \"unsupported\" | \"active\";\n registeredToolNames: readonly string[];\n};\n\nconst EMPTY_NAMES: readonly string[] = Object.freeze([]);\nconst EMPTY_TOOLS: Record<string, Tool<any, any>> = Object.freeze({});\n\n// The description is re-read on every sync so mutating it in place is\n// observed; the schema is converted only when the tool object itself changes.\n// Keyed on the tool so a schema or filter that throws warns once instead of\n// on every model-context notify.\nconst warned = new WeakSet<Tool<any, any>>();\n\nconst signatures = new WeakMap<\n Tool<any, any>,\n { description: string | undefined; signature: string }\n>();\n\nconst signatureOf = (tool: Tool<any, any>) => {\n const cached = signatures.get(tool);\n if (cached && cached.description === tool.description)\n return cached.signature;\n const signature = `${tool.description ?? \"\"}\\u0000${JSON.stringify(\n toWebMcpInputSchema(tool),\n )}`;\n signatures.set(tool, { description: tool.description, signature });\n return signature;\n};\n\nconst NO_SUBSCRIPTION = () => {};\n\n// No `isEqual`: a caller republishing an unchanged tool set is how it asks for\n// a re-sync, which is what re-attempts a tool whose filter has stopped throwing\n// and what picks up a description edited in place on a stable tool object.\nconst modelContextToolSource: ModelContextSnapshotSource<\n Record<string, Tool<any, any>>\n> = {\n empty: EMPTY_TOOLS,\n read: (aui) => aui.modelContext.getModelContext().tools ?? EMPTY_TOOLS,\n subscribe: (aui, onChange) =>\n aui.modelContext.subscribe?.(onChange) ?? NO_SUBSCRIPTION,\n};\n\nconst useStableNames = (names: readonly (string | null)[]) => {\n const [cell] = useState(() => ({ names: EMPTY_NAMES }));\n const next = names.filter((name): name is string => name !== null).sort();\n const previous = cell.names;\n if (shallowEqual(previous, next)) {\n return previous;\n }\n cell.names = next;\n return next;\n};\n\nconst useWebMcpRegistry = ({\n host,\n filter,\n tools,\n getCurrentTool,\n}: {\n host: WebMcpHost;\n filter: (name: string, tool: Tool<any, any>) => boolean;\n tools: Record<string, Tool<any, any>>;\n getCurrentTool: (name: string) => Tool<any, any> | undefined;\n}) => {\n const elements = [];\n for (const [name, tool] of Object.entries(tools)) {\n try {\n if (!filter(name, tool)) continue;\n const signature = signatureOf(tool);\n elements.push(\n withKey(\n name,\n WebMcpRegistrationResource({\n host,\n name,\n signature,\n tool,\n getCurrentTool,\n }),\n [host, name, signature, tool, getCurrentTool],\n ),\n );\n } catch (error) {\n if (warned.has(tool)) continue;\n warned.add(tool);\n console.warn(\n `[assistant-ui] Skipping WebMCP registration for tool \"${name}\": filter or schema conversion failed.`,\n error,\n );\n }\n }\n\n return useStableNames(useResources(elements));\n};\n\n/**\n * Publishes the frontend tools in the model context to a WebMCP-capable\n * browser, so the user's own browser agent can call them.\n *\n * Returns `status: \"unsupported\"` when the page exposes no\n * `document.modelContext` (or `navigator.modelContext`), and the sorted names\n * of the tools currently registered with the host.\n */\nexport const unstable_useWebMcpProvider = (\n options: Unstable_WebMcpProviderOptions = {},\n): Unstable_WebMcpProviderResult => {\n const aui = useAui();\n const [host] = useState(getDefaultWebMcpHost);\n const filter = options.filter ?? defaultWebMcpFilter;\n const tools = useModelContextSnapshot(\n aui,\n host.available,\n modelContextToolSource,\n );\n const currentToolsRef = useRef(tools);\n useInsertionEffect(() => {\n currentToolsRef.current = tools;\n }, [tools]);\n const getCurrentTool = useCallback(\n (name: string) => currentToolsRef.current[name],\n [],\n );\n\n const root = useTapRoot(function WebMcpProviderRoot() {\n return useWebMcpRegistry({\n host,\n filter,\n tools,\n getCurrentTool,\n });\n });\n const registeredToolNames = useSyncExternalStore(\n root.subscribe,\n root.getValue,\n () => EMPTY_NAMES,\n );\n\n const [published, setPublished] = useState(false);\n useEffect(() => {\n if (host.available) setPublished(true);\n }, [host]);\n\n return {\n status: published ? \"active\" : \"unsupported\",\n registeredToolNames,\n };\n};\n"],"mappings":";;;;;;;;;;;AA+BA,MAAM4B,cAAiCC,OAAOC,OAAO,CAAA,CAAE;AACvD,MAAMC,cAA8CF,OAAOC,OAAO,CAAC,CAAC;AAMpE,MAAMG,yBAAS,IAAIC,QAAwB;AAE3C,MAAMC,6BAAa,IAAIC,QAGrB;AAEF,MAAMG,eAAef,SAAyB;CAC5C,MAAMgB,SAASL,WAAWM,IAAIjB,IAAI;CAClC,IAAIgB,UAAUA,OAAOH,gBAAgBb,KAAKa,aACxC,OAAOG,OAAOF;CAChB,MAAMA,YAAY,GAAGd,KAAKa,eAAe,GAAE,QAASK,KAAKC,UACvD3B,oBAAoBQ,IAAI,CAC1B;CACAW,WAAWS,IAAIpB,MAAM;EAAEa,aAAab,KAAKa;EAAaC;CAAU,CAAC;CACjE,OAAOA;AACT;AAEA,MAAMO,wBAAwB,CAAC;AAK/B,MAAMC,yBAEF;CACFC,OAAOhB;C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AAX;EAAAW,EAAA,KAAAG;CAAA,OAAAA,WAAAH,EAAA;CAAA,OAEMR,eAAe/C,aAAa0D,QAAQ,CAAC;AAAC;;;;;;;;;AAW/C,MAAaS,8BACXC,UAA0C,CAAC,MACT;CAClC,MAAM3B,MAAMtC,OAAO;CACnB,MAAM,CAACqD,QAAQ1D,SAASO,oBAAoB;CAC5C,MAAMS,SAASsD,QAAQtD,UAAUP;CACjC,MAAMqC,QAAQjC,wBACZ8B,KACAe,KAAKa,WACL/B,sBACF;CACA,MAAMgC,kBAAkBzE,OAAO+C,KAAK;CACpChD,yBAAyB;EACvB0E,gBAAgBC,UAAU3B;CAC5B,GAAG,CAACA,KAAK,CAAC;CACV,MAAMa,iBAAiB/D,aACpBqB,SAAiBuD,gBAAgBC,QAAQxD,OAC1C,CAAA,CACF;CAEA,MAAMyD,OAAOvE,WAAW,SAASwE,qBAAqB;EACpD,OAAOpB,kBAAkB;GACvBG;GACA1C;GACA8B;GACAa;EACF,CAAC;CACH,CAAC;CACD,MAAMtC,sBAAsBpB,qBAC1ByE,KAAK3B,WACL2B,KAAKE,gBACCtD,WACR;CAEA,MAAM,CAACuD,WAAWC,gBAAgB9E,SAAS,KAAK;CAChDH,gBAAgB;EACd,IAAI6D,KAAKa,WAAWO,aAAa,IAAI;CACvC,GAAG,CAACpB,IAAI,CAAC;CAET,OAAO;EACLtC,QAAQyD,YAAY,WAAW;EAC/BxD;CACF;AACF"}
1
+ {"version":3,"file":"useWebMcpProvider.js","names":["c","_c","useCallback","useEffect","useInsertionEffect","useRef","useState","useSyncExternalStore","useResources","useTapRoot","withKey","useAui","Tool","getDefaultWebMcpHost","WebMcpHost","defaultWebMcpFilter","toWebMcpInputSchema","WebMcpRegistrationResource","shallowEqual","useModelContextSnapshot","ModelContextSnapshotSource","Unstable_WebMcpProviderOptions","filter","name","tool","Unstable_WebMcpProviderResult","status","registeredToolNames","EMPTY_NAMES","Object","freeze","EMPTY_TOOLS","Record","warned","WeakSet","signatures","WeakMap","description","signature","signatureOf","cached","get","JSON","stringify","set","NO_SUBSCRIPTION","modelContextToolSource","empty","read","aui","modelContext","getModelContext","tools","subscribe","onChange","useStableNames","names","cell","next","sort","previous","useWebMcpRegistry","t0","$","host","getCurrentTool","elements","entries","push","t1","error","has","add","console","warn","unstable_useWebMcpProvider","options","available","currentToolsRef","current","root","WebMcpProviderRoot","getValue","published","setPublished","_c"],"sources":["../../../src/unstable/webmcp/useWebMcpProvider.ts"],"sourcesContent":["\"use client\";\n\nimport {\n useCallback,\n useEffect,\n useInsertionEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport { useResources, useTapRoot, withKey } from \"@assistant-ui/tap\";\nimport { useAui } from \"@assistant-ui/store\";\nimport type { Tool } from \"assistant-stream\";\nimport { getDefaultWebMcpHost, type WebMcpHost } from \"./webmcp-host\";\nimport { defaultWebMcpFilter, toWebMcpInputSchema } from \"./convertTools\";\nimport { WebMcpRegistrationResource } from \"./WebMcpRegistrationResource\";\nimport { shallowEqual } from \"@assistant-ui/store/internal\";\nimport {\n useModelContextSnapshot,\n type ModelContextSnapshotSource,\n} from \"../useModelContextSnapshot\";\n\nexport type Unstable_WebMcpProviderOptions = {\n filter?: (name: string, tool: Tool<any, any>) => boolean;\n};\n\nexport type Unstable_WebMcpProviderResult = {\n status: \"unsupported\" | \"active\";\n registeredToolNames: readonly string[];\n};\n\nconst EMPTY_NAMES: readonly string[] = Object.freeze([]);\nconst EMPTY_TOOLS: Record<string, Tool<any, any>> = Object.freeze({});\n\n// The description is re-read on every sync so mutating it in place is\n// observed; the schema is converted only when the tool object itself changes.\n// Keyed on the tool so a schema or filter that throws warns once instead of\n// on every model-context notify.\nconst warned = new WeakSet<Tool<any, any>>();\n\nconst signatures = new WeakMap<\n Tool<any, any>,\n { description: string | undefined; signature: string }\n>();\n\nconst signatureOf = (tool: Tool<any, any>) => {\n const cached = signatures.get(tool);\n if (cached && cached.description === tool.description)\n return cached.signature;\n const signature = `${tool.description ?? \"\"}\\u0000${JSON.stringify(\n toWebMcpInputSchema(tool),\n )}`;\n signatures.set(tool, { description: tool.description, signature });\n return signature;\n};\n\nconst NO_SUBSCRIPTION = () => {};\n\n// No `isEqual`: a caller republishing an unchanged tool set is how it asks for\n// a re-sync, which is what re-attempts a tool whose filter has stopped throwing\n// and what picks up a description edited in place on a stable tool object.\nconst modelContextToolSource: ModelContextSnapshotSource<\n Record<string, Tool<any, any>>\n> = {\n empty: EMPTY_TOOLS,\n read: (aui) => aui.modelContext.getModelContext().tools ?? EMPTY_TOOLS,\n subscribe: (aui, onChange) =>\n aui.modelContext.subscribe?.(onChange) ?? NO_SUBSCRIPTION,\n};\n\nconst useStableNames = (names: readonly (string | null)[]) => {\n const [cell] = useState(() => ({ names: EMPTY_NAMES }));\n const next = names.filter((name): name is string => name !== null).sort();\n const previous = cell.names;\n if (shallowEqual(previous, next)) {\n return previous;\n }\n cell.names = next;\n return next;\n};\n\nconst useWebMcpRegistry = ({\n host,\n filter,\n tools,\n getCurrentTool,\n}: {\n host: WebMcpHost;\n filter: (name: string, tool: Tool<any, any>) => boolean;\n tools: Record<string, Tool<any, any>>;\n getCurrentTool: (name: string) => Tool<any, any> | undefined;\n}) => {\n const elements = [];\n for (const [name, tool] of Object.entries(tools)) {\n try {\n if (!filter(name, tool)) continue;\n const signature = signatureOf(tool);\n elements.push(\n withKey(\n name,\n WebMcpRegistrationResource({\n host,\n name,\n signature,\n tool,\n getCurrentTool,\n }),\n [host, name, signature, tool, getCurrentTool],\n ),\n );\n } catch (error) {\n if (warned.has(tool)) continue;\n warned.add(tool);\n console.warn(\n `[assistant-ui] Skipping WebMCP registration for tool \"${name}\": filter or schema conversion failed.`,\n error,\n );\n }\n }\n\n return useStableNames(useResources(elements));\n};\n\n/**\n * Publishes the frontend tools in the model context to a WebMCP-capable\n * browser, so the user's own browser agent can call them.\n *\n * Returns `status: \"unsupported\"` when the page exposes no\n * `document.modelContext` (or `navigator.modelContext`), and the sorted names\n * of the tools currently registered with the host.\n */\nexport const unstable_useWebMcpProvider = (\n options: Unstable_WebMcpProviderOptions = {},\n): Unstable_WebMcpProviderResult => {\n const aui = useAui();\n const [host] = useState(getDefaultWebMcpHost);\n const filter = options.filter ?? defaultWebMcpFilter;\n const tools = useModelContextSnapshot(\n aui,\n host.available,\n modelContextToolSource,\n );\n const currentToolsRef = useRef(tools);\n useInsertionEffect(() => {\n currentToolsRef.current = tools;\n }, [tools]);\n const getCurrentTool = useCallback(\n (name: string) => currentToolsRef.current[name],\n [],\n );\n\n const root = useTapRoot(function WebMcpProviderRoot() {\n return useWebMcpRegistry({\n host,\n filter,\n tools,\n getCurrentTool,\n });\n });\n const registeredToolNames = useSyncExternalStore(\n root.subscribe,\n root.getValue,\n () => EMPTY_NAMES,\n );\n\n const [published, setPublished] = useState(false);\n useEffect(() => {\n if (host.available) setPublished(true);\n }, [host]);\n\n return {\n status: published ? \"active\" : \"unsupported\",\n registeredToolNames,\n };\n};\n"],"mappings":";;;;;;;;;;;AA+BA,MAAM4B,cAAiCC,OAAOC,OAAO,CAAA,CAAE;AACvD,MAAMC,cAA8CF,OAAOC,OAAO,CAAC,CAAC;AAMpE,MAAMG,yBAAS,IAAIC,QAAwB;AAE3C,MAAMC,6BAAa,IAAIC,QAGrB;AAEF,MAAMG,eAAef,SAAyB;CAC5C,MAAMgB,SAASL,WAAWM,IAAIjB,IAAI;CAClC,IAAIgB,UAAUA,OAAOH,gBAAgBb,KAAKa,aACxC,OAAOG,OAAOF;CAChB,MAAMA,YAAY,GAAGd,KAAKa,eAAe,GAAE,QAASK,KAAKC,UACvD3B,oBAAoBQ,IAAI,CAC1B;CACAW,WAAWS,IAAIpB,MAAM;EAAEa,aAAab,KAAKa;EAAaC;CAAU,CAAC;CACjE,OAAOA;AACT;AAEA,MAAMO,wBAAwB,CAAC;AAK/B,MAAMC,yBAEF;CACFC,OAAOhB;CACPiB,OAAOC,QAAQA,IAAIC,aAAaC,gBAAgB,CAAC,CAACC,SAASrB;CAC3DsB,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,aAAa0D,QAAQ,CAAC;AAAC;;;;;;;;;AAW/C,MAAaS,8BACXC,UAA0C,CAAC,MACT;CAClC,MAAM3B,MAAMtC,OAAO;CACnB,MAAM,CAACqD,QAAQ1D,SAASO,oBAAoB;CAC5C,MAAMS,SAASsD,QAAQtD,UAAUP;CACjC,MAAMqC,QAAQjC,wBACZ8B,KACAe,KAAKa,WACL/B,sBACF;CACA,MAAMgC,kBAAkBzE,OAAO+C,KAAK;CACpChD,yBAAyB;EACvB0E,gBAAgBC,UAAU3B;CAC5B,GAAG,CAACA,KAAK,CAAC;CACV,MAAMa,iBAAiB/D,aACpBqB,SAAiBuD,gBAAgBC,QAAQxD,OAC1C,CAAA,CACF;CAEA,MAAMyD,OAAOvE,WAAW,SAASwE,qBAAqB;EACpD,OAAOpB,kBAAkB;GACvBG;GACA1C;GACA8B;GACAa;EACF,CAAC;CACH,CAAC;CACD,MAAMtC,sBAAsBpB,qBAC1ByE,KAAK3B,WACL2B,KAAKE,gBACCtD,WACR;CAEA,MAAM,CAACuD,WAAWC,gBAAgB9E,SAAS,KAAK;CAChDH,gBAAgB;EACd,IAAI6D,KAAKa,WAAWO,aAAa,IAAI;CACvC,GAAG,CAACpB,IAAI,CAAC;CAET,OAAO;EACLtC,QAAQyD,YAAY,WAAW;EAC/BxD;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Primitive.js","names":["ComponentProps","ComponentPropsWithoutRef","ComponentRef","ElementType","ForwardRefExoticComponent","PropsWithoutRef","ReactElement","ReactNode","RefAttributes","cloneElement","forwardRef","isValidElement","Primitive","RadixPrimitive","Slot","NODES","const","PrimitiveNode","WithRenderPropProps","T","render","PrimitiveProps","E","WithRenderPropRuntimeProps","asChild","children","PrimitiveRef","composeRenderElement","undefined","props","renderSlot","Root","withRenderProp","Component","Wrapped","t0","ref","$","_c","rest","Comp","t1","t2","t3","componentName","displayName","name","createPrimitive","node","RadixComp","reduce","acc","ReturnType","K"],"sources":["../../src/utils/Primitive.tsx"],"sourcesContent":["import {\n type ComponentProps,\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/internal\";\nimport { Slot } from \"radix-ui\";\n\n/**\n * Thin wrapper around Radix `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\n/**\n * Composes the children of a `render` element. Outer children win when supplied;\n * the render element's own children are the fallback.\n */\nfunction composeRenderElement(\n render: ReactElement,\n children: ReactNode,\n): ReactElement {\n return cloneElement(\n render,\n undefined,\n children !== undefined\n ? children\n : (render.props as { children?: ReactNode }).children,\n );\n}\n\n/**\n * Composes a `render` element at a call site that has already computed its props.\n *\n * `withRenderProp` wraps a component; this covers the case where the props are\n * already in hand and the composition happens inline.\n */\nfunction renderSlot(\n render: ReactElement,\n children: ReactNode,\n props: ComponentProps<typeof Slot.Root>,\n): ReactElement {\n return (\n <Slot.Root {...props}>{composeRenderElement(render, children)}</Slot.Root>\n );\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 return (\n <Comp {...(rest as any)} asChild ref={ref}>\n {composeRenderElement(render, children)}\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, renderSlot, withRenderProp };\nexport type { PrimitiveProps, WithRenderPropProps };\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,MAAMe,QAAQ;CACZ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAI;;;;;AA2BN,SAASY,qBACPP,QACAK,UACc;CACd,OAAOhB,aACLW,QACAQ,KAAAA,GACAH,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EAKE,MAAAF,KAAAF;EAAW,IAAAG;EAAA,IAAAL,EAAA,QAAAb,WAAAa,EAAA,QAAAZ,YAAAY,EAAA,QAAAD,OAAAC,EAAA,QAAAI,IAAA;GAAtBC,KAAA,oBAAC,MAAD;IAAK,GAAMD;IAAuBjB;IAAcY;IAC7CX;GADE,CAAA;GAEEY,EAAA,MAAAb;GAAAa,EAAA,MAAAZ;GAAAY,EAAA,MAAAD;GAAAC,EAAA,MAAAI;GAAAJ,EAAA,MAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OAFPK;CAEO,CAGb;CAMAR,QAAQW,cAHN,OAAOZ,cAAc,WACjBA,YACCA,UAAUY,eAAeZ,UAAUa,QAAQ;CAGlD,OAAOZ;AAGT;AAEA,SAASa,gBAAyCC,MAAS;CACzD,MAAMC,YAAYpC,YAAemC;CACjC,MAAMf,YAAYD,eAAeiB,SAAS;CAE1ChB,UAAUY,cAAc,aAAaG;CACrC,OAAOf;AAGT;AAEA,MAAMrB,YAAYG,MAAMmC,QACrBC,KAAKH,SAAS;CACbG,IAAIH,QAAQD,gBAAgBC,IAAI;CAChC,OAAOG;AACT,GACA,CAAC,CAGH"}
1
+ {"version":3,"file":"Primitive.js","names":["ComponentProps","ComponentPropsWithoutRef","ComponentRef","ElementType","ForwardRefExoticComponent","PropsWithoutRef","ReactElement","ReactNode","RefAttributes","cloneElement","forwardRef","isValidElement","Primitive","RadixPrimitive","Slot","NODES","const","PrimitiveNode","WithRenderPropProps","T","render","PrimitiveProps","E","WithRenderPropRuntimeProps","asChild","children","PrimitiveRef","composeRenderElement","undefined","props","renderSlot","Root","withRenderProp","Component","Wrapped","t0","ref","$","_c","rest","Comp","t1","t2","t3","componentName","displayName","name","createPrimitive","node","RadixComp","reduce","acc","ReturnType","K","_c","RadixPrimitive"],"sources":["../../src/utils/Primitive.tsx"],"sourcesContent":["import {\n type ComponentProps,\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/internal\";\nimport { Slot } from \"radix-ui\";\n\n/**\n * Thin wrapper around Radix `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\n/**\n * Composes the children of a `render` element. Outer children win when supplied;\n * the render element's own children are the fallback.\n */\nfunction composeRenderElement(\n render: ReactElement,\n children: ReactNode,\n): ReactElement {\n return cloneElement(\n render,\n undefined,\n children !== undefined\n ? children\n : (render.props as { children?: ReactNode }).children,\n );\n}\n\n/**\n * Composes a `render` element at a call site that has already computed its props.\n *\n * `withRenderProp` wraps a component; this covers the case where the props are\n * already in hand and the composition happens inline.\n */\nfunction renderSlot(\n render: ReactElement,\n children: ReactNode,\n props: ComponentProps<typeof Slot.Root>,\n): ReactElement {\n return (\n <Slot.Root {...props}>{composeRenderElement(render, children)}</Slot.Root>\n );\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 return (\n <Comp {...(rest as any)} asChild ref={ref}>\n {composeRenderElement(render, children)}\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, renderSlot, withRenderProp };\nexport type { PrimitiveProps, WithRenderPropProps };\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,MAAMe,QAAQ;CACZ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAI;;;;;AA2BN,SAASY,qBACPP,QACAK,UACc;CACd,OAAOhB,aACLW,QACAQ,KAAAA,GACAH,aAAaG,KAAAA,IACTH,WACCL,OAAOS,MAAmCJ,QACjD;AACF;;;;;;;AAQA,SAASK,WACPV,QACAK,UACAI,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