@mcp-b/react-components 0.14.1 → 0.16.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/AgentActivity-BNUNrP9O.d.ts +36 -0
- package/dist/{AgentChat-Cgb1xuT7.d.ts → AgentChat-CrlpbvQJ.d.ts} +62 -8
- package/dist/{CodeBlock-DUh9WOGo.d.ts → CodeBlock-BRajW4QU.d.ts} +1 -1
- package/dist/{CodeBlock-BUFXG8HW.js → CodeBlock-BmB4Xaqq.js} +15 -4
- package/dist/{FileTree-mpEIcfzA.js → FileTree-CkVbIMWV.js} +82 -89
- package/dist/Message-BkMdE3bS.js +375 -0
- package/dist/{ModelSelector-DVgVBdvw.js → ModelSelector-SlJNgwKY.js} +17 -8
- package/dist/{PromptInput-ClNqBiIw.d.ts → PromptInput-BWTuXMOD.d.ts} +123 -5
- package/dist/ResponsiveSidebarShell-Dd9DCcBT.d.ts +67 -0
- package/dist/{Select-Dl_vF_Bt.d.ts → Select-BeEsefzh.d.ts} +12 -2
- package/dist/{ThinkChat-7DQ2CogF.js → ThinkChat-CzC-zNGA.js} +27 -37
- package/dist/{ThinkChatActivity-m9orbdeI.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
- package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
- package/dist/{ThinkChatToolParts-Cv4o7j6F.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +62 -3
- package/dist/ThinkExecutionRun-ChhWhOoU.d.ts +30 -0
- package/dist/Toggle-CAAlNl-M.d.ts +69 -0
- package/dist/ToggleGroup-8hPv-b69.d.ts +73 -0
- package/dist/Workspace-D39LxGvP.d.ts +62 -0
- package/dist/WorkspaceFile-DOZkPwzu.d.ts +106 -0
- package/dist/WorkspaceFileView-rSN_yT0L.js +744 -0
- package/dist/WorkspaceLink-DIPbXrUM.js +337 -0
- package/dist/WorkspaceLink-DK1DWMHe.d.ts +89 -0
- package/dist/components/Activity.d.ts +27 -1
- package/dist/components/Activity.js +33 -15
- package/dist/components/AgentActivity.d.ts +2 -0
- package/dist/components/AgentActivity.js +45 -0
- package/dist/components/AgentActivityPreview.d.ts +46 -0
- package/dist/components/AgentActivityPreview.js +94 -0
- package/dist/components/AgentAttention.d.ts +73 -0
- package/dist/components/AgentAttention.js +85 -0
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +231 -205
- package/dist/components/AgentChatMessageEditor.d.ts +29 -0
- package/dist/components/AgentChatMessageEditor.js +92 -0
- package/dist/components/AgentChatTurnError.d.ts +17 -0
- package/dist/components/AgentChatTurnError.js +40 -0
- package/dist/components/AgentConnection.d.ts +12 -17
- package/dist/components/AgentConnection.js +99 -91
- package/dist/components/AppFrame.d.ts +24 -0
- package/dist/components/AppFrame.js +25 -0
- package/dist/components/AppTopBar.d.ts +71 -0
- package/dist/components/AppTopBar.js +82 -0
- package/dist/components/Artifact.js +1 -1
- package/dist/components/BrowserLiveView.js +1 -1
- package/dist/components/BrowserReplay.js +1 -1
- package/dist/components/BrowserRunPanel.js +1 -1
- package/dist/components/Card.d.ts +3 -0
- package/dist/components/Card.js +2 -1
- package/dist/components/ChainOfThought.d.ts +1 -1
- package/dist/components/ChainOfThought.js +1 -1
- package/dist/components/ChatGptSignInScreen.js +2 -2
- package/dist/components/Checkbox.js +5 -13
- package/dist/components/CheckboxGroup.d.ts +58 -2
- package/dist/components/CheckboxGroup.js +59 -1
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.js +1 -1
- package/dist/components/Commit.js +2 -2
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/Conversation.js +1 -1
- package/dist/components/DescriptionList.d.ts +12 -0
- package/dist/components/DescriptionList.js +11 -0
- package/dist/components/DescriptionListParts.d.ts +37 -0
- package/dist/components/DescriptionListParts.js +35 -0
- package/dist/components/EnvironmentVariables.js +2 -2
- package/dist/components/Fieldset.d.ts +13 -1
- package/dist/components/Fieldset.js +11 -2
- package/dist/components/FileTree.js +1 -1
- package/dist/components/IconButton.d.ts +33 -0
- package/dist/components/IconButton.js +27 -0
- package/dist/components/McpConnectionRequest.d.ts +44 -0
- package/dist/components/McpConnectionRequest.js +122 -0
- package/dist/components/McpServerPicker.d.ts +48 -23
- package/dist/components/McpServerPicker.js +238 -189
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Message.d.ts +1 -0
- package/dist/components/Message.js +1 -285
- package/dist/components/MessageScroller.js +1 -1
- package/dist/components/ModelSelector.d.ts +15 -3
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NaniteScene.d.ts +10 -1
- package/dist/components/NaniteScene.js +36 -1
- package/dist/components/Pricing.d.ts +37 -0
- package/dist/components/Pricing.js +17 -0
- package/dist/components/PricingBillingToggle.d.ts +23 -0
- package/dist/components/PricingBillingToggle.js +86 -0
- package/dist/components/PricingConfirmationDialog.d.ts +25 -0
- package/dist/components/PricingConfirmationDialog.js +57 -0
- package/dist/components/PricingFAQ.d.ts +18 -0
- package/dist/components/PricingFAQ.js +27 -0
- package/dist/components/PricingPage.d.ts +2 -38
- package/dist/components/PricingPage.js +39 -359
- package/dist/components/PricingPlanCard.d.ts +22 -0
- package/dist/components/PricingPlanCard.js +109 -0
- package/dist/components/PricingUsageCalculator.d.ts +22 -0
- package/dist/components/PricingUsageCalculator.js +96 -0
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +210 -15
- package/dist/components/Queue.js +1 -1
- package/dist/components/Reasoning.d.ts +2 -1
- package/dist/components/Reasoning.js +14 -29
- package/dist/components/ResizableSidePanel.d.ts +57 -0
- package/dist/components/ResizableSidePanel.js +151 -0
- package/dist/components/ResponsiveSidebarShell.d.ts +2 -0
- package/dist/components/ResponsiveSidebarShell.js +129 -0
- package/dist/components/Select.d.ts +2 -2
- package/dist/components/Select.js +11 -2
- package/dist/components/Slider.d.ts +13 -1
- package/dist/components/Slider.js +11 -0
- package/dist/components/Sources.js +1 -1
- package/dist/components/Stepper.d.ts +4 -0
- package/dist/components/Stepper.js +5 -3
- package/dist/components/SubagentRun.d.ts +86 -0
- package/dist/components/SubagentRun.js +108 -0
- package/dist/components/SubagentRunDetails.d.ts +44 -0
- package/dist/components/SubagentRunDetails.js +48 -0
- package/dist/components/SubagentRunIndicator.d.ts +22 -0
- package/dist/components/SubagentRunIndicator.js +33 -0
- package/dist/components/SubagentRunList.d.ts +25 -0
- package/dist/components/SubagentRunList.js +26 -0
- package/dist/components/SubagentRunSelector.d.ts +47 -0
- package/dist/components/SubagentRunSelector.js +55 -0
- package/dist/components/Task.js +1 -1
- package/dist/components/Terminal.js +2 -2
- package/dist/components/TestResults.js +1 -1
- package/dist/components/Textarea.d.ts +21 -0
- package/dist/components/Textarea.js +19 -0
- package/dist/components/ThemeModeControl.d.ts +24 -0
- package/dist/components/ThemeModeControl.js +52 -0
- package/dist/components/ThemeProvider.d.ts +38 -0
- package/dist/components/ThemeProvider.js +80 -0
- package/dist/components/ThinkChat.d.ts +34 -7
- package/dist/components/ThinkChat.js +7 -4
- package/dist/components/ThinkChatActivity.d.ts +3 -2
- package/dist/components/ThinkChatActivity.js +18 -297
- package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
- package/dist/components/ThinkChatActivitySummary.js +421 -0
- package/dist/components/ThinkChatToolPanels.d.ts +15 -5
- package/dist/components/ThinkChatToolPanels.js +116 -9
- package/dist/components/ThinkChatToolParts.d.ts +2 -2
- package/dist/components/ThinkChatToolParts.js +51 -9
- package/dist/components/ThinkExecutionDetail.d.ts +20 -0
- package/dist/components/ThinkExecutionDetail.js +80 -0
- package/dist/components/ThinkExecutionRun.d.ts +2 -0
- package/dist/components/ThinkExecutionRun.js +72 -0
- package/dist/components/ThinkExecutionStatus.d.ts +22 -0
- package/dist/components/ThinkExecutionStatus.js +36 -0
- package/dist/components/ThinkExecutionWorkbench.d.ts +7 -0
- package/dist/components/ThinkExecutionWorkbench.js +69 -225
- package/dist/components/ThinkFullApp.d.ts +58 -14
- package/dist/components/ThinkFullApp.js +129 -160
- package/dist/components/ThinkFullAppViewSwitch.d.ts +31 -0
- package/dist/components/ThinkFullAppViewSwitch.js +34 -0
- package/dist/components/ThinkRoutine.d.ts +36 -0
- package/dist/components/ThinkRoutine.js +15 -0
- package/dist/components/ThinkRoutineBrowser.d.ts +25 -0
- package/dist/components/ThinkRoutineBrowser.js +156 -0
- package/dist/components/ThinkRoutineDetail.d.ts +24 -0
- package/dist/components/ThinkRoutineDetail.js +102 -0
- package/dist/components/ThinkRoutineForm.d.ts +32 -0
- package/dist/components/ThinkRoutineForm.js +151 -0
- package/dist/components/ThinkRoutineLibrary.d.ts +74 -0
- package/dist/components/ThinkRoutineLibrary.js +178 -0
- package/dist/components/ThinkRoutineRuns.d.ts +24 -0
- package/dist/components/ThinkRoutineRuns.js +68 -0
- package/dist/components/ThinkThreadPicker.d.ts +18 -1
- package/dist/components/ThinkThreadPicker.js +51 -5
- package/dist/components/ThinkThreadShell.d.ts +12 -9
- package/dist/components/ThinkThreadShell.js +17 -137
- package/dist/components/Toggle.d.ts +1 -68
- package/dist/components/ToggleGroup.d.ts +1 -72
- package/dist/components/Tooltip.d.ts +3 -1
- package/dist/components/Tooltip.js +4 -2
- package/dist/components/WebPreview.js +1 -1
- package/dist/components/Workspace.d.ts +2 -0
- package/dist/components/Workspace.js +424 -0
- package/dist/components/WorkspaceBrowser.d.ts +32 -0
- package/dist/components/WorkspaceBrowser.js +103 -0
- package/dist/components/WorkspaceExplorer.d.ts +12 -79
- package/dist/components/WorkspaceExplorer.js +116 -330
- package/dist/components/WorkspaceFile.d.ts +2 -0
- package/dist/components/WorkspaceFile.js +195 -0
- package/dist/components/WorkspaceFileView.d.ts +26 -0
- package/dist/components/WorkspaceFileView.js +2 -0
- package/dist/components/WorkspaceHeader.d.ts +35 -0
- package/dist/components/WorkspaceHeader.js +51 -0
- package/dist/components/WorkspaceLink.d.ts +2 -0
- package/dist/components/WorkspaceLink.js +2 -0
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-DUMLYdsk.js → copy-button-Dejn5heL.js} +1 -1
- package/dist/icons-CpfUer49.js +85 -0
- package/dist/{icons-CUCz_Sft.d.ts → icons-GQd1xF4e.d.ts} +51 -1
- package/dist/styles/activity-header.css +75 -0
- package/dist/styles/activity.css +49 -63
- package/dist/styles/agent-activity-preview-overlay.css +80 -0
- package/dist/styles/agent-activity-preview.css +235 -0
- package/dist/styles/agent-attention.css +122 -0
- package/dist/styles/agent-chat.css +141 -4
- package/dist/styles/app-frame.css +15 -0
- package/dist/styles/app-top-bar.css +100 -0
- package/dist/styles/avatar.css +0 -1
- package/dist/styles/browser-control-overlay.css +184 -0
- package/dist/styles/card.css +21 -0
- package/dist/styles/checkbox-group.css +69 -0
- package/dist/styles/description-list.css +50 -0
- package/dist/styles/fieldset.css +11 -0
- package/dist/styles/index.css +15 -2
- package/dist/styles/mcp-connection-request.css +60 -0
- package/dist/styles/mcp-server-picker.css +95 -68
- package/dist/styles/message.css +4 -43
- package/dist/styles/nanite-scene.css +16 -0
- package/dist/styles/pricing-page.css +21 -27
- package/dist/styles/prompt-input.css +225 -32
- package/dist/styles/reasoning.css +1 -55
- package/dist/styles/recipes.css +23 -15
- package/dist/styles/resizable-side-panel.css +66 -0
- package/dist/styles/responsive-sidebar-shell.css +169 -0
- package/dist/styles/select.css +10 -0
- package/dist/styles/stepper.css +13 -0
- package/dist/styles/streamdown.css +0 -4
- package/dist/styles/subagent-run.css +205 -0
- package/dist/styles/textarea.css +20 -0
- package/dist/styles/theme-mode-control.css +72 -0
- package/dist/styles/think-execution-status.css +49 -0
- package/dist/styles/think-execution-workbench.css +8 -72
- package/dist/styles/think-full-app.css +106 -131
- package/dist/styles/think-routine-library.css +491 -0
- package/dist/styles/think-thread-picker.css +47 -3
- package/dist/styles/toggle-group.css +7 -0
- package/dist/styles/workspace-explorer.css +511 -64
- package/dist/utils/codex-model-catalog.d.ts +4 -4
- package/dist/utils/mcp-server-catalog.d.ts +82 -78
- package/dist/utils/mcp-server-catalog.js +64 -41
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/utils/theme.d.ts +22 -0
- package/dist/utils/theme.js +55 -0
- package/package.json +34 -28
- package/dist/icons-Ba9THQKz.js +0 -64
- package/dist/styles/think-resize-handle.css +0 -33
- package/dist/styles/think-thread-shell.css +0 -219
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { B as SpinnerIcon, P as PlayIcon, h as EllipsisIcon, n as ArrowLeftIcon, q as WarningIcon } from "../icons-CpfUer49.js";
|
|
3
|
+
import { Menu } from "./Menu.js";
|
|
4
|
+
import { AppTopBar } from "./AppTopBar.js";
|
|
5
|
+
import { ResponsiveSidebarShell } from "./ResponsiveSidebarShell.js";
|
|
6
|
+
import { ThinkRoutineBrowser } from "./ThinkRoutineBrowser.js";
|
|
7
|
+
import { ThinkRoutineDetail } from "./ThinkRoutineDetail.js";
|
|
8
|
+
import { ThinkRoutineForm } from "./ThinkRoutineForm.js";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/ThinkRoutineLibrary.tsx
|
|
12
|
+
function errorMessage(error) {
|
|
13
|
+
return error instanceof Error ? error.message : String(error);
|
|
14
|
+
}
|
|
15
|
+
function RoutineTopBarActions({ busy, onDelete, onRun }) {
|
|
16
|
+
if (!onRun && !onDelete) return null;
|
|
17
|
+
return /* @__PURE__ */ jsxs(AppTopBar.Trailing, {
|
|
18
|
+
"aria-label": "Schedule actions",
|
|
19
|
+
children: [onRun ? /* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
20
|
+
label: "Run schedule",
|
|
21
|
+
tooltip: "Run now",
|
|
22
|
+
disabled: busy,
|
|
23
|
+
onClick: onRun,
|
|
24
|
+
children: busy ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(PlayIcon, {})
|
|
25
|
+
}) : null, onDelete ? /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
26
|
+
label: "More schedule actions",
|
|
27
|
+
tooltip: "More actions",
|
|
28
|
+
disabled: busy,
|
|
29
|
+
render: /* @__PURE__ */ jsx(Menu.Trigger, { unstyled: true }),
|
|
30
|
+
children: /* @__PURE__ */ jsx(EllipsisIcon, {})
|
|
31
|
+
}), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
32
|
+
align: "end",
|
|
33
|
+
sideOffset: 4,
|
|
34
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, { children: /* @__PURE__ */ jsx(Menu.Item, {
|
|
35
|
+
variant: "destructive",
|
|
36
|
+
disabled: busy,
|
|
37
|
+
onClick: onDelete,
|
|
38
|
+
children: "Delete schedule"
|
|
39
|
+
}) })
|
|
40
|
+
}) })] }) : null]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Full-page, cross-agent routine library. This intentionally does not live in
|
|
45
|
+
* ThinkFullApp's per-thread workbench: the host app owns aggregation, routes,
|
|
46
|
+
* authoring callables, and the association between schedules and native runs.
|
|
47
|
+
* The application shell composes `ThinkRoutineBrowser`, `ThinkRoutineDetail`,
|
|
48
|
+
* `ThinkRoutineRuns`, and `ThinkRoutineForm`; consumers may also use those
|
|
49
|
+
* surfaces independently.
|
|
50
|
+
*/
|
|
51
|
+
function ThinkRoutineLibrary({ className, defaultSelectedRoutineId, onCreateRoutine, onDeleteRoutine, onRoutineEnabledChange, onRunRoutine, onRunSelect, onSelectedRoutineIdChange, owners, renderRoutineDetail, schedules, ref, routines, selectedRoutineId, ...props }) {
|
|
52
|
+
const [view, setView] = React.useState("library");
|
|
53
|
+
const [innerSelectedId, setInnerSelectedId] = React.useState(defaultSelectedRoutineId ?? routines[0]?.id ?? "");
|
|
54
|
+
const [busy, setBusy] = React.useState(false);
|
|
55
|
+
const [announcement, setAnnouncement] = React.useState("");
|
|
56
|
+
const [error, setError] = React.useState(null);
|
|
57
|
+
const activeId = selectedRoutineId ?? innerSelectedId;
|
|
58
|
+
const selectedRoutine = routines.find((routine) => routine.id === activeId) ?? (selectedRoutineId === void 0 ? routines[0] : void 0);
|
|
59
|
+
const selectRoutine = (id) => {
|
|
60
|
+
if (selectedRoutineId === void 0) setInnerSelectedId(id);
|
|
61
|
+
onSelectedRoutineIdChange?.(id);
|
|
62
|
+
};
|
|
63
|
+
const perform = async (action, message) => {
|
|
64
|
+
setBusy(true);
|
|
65
|
+
setError(null);
|
|
66
|
+
try {
|
|
67
|
+
await action();
|
|
68
|
+
setAnnouncement(message);
|
|
69
|
+
return true;
|
|
70
|
+
} catch (nextError) {
|
|
71
|
+
setError(errorMessage(nextError));
|
|
72
|
+
return false;
|
|
73
|
+
} finally {
|
|
74
|
+
setBusy(false);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const detailProps = selectedRoutine ? {
|
|
78
|
+
routine: selectedRoutine,
|
|
79
|
+
busy,
|
|
80
|
+
onRunSelect: onRunSelect ? (run) => onRunSelect(selectedRoutine, run) : void 0,
|
|
81
|
+
onEnabledChange: onRoutineEnabledChange ? (enabled) => void perform(() => onRoutineEnabledChange(selectedRoutine, enabled), `${selectedRoutine.name} ${enabled ? "activated" : "paused"}.`) : void 0
|
|
82
|
+
} : void 0;
|
|
83
|
+
if (view === "create") return /* @__PURE__ */ jsxs("div", {
|
|
84
|
+
ref,
|
|
85
|
+
className: cx("think-routine-library", className),
|
|
86
|
+
...props,
|
|
87
|
+
children: [
|
|
88
|
+
error ? /* @__PURE__ */ jsxs("div", {
|
|
89
|
+
className: "think-routine-library__error",
|
|
90
|
+
role: "alert",
|
|
91
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: error })]
|
|
92
|
+
}) : null,
|
|
93
|
+
/* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
94
|
+
"aria-label": "Schedule editor controls",
|
|
95
|
+
children: [/* @__PURE__ */ jsx(AppTopBar.Leading, { children: /* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
96
|
+
label: "Back to schedules",
|
|
97
|
+
onClick: () => setView("library"),
|
|
98
|
+
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
99
|
+
}) }), /* @__PURE__ */ jsx(AppTopBar.Title, { children: "New schedule" })]
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsx(ThinkRoutineForm, {
|
|
102
|
+
busy,
|
|
103
|
+
owners,
|
|
104
|
+
schedules,
|
|
105
|
+
onCancel: () => setView("library"),
|
|
106
|
+
onCreate: (request) => {
|
|
107
|
+
if (!onCreateRoutine) return;
|
|
108
|
+
perform(() => onCreateRoutine(request), `Created ${request.name}.`).then((created) => {
|
|
109
|
+
if (created) setView("library");
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx("div", {
|
|
114
|
+
className: "think-routine-library__status",
|
|
115
|
+
role: "status",
|
|
116
|
+
"aria-atomic": "true",
|
|
117
|
+
children: announcement
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
122
|
+
ref,
|
|
123
|
+
className: cx("think-routine-library", className),
|
|
124
|
+
...props,
|
|
125
|
+
children: [
|
|
126
|
+
error ? /* @__PURE__ */ jsxs("div", {
|
|
127
|
+
className: "think-routine-library__error",
|
|
128
|
+
role: "alert",
|
|
129
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: error })]
|
|
130
|
+
}) : null,
|
|
131
|
+
/* @__PURE__ */ jsx(ResponsiveSidebarShell, {
|
|
132
|
+
className: "think-routine-library__layout",
|
|
133
|
+
sidebarLabel: "schedules",
|
|
134
|
+
toolbarLabel: "Schedule navigation controls",
|
|
135
|
+
showMainLabel: "Show selected schedule",
|
|
136
|
+
topBar: ({ sidebarToggle }) => /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
137
|
+
"aria-label": "Schedule controls",
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ jsx(AppTopBar.Leading, { children: sidebarToggle }),
|
|
140
|
+
/* @__PURE__ */ jsx(AppTopBar.Title, { children: selectedRoutine?.name ?? "Schedules" }),
|
|
141
|
+
/* @__PURE__ */ jsx(RoutineTopBarActions, {
|
|
142
|
+
busy,
|
|
143
|
+
onRun: selectedRoutine && onRunRoutine ? () => void perform(() => onRunRoutine(selectedRoutine), `Started ${selectedRoutine.name}.`) : void 0,
|
|
144
|
+
onDelete: selectedRoutine && onDeleteRoutine ? () => void perform(() => onDeleteRoutine(selectedRoutine), `Deleted ${selectedRoutine.name}.`) : void 0
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
}),
|
|
148
|
+
sidebar: ({ closeSidebarOnCompact }) => /* @__PURE__ */ jsx(ThinkRoutineBrowser, {
|
|
149
|
+
routines,
|
|
150
|
+
selectedRoutineId: selectedRoutine?.id,
|
|
151
|
+
onCreateRoutine: onCreateRoutine ? () => setView("create") : void 0,
|
|
152
|
+
onSelectedRoutineIdChange: (id) => {
|
|
153
|
+
selectRoutine(id);
|
|
154
|
+
closeSidebarOnCompact();
|
|
155
|
+
}
|
|
156
|
+
}),
|
|
157
|
+
children: /* @__PURE__ */ jsx("main", {
|
|
158
|
+
className: "think-routine-library__main",
|
|
159
|
+
children: detailProps ? /* @__PURE__ */ jsx(React.Fragment, { children: renderRoutineDetail ? renderRoutineDetail({
|
|
160
|
+
...detailProps,
|
|
161
|
+
defaultDetail: /* @__PURE__ */ jsx(ThinkRoutineDetail, { ...detailProps })
|
|
162
|
+
}) : /* @__PURE__ */ jsx(ThinkRoutineDetail, { ...detailProps }) }, detailProps.routine.id) : /* @__PURE__ */ jsxs("div", {
|
|
163
|
+
className: "think-routine-library__empty-detail",
|
|
164
|
+
children: [/* @__PURE__ */ jsx("h1", { children: routines.length ? "Schedule unavailable" : "No schedules yet" }), /* @__PURE__ */ jsx("p", { children: routines.length ? "Select an available schedule." : "Create a schedule to run recurring Think prompts." })]
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ jsx("div", {
|
|
169
|
+
className: "think-routine-library__status",
|
|
170
|
+
role: "status",
|
|
171
|
+
"aria-atomic": "true",
|
|
172
|
+
children: announcement
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
export { ThinkRoutineLibrary };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/ThinkRoutineRuns.d.ts
|
|
5
|
+
interface ThinkRoutineRunsProps<TRun extends ThinkExecutionRun = ThinkExecutionRun> extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
|
|
6
|
+
runs: readonly TRun[];
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
emptyState?: React.ReactNode;
|
|
9
|
+
onRunSelect?: (run: TRun) => void;
|
|
10
|
+
}
|
|
11
|
+
/** Compact execution history shared by routine detail surfaces. */
|
|
12
|
+
declare function ThinkRoutineRuns<TRun extends ThinkExecutionRun = ThinkExecutionRun>({
|
|
13
|
+
className,
|
|
14
|
+
runs,
|
|
15
|
+
title,
|
|
16
|
+
emptyState,
|
|
17
|
+
onRunSelect,
|
|
18
|
+
ref,
|
|
19
|
+
...props
|
|
20
|
+
}: ThinkRoutineRunsProps<TRun> & {
|
|
21
|
+
ref?: React.Ref<HTMLElement>;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ThinkRoutineRuns, ThinkRoutineRunsProps };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { Button } from "./Button.js";
|
|
3
|
+
import { Badge } from "./Badge.js";
|
|
4
|
+
import { formatThinkExecutionShortTimestamp, getThinkExecutionRunId, getThinkExecutionRunStatus, isThinkSubmissionRun } from "./ThinkExecutionRun.js";
|
|
5
|
+
import { ThinkExecutionStatus } from "./ThinkExecutionStatus.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ThinkRoutineRuns.tsx
|
|
9
|
+
/** Compact execution history shared by routine detail surfaces. */
|
|
10
|
+
function ThinkRoutineRuns({ className, runs, title = "Recent runs", emptyState = "Run this schedule now or wait for its next occurrence.", onRunSelect, ref, ...props }) {
|
|
11
|
+
const titleId = React.useId();
|
|
12
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
13
|
+
ref,
|
|
14
|
+
className: cx("think-routine-runs", "think-routine-library__runs", className),
|
|
15
|
+
"aria-labelledby": titleId,
|
|
16
|
+
...props,
|
|
17
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: "think-routine-library__section-heading",
|
|
19
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
20
|
+
id: titleId,
|
|
21
|
+
children: title
|
|
22
|
+
}), /* @__PURE__ */ jsx(Badge, {
|
|
23
|
+
variant: "ghost",
|
|
24
|
+
color: "neutral",
|
|
25
|
+
size: "sm",
|
|
26
|
+
"aria-label": `${runs.length} recorded runs`,
|
|
27
|
+
children: runs.length
|
|
28
|
+
})]
|
|
29
|
+
}), runs.length ? /* @__PURE__ */ jsx("ol", {
|
|
30
|
+
className: "think-routine-library__run-list",
|
|
31
|
+
children: runs.map((run) => {
|
|
32
|
+
const status = getThinkExecutionRunStatus(run);
|
|
33
|
+
const kind = isThinkSubmissionRun(run) ? "submission" : "workflow";
|
|
34
|
+
return /* @__PURE__ */ jsx("li", {
|
|
35
|
+
"data-status": status,
|
|
36
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
37
|
+
type: "button",
|
|
38
|
+
variant: "ghost",
|
|
39
|
+
color: "neutral",
|
|
40
|
+
size: "sm",
|
|
41
|
+
className: "think-routine-library__run",
|
|
42
|
+
disabled: !onRunSelect,
|
|
43
|
+
onClick: onRunSelect ? () => onRunSelect(run) : void 0,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx(ThinkExecutionStatus, {
|
|
46
|
+
run,
|
|
47
|
+
className: "think-routine-library__run-marker"
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx("strong", { children: formatThinkExecutionShortTimestamp(run.createdAt, "Not scheduled") }) }),
|
|
50
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
51
|
+
className: "think-routine-library__run-kind",
|
|
52
|
+
variant: "ghost",
|
|
53
|
+
color: "neutral",
|
|
54
|
+
size: "sm",
|
|
55
|
+
children: kind
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
})
|
|
59
|
+
}, `${kind}:${getThinkExecutionRunId(run)}`);
|
|
60
|
+
})
|
|
61
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
62
|
+
className: "think-routine-library__empty-runs",
|
|
63
|
+
children: emptyState
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { ThinkRoutineRuns };
|
|
@@ -19,6 +19,18 @@ interface ThinkThreadItem {
|
|
|
19
19
|
/** Human label for `status` when the raw upstream value is not user-facing. */
|
|
20
20
|
statusLabel?: string;
|
|
21
21
|
}
|
|
22
|
+
interface ThinkThreadStatusSummary {
|
|
23
|
+
/** Threads currently processing a turn. */
|
|
24
|
+
running: number;
|
|
25
|
+
/** Completed or interrupted background threads that have not been reviewed. */
|
|
26
|
+
attention: number;
|
|
27
|
+
/** Threads whose latest turn failed. */
|
|
28
|
+
failed: number;
|
|
29
|
+
}
|
|
30
|
+
interface ThinkThreadStatusIndicatorsProps {
|
|
31
|
+
summary: ThinkThreadStatusSummary;
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
22
34
|
interface ThinkThreadPickerProps extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect" | "title"> {
|
|
23
35
|
/** Threads from the parent agent, already sorted in the order the app wants to show. */
|
|
24
36
|
threads: readonly ThinkThreadItem[];
|
|
@@ -33,6 +45,11 @@ interface ThinkThreadPickerProps extends Omit<React.HTMLAttributes<HTMLElement>,
|
|
|
33
45
|
/** Accessible label for the list navigation. */
|
|
34
46
|
"aria-label"?: string;
|
|
35
47
|
}
|
|
48
|
+
declare function summarizeThinkThreads(threads: readonly Pick<ThinkThreadItem, "status">[]): ThinkThreadStatusSummary;
|
|
49
|
+
declare function ThinkThreadStatusIndicators({
|
|
50
|
+
summary,
|
|
51
|
+
className
|
|
52
|
+
}: ThinkThreadStatusIndicatorsProps): React.JSX.Element | null;
|
|
36
53
|
/**
|
|
37
54
|
* Thread roster UI for sub-agent chat apps.
|
|
38
55
|
*
|
|
@@ -55,4 +72,4 @@ declare function ThinkThreadPicker({
|
|
|
55
72
|
ref?: React.Ref<HTMLElement>;
|
|
56
73
|
}): React.JSX.Element;
|
|
57
74
|
//#endregion
|
|
58
|
-
export { ThinkThreadItem, ThinkThreadPicker, ThinkThreadPickerProps };
|
|
75
|
+
export { ThinkThreadItem, ThinkThreadPicker, ThinkThreadPickerProps, ThinkThreadStatusIndicators, ThinkThreadStatusIndicatorsProps, ThinkThreadStatusSummary, summarizeThinkThreads };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { B as SpinnerIcon, F as PlusIcon, p as DotIcon, q as WarningIcon } from "../icons-CpfUer49.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { ScrollArea } from "./ScrollArea.js";
|
|
5
5
|
import "react";
|
|
@@ -49,6 +49,51 @@ function formatThreadStatus(thread) {
|
|
|
49
49
|
function isThreadBusy(status) {
|
|
50
50
|
return status === "pending" || status === "running" || status === "starting" || status === "streaming" || status === "submitted" || status === "recovering";
|
|
51
51
|
}
|
|
52
|
+
function summarizeThinkThreads(threads) {
|
|
53
|
+
return threads.reduce((summary, thread) => {
|
|
54
|
+
if (isThreadBusy(thread.status)) summary.running += 1;
|
|
55
|
+
else if (thread.status === "error" || thread.status === "failed") summary.failed += 1;
|
|
56
|
+
else if (thread.status === "attention" || thread.status === "completed" || thread.status === "aborted" || thread.status === "interrupted") summary.attention += 1;
|
|
57
|
+
return summary;
|
|
58
|
+
}, {
|
|
59
|
+
running: 0,
|
|
60
|
+
attention: 0,
|
|
61
|
+
failed: 0
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function formatStatusSummary(summary) {
|
|
65
|
+
return [
|
|
66
|
+
summary.running ? `${summary.running} running` : void 0,
|
|
67
|
+
summary.attention ? `${summary.attention} need attention` : void 0,
|
|
68
|
+
summary.failed ? `${summary.failed} failed` : void 0
|
|
69
|
+
].filter(Boolean).join(", ");
|
|
70
|
+
}
|
|
71
|
+
function ThinkThreadStatusIndicators({ summary, className }) {
|
|
72
|
+
const label = formatStatusSummary(summary);
|
|
73
|
+
if (!label) return null;
|
|
74
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
75
|
+
className: cx("think-thread-status-indicators", className),
|
|
76
|
+
role: "img",
|
|
77
|
+
"aria-label": label,
|
|
78
|
+
children: [
|
|
79
|
+
summary.running ? /* @__PURE__ */ jsxs("span", {
|
|
80
|
+
className: "think-thread-status-indicators__item",
|
|
81
|
+
"data-status": "running",
|
|
82
|
+
children: [/* @__PURE__ */ jsx(SpinnerIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: summary.running })]
|
|
83
|
+
}) : null,
|
|
84
|
+
summary.attention ? /* @__PURE__ */ jsxs("span", {
|
|
85
|
+
className: "think-thread-status-indicators__item",
|
|
86
|
+
"data-status": "attention",
|
|
87
|
+
children: [/* @__PURE__ */ jsx(DotIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: summary.attention })]
|
|
88
|
+
}) : null,
|
|
89
|
+
summary.failed ? /* @__PURE__ */ jsxs("span", {
|
|
90
|
+
className: "think-thread-status-indicators__item",
|
|
91
|
+
"data-status": "failed",
|
|
92
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: summary.failed })]
|
|
93
|
+
}) : null
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
52
97
|
/**
|
|
53
98
|
* Thread roster UI for sub-agent chat apps.
|
|
54
99
|
*
|
|
@@ -58,17 +103,18 @@ function isThreadBusy(status) {
|
|
|
58
103
|
* parent Think agent because `listThreads()`/`createThread()` are app-owned.
|
|
59
104
|
*/
|
|
60
105
|
function ThinkThreadPicker({ threads, selectedId, onSelect, onCreate, className, title = "Recents", "aria-label": ariaLabel = "Threads", ref, ...props }) {
|
|
106
|
+
const statusSummary = summarizeThinkThreads(threads);
|
|
61
107
|
return /* @__PURE__ */ jsxs("aside", {
|
|
62
108
|
ref,
|
|
63
109
|
className: cx("think-thread-picker", className),
|
|
64
110
|
...props,
|
|
65
111
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ jsxs("header", {
|
|
67
113
|
className: "think-thread-picker__header",
|
|
68
|
-
children: /* @__PURE__ */ jsx("h2", {
|
|
114
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
69
115
|
className: "think-thread-picker__title",
|
|
70
116
|
children: title
|
|
71
|
-
})
|
|
117
|
+
}), /* @__PURE__ */ jsx(ThinkThreadStatusIndicators, { summary: statusSummary })]
|
|
72
118
|
}),
|
|
73
119
|
/* @__PURE__ */ jsx("nav", {
|
|
74
120
|
className: "think-thread-picker__nav",
|
|
@@ -140,4 +186,4 @@ function ThinkThreadPicker({ threads, selectedId, onSelect, onCreate, className,
|
|
|
140
186
|
});
|
|
141
187
|
}
|
|
142
188
|
//#endregion
|
|
143
|
-
export { ThinkThreadPicker };
|
|
189
|
+
export { ThinkThreadPicker, ThinkThreadStatusIndicators, summarizeThinkThreads };
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
+
import { t as ResponsiveSidebarShell } from "../ResponsiveSidebarShell-Dd9DCcBT.js";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
|
|
3
4
|
//#region src/components/ThinkThreadShell.d.ts
|
|
4
5
|
interface ThinkThreadShellProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
/**
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Thread picker or app-owned sidebar shown beside the selected child shell.
|
|
8
|
+
* Use the render form to close the compact drawer when a thread is selected.
|
|
9
|
+
*/
|
|
10
|
+
sidebar: React.ComponentProps<typeof ResponsiveSidebarShell>["sidebar"];
|
|
7
11
|
/** Whether the thread drawer is open. Omit for internal state. */
|
|
8
12
|
sidebarOpen?: boolean;
|
|
9
13
|
/** Initial thread drawer state when `sidebarOpen` is uncontrolled. */
|
|
10
14
|
defaultSidebarOpen?: boolean;
|
|
11
15
|
/** Called when the thread drawer is opened or closed. */
|
|
12
16
|
onSidebarOpenChange?: (open: boolean) => void;
|
|
17
|
+
/** Application bar composed with the shell-owned thread toggle. */
|
|
18
|
+
topBar?: React.ComponentProps<typeof ResponsiveSidebarShell>["topBar"];
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* Mobile keeps the drawer at about 80% width so the selected chat remains
|
|
18
|
-
* visible as a preview. It only owns layout; callers still own the parent agent,
|
|
19
|
-
* selected child agent, chat hook, and shared workspace.
|
|
21
|
+
* Thread-specific adapter for ResponsiveSidebarShell. Callers still own the
|
|
22
|
+
* parent agent, selected child agent, chat hook, and shared workspace.
|
|
20
23
|
*/
|
|
21
24
|
declare function ThinkThreadShell({
|
|
22
25
|
sidebar,
|
|
23
26
|
sidebarOpen,
|
|
24
27
|
defaultSidebarOpen,
|
|
25
28
|
onSidebarOpenChange,
|
|
26
|
-
|
|
29
|
+
topBar,
|
|
27
30
|
children,
|
|
31
|
+
className,
|
|
28
32
|
ref,
|
|
29
|
-
style,
|
|
30
33
|
...props
|
|
31
34
|
}: ThinkThreadShellProps & {
|
|
32
35
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -1,145 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { Button } from "./Button.js";
|
|
5
|
-
import { Tooltip } from "./Tooltip.js";
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { ResponsiveSidebarShell } from "./ResponsiveSidebarShell.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
4
|
//#region src/components/ThinkThreadShell.tsx
|
|
9
|
-
const threadSidebarDefaultWidth = 256;
|
|
10
|
-
const threadSidebarMinWidth = 224;
|
|
11
|
-
const threadSidebarMaxWidth = 384;
|
|
12
|
-
const threadSidebarKeyboardStep = 24;
|
|
13
|
-
function useControllableSidebar({ sidebarOpen, defaultSidebarOpen, onSidebarOpenChange }) {
|
|
14
|
-
const [innerOpen, setInnerOpen] = React.useState(defaultSidebarOpen ?? true);
|
|
15
|
-
return [sidebarOpen ?? innerOpen, React.useCallback((next) => {
|
|
16
|
-
if (sidebarOpen === void 0) setInnerOpen(next);
|
|
17
|
-
onSidebarOpenChange?.(next);
|
|
18
|
-
}, [sidebarOpen, onSidebarOpenChange])];
|
|
19
|
-
}
|
|
20
|
-
function clampThreadSidebarWidth(width) {
|
|
21
|
-
return Math.min(threadSidebarMaxWidth, Math.max(threadSidebarMinWidth, width));
|
|
22
|
-
}
|
|
23
|
-
function beginThreadSidebarResize(event, current, apply) {
|
|
24
|
-
event.preventDefault();
|
|
25
|
-
const startX = event.clientX;
|
|
26
|
-
const onMove = (move) => {
|
|
27
|
-
apply(clampThreadSidebarWidth(current + move.clientX - startX));
|
|
28
|
-
};
|
|
29
|
-
const onUp = () => {
|
|
30
|
-
window.removeEventListener("pointermove", onMove);
|
|
31
|
-
window.removeEventListener("pointerup", onUp);
|
|
32
|
-
window.removeEventListener("pointercancel", onUp);
|
|
33
|
-
document.body.classList.remove("is-resizing-think-thread-shell");
|
|
34
|
-
};
|
|
35
|
-
document.body.classList.add("is-resizing-think-thread-shell");
|
|
36
|
-
window.addEventListener("pointermove", onMove);
|
|
37
|
-
window.addEventListener("pointerup", onUp);
|
|
38
|
-
window.addEventListener("pointercancel", onUp);
|
|
39
|
-
}
|
|
40
5
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* Mobile keeps the drawer at about 80% width so the selected chat remains
|
|
44
|
-
* visible as a preview. It only owns layout; callers still own the parent agent,
|
|
45
|
-
* selected child agent, chat hook, and shared workspace.
|
|
6
|
+
* Thread-specific adapter for ResponsiveSidebarShell. Callers still own the
|
|
7
|
+
* parent agent, selected child agent, chat hook, and shared workspace.
|
|
46
8
|
*/
|
|
47
|
-
function ThinkThreadShell({ sidebar, sidebarOpen, defaultSidebarOpen, onSidebarOpenChange,
|
|
48
|
-
|
|
49
|
-
|
|
9
|
+
function ThinkThreadShell({ sidebar, sidebarOpen, defaultSidebarOpen, onSidebarOpenChange, topBar, children, className, ref, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(ResponsiveSidebarShell, {
|
|
11
|
+
...props,
|
|
12
|
+
ref,
|
|
13
|
+
className: ["think-thread-shell", className].filter(Boolean).join(" "),
|
|
14
|
+
sidebar,
|
|
15
|
+
sidebarLabel: "threads",
|
|
50
16
|
sidebarOpen,
|
|
51
17
|
defaultSidebarOpen,
|
|
52
|
-
onSidebarOpenChange
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...style,
|
|
58
|
-
"--think-thread-sidebar-w": `${sidebarWidth}px`
|
|
59
|
-
};
|
|
60
|
-
const resizeThreadSidebarBy = (delta) => {
|
|
61
|
-
setSidebarWidth((current) => clampThreadSidebarWidth(current + delta));
|
|
62
|
-
};
|
|
63
|
-
return /* @__PURE__ */ jsx("div", {
|
|
64
|
-
ref,
|
|
65
|
-
className: cx("think-thread-shell", className),
|
|
66
|
-
style: rootStyle,
|
|
67
|
-
...props,
|
|
68
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
69
|
-
className: "think-thread-shell__frame",
|
|
70
|
-
"data-sidebar-open": isSidebarOpen ? "true" : "false",
|
|
71
|
-
children: [
|
|
72
|
-
/* @__PURE__ */ jsx("div", {
|
|
73
|
-
className: "think-thread-shell__toolbar",
|
|
74
|
-
role: "toolbar",
|
|
75
|
-
"aria-label": "Thread controls",
|
|
76
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
77
|
-
className: "think-thread-shell__panel-toggle",
|
|
78
|
-
children: /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
79
|
-
type: "button",
|
|
80
|
-
variant: "ghost",
|
|
81
|
-
color: "neutral",
|
|
82
|
-
size: "icon",
|
|
83
|
-
"aria-label": toggleLabel,
|
|
84
|
-
"aria-controls": sidebarId,
|
|
85
|
-
"aria-expanded": isSidebarOpen,
|
|
86
|
-
"aria-pressed": isSidebarOpen,
|
|
87
|
-
"data-selected": isSidebarOpen,
|
|
88
|
-
onClick: () => setSidebarOpen(!isSidebarOpen),
|
|
89
|
-
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
90
|
-
}) }), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
91
|
-
side: "bottom",
|
|
92
|
-
sideOffset: 6,
|
|
93
|
-
children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: toggleLabel })
|
|
94
|
-
}) })] })
|
|
95
|
-
})
|
|
96
|
-
}),
|
|
97
|
-
isSidebarOpen ? /* @__PURE__ */ jsx(Separator, {
|
|
98
|
-
decorative: false,
|
|
99
|
-
orientation: "vertical",
|
|
100
|
-
tabIndex: 0,
|
|
101
|
-
"aria-label": "Resize threads panel",
|
|
102
|
-
"aria-valuemin": threadSidebarMinWidth,
|
|
103
|
-
"aria-valuemax": threadSidebarMaxWidth,
|
|
104
|
-
"aria-valuenow": sidebarWidth,
|
|
105
|
-
className: "think-resize-handle think-thread-shell__resizer",
|
|
106
|
-
onPointerDown: (event) => beginThreadSidebarResize(event, sidebarWidth, setSidebarWidth),
|
|
107
|
-
onKeyDown: (event) => {
|
|
108
|
-
if (event.key === "ArrowLeft") {
|
|
109
|
-
event.preventDefault();
|
|
110
|
-
resizeThreadSidebarBy(-24);
|
|
111
|
-
} else if (event.key === "ArrowRight") {
|
|
112
|
-
event.preventDefault();
|
|
113
|
-
resizeThreadSidebarBy(threadSidebarKeyboardStep);
|
|
114
|
-
} else if (event.key === "Home") {
|
|
115
|
-
event.preventDefault();
|
|
116
|
-
setSidebarWidth(threadSidebarMinWidth);
|
|
117
|
-
} else if (event.key === "End") {
|
|
118
|
-
event.preventDefault();
|
|
119
|
-
setSidebarWidth(threadSidebarMaxWidth);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}) : null,
|
|
123
|
-
/* @__PURE__ */ jsx("div", {
|
|
124
|
-
id: sidebarId,
|
|
125
|
-
className: "think-thread-shell__sidebar",
|
|
126
|
-
"aria-hidden": isSidebarOpen ? void 0 : true,
|
|
127
|
-
inert: isSidebarOpen ? void 0 : true,
|
|
128
|
-
children: sidebar
|
|
129
|
-
}),
|
|
130
|
-
/* @__PURE__ */ jsx("div", {
|
|
131
|
-
className: "think-thread-shell__main",
|
|
132
|
-
children
|
|
133
|
-
}),
|
|
134
|
-
isSidebarOpen ? /* @__PURE__ */ jsx(Button, {
|
|
135
|
-
variant: "ghost",
|
|
136
|
-
color: "neutral",
|
|
137
|
-
className: "think-thread-shell__peek",
|
|
138
|
-
"aria-label": "Show selected thread",
|
|
139
|
-
onClick: () => setSidebarOpen(false)
|
|
140
|
-
}) : null
|
|
141
|
-
]
|
|
142
|
-
})
|
|
18
|
+
onSidebarOpenChange,
|
|
19
|
+
topBar,
|
|
20
|
+
toolbarLabel: "Thread controls",
|
|
21
|
+
showMainLabel: "Show selected thread",
|
|
22
|
+
children
|
|
143
23
|
});
|
|
144
24
|
}
|
|
145
25
|
//#endregion
|
|
@@ -1,69 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
3
|
-
|
|
4
|
-
//#region src/components/Toggle.d.ts
|
|
5
|
-
interface ToggleVariantsOptions {
|
|
6
|
-
variant?: "default" | "outline" | null;
|
|
7
|
-
size?: "default" | "sm" | "lg" | null;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Props for the Toggle component.
|
|
12
|
-
*/
|
|
13
|
-
interface ToggleProps extends Omit<React.ComponentPropsWithoutRef<typeof Toggle$1>, "className">, ToggleVariantsOptions {}
|
|
14
|
-
declare function toggleVariants({
|
|
15
|
-
variant,
|
|
16
|
-
size,
|
|
17
|
-
className
|
|
18
|
-
}?: ToggleVariantsOptions): string;
|
|
19
|
-
/**
|
|
20
|
-
* A two-state button that can be on (pressed) or off.
|
|
21
|
-
* Useful for toggling a setting or mode.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* // Basic toggle
|
|
26
|
-
* <Toggle>
|
|
27
|
-
* Bold
|
|
28
|
-
* </Toggle>
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```tsx
|
|
33
|
-
* // Controlled toggle
|
|
34
|
-
* const [pressed, setPressed] = useState(false);
|
|
35
|
-
*
|
|
36
|
-
* <Toggle pressed={pressed} onPressedChange={setPressed}>
|
|
37
|
-
* {pressed ? 'On' : 'Off'}
|
|
38
|
-
* </Toggle>
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```tsx
|
|
43
|
-
* // With icons
|
|
44
|
-
* <Toggle>
|
|
45
|
-
* {({ pressed }) => pressed ? <BoldIcon filled /> : <BoldIcon />}
|
|
46
|
-
* </Toggle>
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```tsx
|
|
51
|
-
* // Default pressed state
|
|
52
|
-
* <Toggle defaultPressed>
|
|
53
|
-
* Enabled
|
|
54
|
-
* </Toggle>
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* @see {@link https://base-ui.com/react/components/toggle | Base UI Toggle}
|
|
58
|
-
*/
|
|
59
|
-
declare function Toggle({
|
|
60
|
-
className,
|
|
61
|
-
variant,
|
|
62
|
-
size,
|
|
63
|
-
ref,
|
|
64
|
-
...props
|
|
65
|
-
}: ToggleProps & {
|
|
66
|
-
ref?: React.Ref<HTMLButtonElement>;
|
|
67
|
-
}): React.JSX.Element;
|
|
68
|
-
//#endregion
|
|
1
|
+
import { i as toggleVariants, n as ToggleProps, r as ToggleVariantsOptions, t as Toggle } from "../Toggle-CAAlNl-M.js";
|
|
69
2
|
export { Toggle, ToggleProps, ToggleVariantsOptions, toggleVariants };
|