@mcp-b/react-components 0.58.0 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{EmployeeChrome-DsdIek0l.d.ts → EmployeeChrome-QSki0QT4.d.ts} +4 -4
- package/dist/{ResponsiveSidebarShell-DoZlSP30.d.ts → ResponsiveSidebarShell-DzBGlRJF.d.ts} +23 -8
- package/dist/{ThinkChatActivity-BkGjTY4r.d.ts → ThinkChatActivity-C4_hPEmb.d.ts} +20 -4
- package/dist/{ThinkChatActivitySummary-DZVy3uQV.d.ts → ThinkChatActivitySummary-ChJ8Iu2T.d.ts} +3 -3
- package/dist/{ThinkChatToolParts-BucHi63O.d.ts → ThinkChatToolParts-BrntWlpa.d.ts} +29 -3
- package/dist/{WorkspaceConceptPanel-97ZyVpZI.js → WorkspaceConceptPanel-D21iRsWm.js} +7 -4
- package/dist/{WorkspaceFileView-M2jC2P4p.js → WorkspaceFileView-CsWwQA1U.js} +80 -74
- package/dist/app-bar-outlet-CNfNzY4Y.js +6 -0
- package/dist/components/agents-sdk/AgentEvent.js +2 -2
- package/dist/components/agents-sdk/BrowserLiveScreen.js +49 -11
- package/dist/components/agents-sdk/EmployeeApp.d.ts +2 -3
- package/dist/components/agents-sdk/EmployeeApp.js +4 -4
- package/dist/components/agents-sdk/EmployeeChat.js +1 -1
- package/dist/components/agents-sdk/EmployeeChrome.d.ts +1 -1
- package/dist/components/agents-sdk/EmployeeChrome.js +213 -201
- package/dist/components/agents-sdk/EmployeeSchedules.d.ts +1 -1
- package/dist/components/agents-sdk/EmployeeSchedules.js +6 -6
- package/dist/components/agents-sdk/EmployeeStartScreen.d.ts +1 -1
- package/dist/components/agents-sdk/ManagerOfficeScreens.d.ts +1 -1
- package/dist/components/agents-sdk/ManagerOfficeScreens.js +5 -18
- package/dist/components/agents-sdk/ModelSelector.js +1 -1
- package/dist/components/agents-sdk/SubagentRunPanel.d.ts +8 -9
- package/dist/components/agents-sdk/SubagentRunPanel.js +133 -122
- package/dist/components/agents-sdk/ThinkChat.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChat.js +26 -3
- package/dist/components/agents-sdk/ThinkChatActivity.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChatActivity.js +110 -110
- package/dist/components/agents-sdk/ThinkChatActivitySummary.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChatActivitySummary.js +183 -40
- package/dist/components/agents-sdk/ThinkChatToolPanels.d.ts +8 -4
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +308 -62
- package/dist/components/agents-sdk/ThinkChatToolParts.d.ts +2 -2
- package/dist/components/agents-sdk/ThinkChatToolParts.js +71 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.d.ts +3 -4
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +5 -5
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkFullApp.js +6 -1
- package/dist/components/agents-sdk/ThinkRoutineActions.js +14 -22
- package/dist/components/agents-sdk/ThinkThreadPicker.js +1 -1
- package/dist/components/agents-sdk/WorkspaceExecution.js +138 -131
- package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -3
- package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
- package/dist/components/agents-sdk/WorkspaceHeader.js +26 -28
- package/dist/components/agents-sdk/WorkspaceProject.js +1 -1
- package/dist/components/agents-sdk/WorkspaceUserScript.js +1 -1
- package/dist/components/ai-sdk/Activity.d.ts +1 -1
- package/dist/components/ai-sdk/Activity.js +84 -6
- package/dist/components/ai-sdk/AgentChatMessageEditor.js +1 -1
- package/dist/components/ai-sdk/Approval.js +2 -1
- package/dist/components/ai-sdk/ComposerLink.js +1 -1
- package/dist/components/ai-sdk/ConnectedAppCards.js +63 -45
- package/dist/components/ai-sdk/Conversation.js +1 -1
- package/dist/components/ai-sdk/ExpansionState.d.ts +16 -6
- package/dist/components/ai-sdk/ExpansionState.js +25 -7
- package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +98 -11
- package/dist/components/ai-sdk/PromptInput.js +7 -3
- package/dist/components/ai-sdk/PromptInputComposerEditor.js +2 -2
- package/dist/components/ai-sdk/Queue.js +1 -1
- package/dist/components/ai-sdk/ToolInvocation.d.ts +8 -0
- package/dist/components/ai-sdk/ToolInvocation.js +45 -19
- package/dist/components/foundations/ToggleGroup.js +1 -1
- package/dist/components/general-purpose/ResponsiveSidebarShell.d.ts +2 -2
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +162 -87
- package/dist/components/general-purpose/Terminal.js +1 -1
- package/dist/components/general-purpose/WebPreview.js +1 -1
- package/dist/components/nanites/AgentToolDetail.d.ts +1 -3
- package/dist/components/nanites/AgentToolDetail.js +30 -39
- package/dist/merge-refs-DAh6reu8.js +26 -0
- package/dist/styles/activity.css +74 -0
- package/dist/styles/agent-chat.css +7 -0
- package/dist/styles/agent-tool-detail.css +2 -17
- package/dist/styles/app-top-bar.css +6 -7
- package/dist/styles/base.css +1 -1
- package/dist/styles/employee-chrome.css +0 -7
- package/dist/styles/message-scroller.css +8 -0
- package/dist/styles/message.css +1 -1
- package/dist/styles/responsive-sidebar-shell.css +10 -25
- package/dist/styles/scroll-area.css +16 -0
- package/dist/styles/scrollbars.css +55 -41
- package/dist/styles/search-field.css +0 -1
- package/dist/styles/subagent-run.css +36 -196
- package/dist/styles/think-chat-tool-panels.css +38 -5
- package/dist/styles/think-execution-workbench.css +4 -0
- package/dist/styles/think-full-app.css +1 -6
- package/dist/styles/workspace-concepts.css +6 -39
- package/dist/styles/workspace-explorer.css +4 -11
- package/package.json +2 -2
- package/dist/components/agents-sdk/SubagentRunDetails.d.ts +0 -40
- package/dist/components/agents-sdk/SubagentRunDetails.js +0 -98
- package/dist/merge-refs-DF_7w2x_.js +0 -18
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseComposerHref, sampleImageAccent, splitComposerDraft } from "../../utils/composer-link.js";
|
|
2
2
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
3
3
|
import { n as clamp } from "../../format-CWaZEp5o.js";
|
|
4
|
-
import { n as mergeRefs } from "../../merge-refs-
|
|
4
|
+
import { n as mergeRefs } from "../../merge-refs-DAh6reu8.js";
|
|
5
5
|
import { composerLinkAccent, composerLinkIconSrc, composerLinkUsesCube } from "./ComposerLink.js";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -203,7 +203,7 @@ function PromptInputComposerEditor({ className, placeholder = "How can I help?",
|
|
|
203
203
|
onKeyDown: (event) => {
|
|
204
204
|
onKeyDown?.(event);
|
|
205
205
|
if (event.defaultPrevented) return;
|
|
206
|
-
if (event.key === "Enter" && !event.shiftKey && !isComposingRef.current && !event.nativeEvent.isComposing) {
|
|
206
|
+
if (event.key === "Enter" && !event.shiftKey && !isComposingRef.current && !event.nativeEvent.isComposing && event.nativeEvent.keyCode !== 229) {
|
|
207
207
|
event.preventDefault();
|
|
208
208
|
event.currentTarget.closest("form")?.requestSubmit();
|
|
209
209
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
2
|
import { Collapsible } from "../foundations/Collapsible.js";
|
|
3
|
+
import { ScrollArea } from "../foundations/ScrollArea.js";
|
|
3
4
|
import { S as FileIcon, _ as DotIcon, d as CheckIcon, p as ChevronRightIcon } from "../../icons-DvlrWt54.js";
|
|
4
5
|
import { Button } from "../foundations/Button.js";
|
|
5
|
-
import { ScrollArea } from "../foundations/ScrollArea.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/ai-sdk/Queue.tsx
|
|
@@ -12,6 +12,12 @@ export interface ToolInvocationProps {
|
|
|
12
12
|
*/
|
|
13
13
|
isStreaming?: boolean;
|
|
14
14
|
}
|
|
15
|
+
export interface ToolInvocationDetailsProps {
|
|
16
|
+
/** The whole upstream AI SDK tool part whose detail is disclosed. */
|
|
17
|
+
part: AnyToolUIPart;
|
|
18
|
+
/** Caller-known domain error envelope; arbitrary output.error fields stay ordinary data. */
|
|
19
|
+
outputError?: boolean;
|
|
20
|
+
}
|
|
15
21
|
/**
|
|
16
22
|
* Read-only generic disclosure for one upstream AI SDK tool invocation.
|
|
17
23
|
*
|
|
@@ -22,4 +28,6 @@ export interface ToolInvocationProps {
|
|
|
22
28
|
* for known workspace, browser, fetch, session, skill, and execute tools.
|
|
23
29
|
*/
|
|
24
30
|
export declare function ToolInvocation({ part, defaultOpen, isStreaming }: ToolInvocationProps): import("react").JSX.Element;
|
|
31
|
+
/** Output formatting stays inside ActivityContent so collapsed rows do no detail work. */
|
|
32
|
+
export declare function ToolInvocationDetails({ part, outputError }: ToolInvocationDetailsProps): import("react").JSX.Element;
|
|
25
33
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Activity, ActivityContent, ActivityPanel, ActivityTrigger } from "./Activity.js";
|
|
2
2
|
import { o as formatUnknownValue } from "../../format-CWaZEp5o.js";
|
|
3
|
-
import { getToolDisplayName,
|
|
3
|
+
import { getToolDisplayName, isToolPartWorking } from "./ToolPart.js";
|
|
4
4
|
import { t as summarizeToolInput } from "../../summarize-tool-input-CqTcGRYy.js";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { getToolName } from "ai";
|
|
7
7
|
//#region src/components/ai-sdk/ToolInvocation.tsx
|
|
8
8
|
function formatToolValue(value) {
|
|
@@ -43,27 +43,53 @@ function describeToolPart(part) {
|
|
|
43
43
|
* for known workspace, browser, fetch, session, skill, and execute tools.
|
|
44
44
|
*/
|
|
45
45
|
function ToolInvocation({ part, defaultOpen, isStreaming }) {
|
|
46
|
-
const failed = isToolPartFailed(part);
|
|
47
|
-
const deniedReason = part.state === "output-denied" ? part.approval.reason : void 0;
|
|
48
|
-
const output = part.state === "output-error" ? part.errorText : part.state === "output-denied" ? deniedReason ?? "Denied" : part.state === "output-available" ? formatToolValue(part.output) : void 0;
|
|
49
|
-
const inputStatus = part.state === "approval-requested" ? "awaiting approval" : part.state === "approval-responded" ? part.approval.approved ? "approved" : "denied" : void 0;
|
|
50
|
-
const outputStatus = part.state === "output-denied" ? "denied" : failed ? "error" : part.state === "output-available" && part.preliminary ? "preliminary" : void 0;
|
|
51
46
|
return /* @__PURE__ */ jsxs(Activity, {
|
|
52
47
|
isStreaming: isStreaming ?? isToolPartWorking(part),
|
|
53
48
|
defaultOpen,
|
|
54
49
|
stateKey: part.toolCallId,
|
|
55
|
-
children: [/* @__PURE__ */ jsx(ActivityTrigger, { action: describeToolPart(part) }), /* @__PURE__ */
|
|
56
|
-
label: part.title ?? getToolName(part),
|
|
57
|
-
text: formatToolValue(part.input),
|
|
58
|
-
status: inputStatus,
|
|
59
|
-
error: inputStatus === "denied"
|
|
60
|
-
}), output !== void 0 ? /* @__PURE__ */ jsx(ActivityPanel, {
|
|
61
|
-
label: "output",
|
|
62
|
-
text: output,
|
|
63
|
-
status: outputStatus,
|
|
64
|
-
error: failed
|
|
65
|
-
}) : null] })]
|
|
50
|
+
children: [/* @__PURE__ */ jsx(ActivityTrigger, { action: describeToolPart(part) }), /* @__PURE__ */ jsx(ActivityContent, { children: /* @__PURE__ */ jsx(ToolInvocationDetails, { part }) })]
|
|
66
51
|
});
|
|
67
52
|
}
|
|
53
|
+
function toolInputStatus(part) {
|
|
54
|
+
if (part.state === "approval-requested") return "awaiting approval";
|
|
55
|
+
if (part.state === "approval-responded") return part.approval.approved ? "approved" : "denied";
|
|
56
|
+
}
|
|
57
|
+
/** The output row once the call settles: its denial, its error, or its result. */
|
|
58
|
+
function toolOutputRow(part, outputError) {
|
|
59
|
+
if (part.state === "output-denied" || part.state === "approval-responded" && !part.approval.approved) return {
|
|
60
|
+
text: part.approval.reason ?? "Denied",
|
|
61
|
+
status: "denied",
|
|
62
|
+
error: true
|
|
63
|
+
};
|
|
64
|
+
if (part.state === "output-error") return {
|
|
65
|
+
text: part.errorText,
|
|
66
|
+
status: "error",
|
|
67
|
+
error: true
|
|
68
|
+
};
|
|
69
|
+
if (part.state !== "output-available") return void 0;
|
|
70
|
+
const text = formatToolValue(part.output);
|
|
71
|
+
if (text === void 0) return void 0;
|
|
72
|
+
return {
|
|
73
|
+
text,
|
|
74
|
+
status: outputError ? "error" : part.preliminary ? "preliminary" : void 0,
|
|
75
|
+
error: outputError
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** Output formatting stays inside ActivityContent so collapsed rows do no detail work. */
|
|
79
|
+
function ToolInvocationDetails({ part, outputError = false }) {
|
|
80
|
+
const inputStatus = toolInputStatus(part);
|
|
81
|
+
const output = toolOutputRow(part, outputError);
|
|
82
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ActivityPanel, {
|
|
83
|
+
label: part.title ?? getToolName(part),
|
|
84
|
+
text: formatToolValue(part.input),
|
|
85
|
+
status: inputStatus,
|
|
86
|
+
error: inputStatus === "denied"
|
|
87
|
+
}), output ? /* @__PURE__ */ jsx(ActivityPanel, {
|
|
88
|
+
label: "output",
|
|
89
|
+
text: output.text,
|
|
90
|
+
status: output.status,
|
|
91
|
+
error: output.error
|
|
92
|
+
}) : null] });
|
|
93
|
+
}
|
|
68
94
|
//#endregion
|
|
69
|
-
export { ToolInvocation };
|
|
95
|
+
export { ToolInvocation, ToolInvocationDetails };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as mergeBaseClassName, t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { n as mergeRefs } from "../../merge-refs-
|
|
2
|
+
import { n as mergeRefs } from "../../merge-refs-DAh6reu8.js";
|
|
3
3
|
import { toggleVariants } from "./Toggle.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { AppBarSlots, ResponsiveSidebarShell, ResponsiveSidebarShellBar, ResponsiveSidebarShellControls, ResponsiveSidebarShellProps, useResponsiveSidebarShell };
|
|
1
|
+
import { a as ResponsiveSidebarShellBar, c as useResponsiveSidebarShell, i as ResponsiveSidebarShell, n as ResponsiveSidebarAppBar, o as ResponsiveSidebarShellControls, r as ResponsiveSidebarAppBarProps, s as ResponsiveSidebarShellProps, t as AppBarSlots } from "../../ResponsiveSidebarShell-DzBGlRJF.js";
|
|
2
|
+
export { AppBarSlots, ResponsiveSidebarAppBar, ResponsiveSidebarAppBarProps, ResponsiveSidebarShell, ResponsiveSidebarShellBar, ResponsiveSidebarShellControls, ResponsiveSidebarShellProps, useResponsiveSidebarShell };
|
|
@@ -2,11 +2,13 @@ import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
|
2
2
|
import { W as SidebarIcon, f as ChevronDownIcon, r as ArrowLeftIcon, tt as WarningIcon } from "../../icons-DvlrWt54.js";
|
|
3
3
|
import { Button } from "../foundations/Button.js";
|
|
4
4
|
import { t as capitalize } from "../../format-CWaZEp5o.js";
|
|
5
|
-
import { n as mergeRefs } from "../../merge-refs-
|
|
5
|
+
import { n as mergeRefs } from "../../merge-refs-DAh6reu8.js";
|
|
6
6
|
import { AppTopBar } from "./AppTopBar.js";
|
|
7
7
|
import { ResizableSidePanel } from "./ResizableSidePanel.js";
|
|
8
|
+
import { n as ShellAppBarOutletContext, t as ContentAppBarOutletContext } from "../../app-bar-outlet-CNfNzY4Y.js";
|
|
8
9
|
import * as React from "react";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { createPortal } from "react-dom";
|
|
10
12
|
//#region src/components/general-purpose/ResponsiveSidebarShell.tsx
|
|
11
13
|
/** Matches --sigvelo-layout-sidebar (16rem). */
|
|
12
14
|
const sidebarDefaultWidth = 256;
|
|
@@ -98,11 +100,25 @@ function useSidebarLayout({ rootRef, mainRef, isSidebarOpen, setSidebarOpen, pri
|
|
|
98
100
|
* hook, and its container name `responsive-sidebar-shell` is public contract:
|
|
99
101
|
* surfaces that compose the shell size themselves against it.
|
|
100
102
|
*/
|
|
101
|
-
function ResponsiveSidebarShell({ sidebar, sidebarLabel = "sidebar", sidebarOpen, sidebarTogglePlacement = "main", defaultSidebarOpen, defaultSidebarWidth = sidebarDefaultWidth, onSidebarOpenChange, bar, error, showMainLabel = "Show main content", className, children, ref, style, ...props }) {
|
|
103
|
+
function ResponsiveSidebarShell({ sidebar, sidebarLabel = "sidebar", sidebarOpen, sidebarTogglePlacement = "main", defaultSidebarOpen, defaultSidebarWidth = sidebarDefaultWidth, onSidebarOpenChange, bar, contentBar = false, error, showMainLabel = "Show main content", className, children, ref, style, ...props }) {
|
|
102
104
|
const sidebarId = React.useId();
|
|
103
105
|
const rootRef = React.useRef(null);
|
|
104
106
|
const mainRef = React.useRef(null);
|
|
105
107
|
const openerRef = React.useRef(null);
|
|
108
|
+
const [barTarget, setBarTarget] = React.useState(null);
|
|
109
|
+
const lastBarFocus = React.useRef(null);
|
|
110
|
+
const restoreBarFocus = React.useCallback(() => {
|
|
111
|
+
const previous = lastBarFocus.current;
|
|
112
|
+
if (!previous || !barTarget?.isConnected) return;
|
|
113
|
+
if (previous.bar.isConnected && previous.bar.getClientRects().length) return;
|
|
114
|
+
const active = document.activeElement;
|
|
115
|
+
if (active instanceof HTMLElement && active !== document.body && active.getClientRects().length) return;
|
|
116
|
+
const bar = Array.from(barTarget.children).find((element) => element.getClientRects().length);
|
|
117
|
+
if (!bar) return;
|
|
118
|
+
const controls = Array.from(bar.querySelectorAll("button, a[href]"));
|
|
119
|
+
(controls.find((element) => previous.label && element.getAttribute("aria-label") === previous.label) ?? controls.find((element) => element.getAttribute("aria-haspopup") === "menu") ?? controls[0])?.focus({ preventScroll: true });
|
|
120
|
+
}, [barTarget]);
|
|
121
|
+
React.useLayoutEffect(restoreBarFocus);
|
|
106
122
|
const [isSidebarOpen, setSidebarOpen, primeSidebarOpen] = useControllableSidebar({
|
|
107
123
|
sidebarOpen,
|
|
108
124
|
defaultSidebarOpen,
|
|
@@ -128,8 +144,8 @@ function ResponsiveSidebarShell({ sidebar, sidebarLabel = "sidebar", sidebarOpen
|
|
|
128
144
|
updateSidebar(() => setSidebarOpen(false), () => mainRef.current?.focus({ preventScroll: true }));
|
|
129
145
|
}, [setSidebarOpen, updateSidebar]);
|
|
130
146
|
const closeSidebarOnCompact = React.useCallback(() => {
|
|
131
|
-
if (rootRef.current && isCompactSidebar(rootRef.current)) closeSidebar();
|
|
132
|
-
}, [closeSidebar]);
|
|
147
|
+
if (isSidebarOpen && rootRef.current && isCompactSidebar(rootRef.current)) closeSidebar();
|
|
148
|
+
}, [closeSidebar, isSidebarOpen]);
|
|
133
149
|
const toggleSidebar = React.useCallback((trigger) => {
|
|
134
150
|
if (trigger) openerRef.current = trigger;
|
|
135
151
|
updateSidebar(() => setSidebarOpen(!isSidebarOpen));
|
|
@@ -145,12 +161,14 @@ function ResponsiveSidebarShell({ sidebar, sidebarLabel = "sidebar", sidebarOpen
|
|
|
145
161
|
compact,
|
|
146
162
|
contentCompact,
|
|
147
163
|
closeSidebar,
|
|
148
|
-
closeSidebarOnCompact
|
|
164
|
+
closeSidebarOnCompact,
|
|
165
|
+
restoreBarFocus
|
|
149
166
|
}), [
|
|
150
167
|
compact,
|
|
151
168
|
contentCompact,
|
|
152
169
|
closeSidebar,
|
|
153
|
-
closeSidebarOnCompact
|
|
170
|
+
closeSidebarOnCompact,
|
|
171
|
+
restoreBarFocus
|
|
154
172
|
]);
|
|
155
173
|
const sidebarContent = typeof sidebar === "function" ? sidebar(controls) : sidebar;
|
|
156
174
|
const sidebarToggle = sidebarVisible && sidebarTogglePlacement === "sidebar" ? /* @__PURE__ */ jsx(Button, {
|
|
@@ -167,82 +185,147 @@ function ResponsiveSidebarShell({ sidebar, sidebarLabel = "sidebar", sidebarOpen
|
|
|
167
185
|
onClick: (event) => toggleSidebar(event.currentTarget),
|
|
168
186
|
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
169
187
|
}) : null;
|
|
188
|
+
const renderBar = (slots, content = false) => /* @__PURE__ */ jsx(SidebarAppBar, {
|
|
189
|
+
bar: slots,
|
|
190
|
+
content,
|
|
191
|
+
hasSidebar,
|
|
192
|
+
sidebarTogglePlacement,
|
|
193
|
+
sidebarId,
|
|
194
|
+
isSidebarOpen,
|
|
195
|
+
toggleSidebar,
|
|
196
|
+
toggleLabel,
|
|
197
|
+
toggleTooltip
|
|
198
|
+
});
|
|
199
|
+
const outlet = contentBar && barTarget ? {
|
|
200
|
+
target: barTarget,
|
|
201
|
+
restoreFocus: restoreBarFocus,
|
|
202
|
+
render: (slots) => renderBar({
|
|
203
|
+
...bar,
|
|
204
|
+
title: slots.title ?? bar?.title,
|
|
205
|
+
titleRender: bar?.titleRender ?? slots.titleRender,
|
|
206
|
+
leading: slots.leading ?? bar?.leading,
|
|
207
|
+
back: slots.leading != null ? void 0 : bar?.back,
|
|
208
|
+
compactLeading: slots.leading ?? bar?.compactLeading,
|
|
209
|
+
compactTitleTrigger: void 0,
|
|
210
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [slots.actions, bar?.actions] }),
|
|
211
|
+
primary: slots.primary ?? bar?.primary,
|
|
212
|
+
label: slots.label ?? bar?.label,
|
|
213
|
+
className: cx(bar?.className, slots.className)
|
|
214
|
+
}, true)
|
|
215
|
+
} : null;
|
|
170
216
|
return /* @__PURE__ */ jsx(SidebarShellContext.Provider, {
|
|
171
217
|
value: controls,
|
|
172
|
-
children: /* @__PURE__ */ jsx(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
218
|
+
children: /* @__PURE__ */ jsx(ShellAppBarOutletContext.Provider, {
|
|
219
|
+
value: outlet,
|
|
220
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
221
|
+
ref: mergeRefs(rootRef, ref),
|
|
222
|
+
className: cx("responsive-sidebar-shell", className),
|
|
223
|
+
"data-recipe": "fill-host",
|
|
224
|
+
style,
|
|
225
|
+
...props,
|
|
226
|
+
"data-sidebar-open": sidebarVisible ? "true" : "false",
|
|
227
|
+
"data-sidebar-toggle-placement": sidebarTogglePlacement,
|
|
228
|
+
onKeyDown: (event) => {
|
|
229
|
+
props.onKeyDown?.(event);
|
|
230
|
+
if (!event.defaultPrevented && !event.nativeEvent.isComposing && event.nativeEvent.keyCode !== 229 && event.key === "Escape" && sidebarVisible && rootRef.current && isCompactSidebar(rootRef.current)) {
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
dismissSidebar();
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
children: /* @__PURE__ */ jsxs(ResizableSidePanel.Root, {
|
|
236
|
+
className: "responsive-sidebar-shell__frame",
|
|
237
|
+
label: sidebarLabel,
|
|
238
|
+
side: "start",
|
|
239
|
+
sizeVariable: "--responsive-sidebar-shell-sidebar-size",
|
|
240
|
+
defaultSize: defaultSidebarWidth,
|
|
241
|
+
minSize: sidebarMinWidth,
|
|
242
|
+
maxSize: sidebarMaxWidth,
|
|
243
|
+
keyboardStep: sidebarKeyboardStep,
|
|
244
|
+
children: [
|
|
245
|
+
sidebarVisible ? /* @__PURE__ */ jsx(ResizableSidePanel.Handle, { className: "responsive-sidebar-shell__resizer" }) : null,
|
|
246
|
+
hasSidebar ? /* @__PURE__ */ jsx(SidebarPane, {
|
|
247
|
+
id: sidebarId,
|
|
248
|
+
open: isSidebarOpen,
|
|
249
|
+
toggle: sidebarToggle,
|
|
250
|
+
children: sidebarContent
|
|
251
|
+
}) : null,
|
|
252
|
+
/* @__PURE__ */ jsxs("div", {
|
|
253
|
+
ref: mainRef,
|
|
254
|
+
className: "responsive-sidebar-shell__main",
|
|
255
|
+
"data-content-compact": String(contentCompact),
|
|
256
|
+
tabIndex: -1,
|
|
257
|
+
onFocusCapture: (event) => {
|
|
258
|
+
const focusedBar = event.target.closest(".app-top-bar");
|
|
259
|
+
if (focusedBar && barTarget?.contains(focusedBar)) lastBarFocus.current = {
|
|
260
|
+
bar: focusedBar,
|
|
261
|
+
label: event.target.getAttribute("aria-label")
|
|
262
|
+
};
|
|
263
|
+
else if (!event.target.closest("[role=\"menu\"]")) lastBarFocus.current = null;
|
|
264
|
+
},
|
|
265
|
+
onPointerDownCapture: (event) => {
|
|
266
|
+
if (event.target instanceof Element && !barTarget?.contains(event.target) && !event.target.closest("[role=\"menu\"]")) lastBarFocus.current = null;
|
|
267
|
+
},
|
|
268
|
+
children: [
|
|
269
|
+
contentBar ? /* @__PURE__ */ jsx("div", {
|
|
270
|
+
className: "responsive-sidebar-shell__bar",
|
|
271
|
+
ref: setBarTarget,
|
|
272
|
+
children: renderBar(bar)
|
|
273
|
+
}) : renderBar(bar),
|
|
274
|
+
error != null ? /* @__PURE__ */ jsxs("div", {
|
|
275
|
+
className: "responsive-sidebar-shell__error",
|
|
276
|
+
role: "alert",
|
|
277
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: error })]
|
|
278
|
+
}) : null,
|
|
279
|
+
children
|
|
280
|
+
]
|
|
281
|
+
}),
|
|
282
|
+
sidebarVisible ? /* @__PURE__ */ jsx(Button, {
|
|
283
|
+
type: "button",
|
|
284
|
+
variant: "ghost",
|
|
285
|
+
color: "neutral",
|
|
286
|
+
className: "responsive-sidebar-shell__peek",
|
|
287
|
+
"aria-label": showMainLabel,
|
|
288
|
+
onClick: closeSidebar
|
|
289
|
+
}) : null
|
|
290
|
+
]
|
|
291
|
+
})
|
|
237
292
|
})
|
|
238
293
|
})
|
|
239
294
|
});
|
|
240
295
|
}
|
|
241
|
-
|
|
242
|
-
|
|
296
|
+
/**
|
|
297
|
+
* A pane's title, Back control and actions share its enclosing shell's bar.
|
|
298
|
+
* Outside an opted-in workbench this renders a standalone application bar.
|
|
299
|
+
* A portal preserves the pane's state and providers without registering
|
|
300
|
+
* React nodes in ancestor state or rerendering the conversation on each action.
|
|
301
|
+
* Submit controls moved here must name their owning form with `form`.
|
|
302
|
+
*/
|
|
303
|
+
function ResponsiveSidebarAppBar(props) {
|
|
304
|
+
const outlet = React.useContext(ContentAppBarOutletContext);
|
|
305
|
+
React.useLayoutEffect(() => {
|
|
306
|
+
if (!outlet) return;
|
|
307
|
+
outlet.restoreFocus();
|
|
308
|
+
return () => queueMicrotask(outlet.restoreFocus);
|
|
309
|
+
}, [outlet]);
|
|
310
|
+
if (outlet) return createPortal(outlet.render(props), outlet.target);
|
|
311
|
+
return /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
312
|
+
"aria-label": props.label ?? "Application controls",
|
|
313
|
+
titleAlign: "start",
|
|
314
|
+
className: props.className,
|
|
315
|
+
children: [
|
|
316
|
+
props.leading != null ? /* @__PURE__ */ jsx(AppTopBar.Leading, { children: props.leading }) : null,
|
|
317
|
+
props.title != null ? /* @__PURE__ */ jsx(AppTopBar.Title, {
|
|
318
|
+
render: props.titleRender,
|
|
319
|
+
children: props.title
|
|
320
|
+
}) : null,
|
|
321
|
+
props.actions != null || props.primary != null ? /* @__PURE__ */ jsxs(AppTopBar.Trailing, { children: [props.actions, props.primary] }) : null
|
|
322
|
+
]
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function SidebarAppBar({ bar, content = false, hasSidebar, sidebarTogglePlacement, sidebarId, isSidebarOpen, toggleSidebar, toggleLabel, toggleTooltip }) {
|
|
243
326
|
const hasTitleTrigger = hasSidebar && bar?.compactTitleTrigger != null && bar?.compactLeading == null;
|
|
244
|
-
const mainSidebarToggle = hasSidebar
|
|
245
|
-
className: cx("responsive-sidebar-shell__toggle",
|
|
327
|
+
const mainSidebarToggle = hasSidebar ? /* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
328
|
+
className: cx("responsive-sidebar-shell__toggle", sidebarTogglePlacement === "sidebar" && "responsive-sidebar-shell__toggle--sidebar-fallback"),
|
|
246
329
|
label: toggleLabel,
|
|
247
330
|
tooltip: toggleTooltip,
|
|
248
331
|
type: "button",
|
|
@@ -257,6 +340,7 @@ function SidebarAppBar({ bar, hasSidebar, sidebarTogglePlacement, sidebarId, isS
|
|
|
257
340
|
"aria-label": bar?.label ?? "Application controls",
|
|
258
341
|
className: bar?.className,
|
|
259
342
|
"data-compact-leading": compactLeadingMode,
|
|
343
|
+
"data-content-bar": content ? "" : void 0,
|
|
260
344
|
children: [
|
|
261
345
|
/* @__PURE__ */ jsx(SidebarAppBarLeading, {
|
|
262
346
|
bar,
|
|
@@ -294,11 +378,6 @@ function SidebarAppBarTitle({ bar, hasTitleTrigger, sidebarId, isSidebarOpen, to
|
|
|
294
378
|
}) : null]
|
|
295
379
|
});
|
|
296
380
|
}
|
|
297
|
-
function sidebarToggleClassName(placement, hasTitleTrigger, hasCompactLeading) {
|
|
298
|
-
if (placement === "sidebar") return "responsive-sidebar-shell__toggle--sidebar-fallback";
|
|
299
|
-
if (hasTitleTrigger) return "responsive-sidebar-shell__toggle--replaced-by-title";
|
|
300
|
-
if (hasCompactLeading) return "responsive-sidebar-shell__toggle--replaced-by-compact-leading";
|
|
301
|
-
}
|
|
302
381
|
function SidebarAppBarLeading({ bar, mainSidebarToggle, compactLeadingMode }) {
|
|
303
382
|
const { contentCompact } = useResponsiveSidebarShell();
|
|
304
383
|
const compactNavigationActive = contentCompact && compactLeadingMode === "custom";
|
|
@@ -310,11 +389,7 @@ function SidebarAppBarLeading({ bar, mainSidebarToggle, compactLeadingMode }) {
|
|
|
310
389
|
render: bar.back.link,
|
|
311
390
|
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
312
391
|
}) : null,
|
|
313
|
-
compactNavigationActive ?
|
|
314
|
-
compactLeadingMode === "custom" ? /* @__PURE__ */ jsx("span", {
|
|
315
|
-
className: "responsive-sidebar-shell__compact-leading",
|
|
316
|
-
children: bar?.compactLeading
|
|
317
|
-
}) : null
|
|
392
|
+
compactNavigationActive ? bar?.compactLeading : bar?.leading
|
|
318
393
|
] });
|
|
319
394
|
}
|
|
320
395
|
function hasSidebarAppBar(bar, hasSidebar) {
|
|
@@ -343,4 +418,4 @@ function SidebarPane({ id, open, toggle, children }) {
|
|
|
343
418
|
});
|
|
344
419
|
}
|
|
345
420
|
//#endregion
|
|
346
|
-
export { ResponsiveSidebarShell, useResponsiveSidebarShell };
|
|
421
|
+
export { ResponsiveSidebarAppBar, ResponsiveSidebarShell, useResponsiveSidebarShell };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
+
import { ScrollArea } from "../foundations/ScrollArea.js";
|
|
2
3
|
import { Q as TerminalIcon, rt as XIcon } from "../../icons-DvlrWt54.js";
|
|
3
4
|
import { IconButton } from "../foundations/IconButton.js";
|
|
4
5
|
import { t as CopyButton } from "../../copy-button-M4sAp9xS.js";
|
|
5
|
-
import { ScrollArea } from "../foundations/ScrollArea.js";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import Anser from "anser";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
2
|
import { Collapsible } from "../foundations/Collapsible.js";
|
|
3
|
+
import { ScrollArea } from "../foundations/ScrollArea.js";
|
|
3
4
|
import { H as RefreshIcon, f as ChevronDownIcon, i as ArrowRightIcon, r as ArrowLeftIcon } from "../../icons-DvlrWt54.js";
|
|
4
5
|
import { IconButton } from "../foundations/IconButton.js";
|
|
5
6
|
import { Input } from "../foundations/Input.js";
|
|
6
|
-
import { ScrollArea } from "../foundations/ScrollArea.js";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { useRender } from "@base-ui/react/use-render";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { n as AgentToolRunValue } from "../../AgentToolRunsContext-DniwGn96.js";
|
|
2
2
|
import { i as ThinkChatValue } from "../../ThinkChatContext-DQ6M2VlJ.js";
|
|
3
|
-
import { SubagentRunMetadataProps } from "../agents-sdk/SubagentRunDetails.js";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
import { UIMessage } from "ai";
|
|
6
5
|
import { UseAgentOptions, useAgent } from "agents/react";
|
|
@@ -27,14 +26,13 @@ export interface AgentToolDetailProps<State = unknown, MessageT extends UIMessag
|
|
|
27
26
|
* rendered in the top bar's trailing slot after the status mark.
|
|
28
27
|
*/
|
|
29
28
|
actions?: React.ReactNode;
|
|
30
|
-
renderMilestone?: SubagentRunMetadataProps["renderMilestone"];
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
31
|
* Live retained-child detail composed from upstream connection and chat values.
|
|
34
32
|
* The full child transcript comes from `chat.messages`; `run.parts` remains a
|
|
35
33
|
* compact parent-side stream projection and is never promoted to fake history.
|
|
36
34
|
*/
|
|
37
|
-
export declare function AgentToolDetail<State = unknown, MessageT extends UIMessage = UIMessage>({ actions, backLink, chat, className, ref, run,
|
|
35
|
+
export declare function AgentToolDetail<State = unknown, MessageT extends UIMessage = UIMessage>({ actions, backLink, chat, className, ref, run, ...props }: AgentToolDetailProps<State, MessageT> & {
|
|
38
36
|
ref?: React.Ref<HTMLDivElement>;
|
|
39
37
|
}): React.JSX.Element;
|
|
40
38
|
export interface SelectedAgentToolChildProps<ParentAgentT extends ThinkAgent<ParentState>, ParentState = unknown, ChildState = unknown, MessageT extends UIMessage = UIMessage> {
|
|
@@ -3,9 +3,8 @@ import { r as ArrowLeftIcon } from "../../icons-DvlrWt54.js";
|
|
|
3
3
|
import { MessageActions } from "../ai-sdk/Message.js";
|
|
4
4
|
import { TransitionSurface } from "../foundations/TransitionSurface.js";
|
|
5
5
|
import { AppTopBar } from "../general-purpose/AppTopBar.js";
|
|
6
|
-
import { NaniteMark } from "./NaniteScene.js";
|
|
7
6
|
import { SubagentRunIndicator, getSubagentRunName } from "../agents-sdk/SubagentRunIndicator.js";
|
|
8
|
-
import {
|
|
7
|
+
import { NaniteMark } from "./NaniteScene.js";
|
|
9
8
|
import { AgentChat } from "../agents-sdk/AgentChat.js";
|
|
10
9
|
import { ThinkChat } from "../agents-sdk/ThinkChat.js";
|
|
11
10
|
import * as React from "react";
|
|
@@ -18,7 +17,7 @@ import { useAgent } from "agents/react";
|
|
|
18
17
|
* The full child transcript comes from `chat.messages`; `run.parts` remains a
|
|
19
18
|
* compact parent-side stream projection and is never promoted to fake history.
|
|
20
19
|
*/
|
|
21
|
-
function AgentToolDetail({ actions, backLink, chat, className, ref, run,
|
|
20
|
+
function AgentToolDetail({ actions, backLink, chat, className, ref, run, ...props }) {
|
|
22
21
|
const backRef = React.useRef(null);
|
|
23
22
|
const name = getSubagentRunName(run);
|
|
24
23
|
React.useEffect(() => {
|
|
@@ -31,42 +30,34 @@ function AgentToolDetail({ actions, backLink, chat, className, ref, run, renderM
|
|
|
31
30
|
className: cx("agent-tool-detail", className),
|
|
32
31
|
...props,
|
|
33
32
|
"data-recipe": "fill-host",
|
|
34
|
-
children: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
children: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
children:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
message,
|
|
63
|
-
messageIndex,
|
|
64
|
-
messageNumber,
|
|
65
|
-
children: [/* @__PURE__ */ jsx(ThinkChat.MessageContent, { message }), /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(AgentChat.CopyAction, {}) })]
|
|
66
|
-
}) }), /* @__PURE__ */ jsx(AgentChat.Dock, { children: /* @__PURE__ */ jsx(ThinkChat.RecoveryNotice, {}) })]
|
|
67
|
-
}) : /* @__PURE__ */ jsx(AgentChat.Loading, {})
|
|
68
|
-
})
|
|
69
|
-
]
|
|
33
|
+
children: [/* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
34
|
+
titleAlign: "start",
|
|
35
|
+
"aria-label": `${name} controls`,
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [backLink ? /* @__PURE__ */ jsx(AppTopBar.Link, {
|
|
38
|
+
ref: backRef,
|
|
39
|
+
label: "Back to parent conversation",
|
|
40
|
+
render: backLink,
|
|
41
|
+
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
42
|
+
}) : null, /* @__PURE__ */ jsx(NaniteMark, { index: run.order })] }),
|
|
43
|
+
/* @__PURE__ */ jsx(AppTopBar.Title, { children: /* @__PURE__ */ jsx("h2", {
|
|
44
|
+
className: "agent-tool-detail__title",
|
|
45
|
+
children: name
|
|
46
|
+
}) }),
|
|
47
|
+
/* @__PURE__ */ jsxs(AppTopBar.Trailing, { children: [/* @__PURE__ */ jsx(SubagentRunIndicator, { run }), actions] })
|
|
48
|
+
]
|
|
49
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: "agent-tool-detail__chat",
|
|
51
|
+
children: chat ? /* @__PURE__ */ jsxs(ThinkChat.Root, {
|
|
52
|
+
chat,
|
|
53
|
+
children: [/* @__PURE__ */ jsx(AgentChat.Transcript, { children: ({ message, messageIndex, messageNumber }) => /* @__PURE__ */ jsxs(AgentChat.Message, {
|
|
54
|
+
message,
|
|
55
|
+
messageIndex,
|
|
56
|
+
messageNumber,
|
|
57
|
+
children: [/* @__PURE__ */ jsx(ThinkChat.MessageContent, { message }), /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(AgentChat.CopyAction, {}) })]
|
|
58
|
+
}) }), /* @__PURE__ */ jsx(AgentChat.Dock, { children: /* @__PURE__ */ jsx(ThinkChat.RecoveryNotice, {}) })]
|
|
59
|
+
}) : /* @__PURE__ */ jsx(AgentChat.Loading, {})
|
|
60
|
+
})]
|
|
70
61
|
});
|
|
71
62
|
}
|
|
72
63
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/components/_internal/merge-refs.ts
|
|
2
|
+
function assignRef(ref, value) {
|
|
3
|
+
if (!ref) return;
|
|
4
|
+
if (typeof ref === "function") {
|
|
5
|
+
const cleanup = ref(value);
|
|
6
|
+
return typeof cleanup === "function" ? cleanup : void 0;
|
|
7
|
+
}
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}
|
|
10
|
+
function mergeRefs(...refs) {
|
|
11
|
+
const activeRefs = refs.filter((ref) => ref != null);
|
|
12
|
+
if (activeRefs.length === 0) return void 0;
|
|
13
|
+
return (value) => {
|
|
14
|
+
const cleanups = activeRefs.map((activeRef) => assignRef(activeRef, value));
|
|
15
|
+
if (value === null) return;
|
|
16
|
+
return () => {
|
|
17
|
+
for (const [index, activeRef] of activeRefs.entries()) {
|
|
18
|
+
const cleanup = cleanups[index];
|
|
19
|
+
if (cleanup) cleanup();
|
|
20
|
+
else assignRef(activeRef, null);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { mergeRefs as n, assignRef as t };
|