@mcp-b/react-components 0.16.1 → 0.18.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 → AgentActivity-D2SHSGFX.d.ts} +1 -1
- package/dist/{AgentChat-CrlpbvQJ.d.ts → AgentChat-ClxViuUM.d.ts} +4 -29
- package/dist/AgentMessageParts-CyD2UB3V.d.ts +46 -0
- package/dist/AgentToolRunsContext-BVe4stgw.d.ts +21 -0
- package/dist/{Button-FX_hpqxm.d.ts → Button-DLGzHsjc.d.ts} +13 -7
- package/dist/{CodeBlock-BmB4Xaqq.js → CodeBlock-Bfp5PAg3.js} +9 -6
- package/dist/{CodeBlock-BRajW4QU.d.ts → CodeBlock-gV4kZeCI.d.ts} +2 -9
- package/dist/Collapsible-N64ASIQr.d.ts +119 -0
- package/dist/{Combobox-B9Fcd6q-.d.ts → Combobox-CYc37s5l.d.ts} +11 -33
- package/dist/{FileTree-CkVbIMWV.js → FileTree-3zYtrddG.js} +46 -20
- package/dist/{Menu-Bgu-ufb5.d.ts → Menu-L6MZm-7N.d.ts} +15 -56
- package/dist/{Message-BkMdE3bS.js → Message-BXtmfc9Q.js} +13 -20
- package/dist/{ModelSelector-SlJNgwKY.js → ModelSelector-Cqw_qrUG.js} +18 -25
- package/dist/{PromptInput-BWTuXMOD.d.ts → PromptInput-Bdh9pqlo.d.ts} +41 -71
- package/dist/{ResponsiveSidebarShell-Dd9DCcBT.d.ts → ResponsiveSidebarShell-CsAh4NyL.d.ts} +1 -0
- package/dist/{Select-BeEsefzh.d.ts → Select-B_13gg_J.d.ts} +16 -44
- package/dist/{Tabs-3Zc4tb9D.d.ts → Tabs-ColWK-XA.d.ts} +14 -20
- package/dist/{ThinkChat-CzC-zNGA.js → ThinkChat-15EhfvYJ.js} +123 -73
- package/dist/{ThinkChatActivity-BFQnb2ct.d.ts → ThinkChatActivity-Bzot45kX.d.ts} +9 -4
- package/dist/{ThinkChatActivitySummary-BPmu9a-c.d.ts → ThinkChatActivitySummary-D1xOrNrq.d.ts} +1 -1
- package/dist/{ThinkChatContext-C3Eb1Xpi.d.ts → ThinkChatContext-DrsZqdaO.d.ts} +1 -1
- package/dist/ThinkRecoveryNotice-DFIcG9UX.d.ts +19 -0
- package/dist/{Toggle-CAAlNl-M.d.ts → Toggle-JKZ43D5S.d.ts} +2 -2
- package/dist/{ToggleGroup-8hPv-b69.d.ts → ToggleGroup-DNd6cDJZ.d.ts} +4 -5
- package/dist/Workspace-Jez8ffUj.d.ts +274 -0
- package/dist/WorkspaceExplorer-B9dQWNVK.d.ts +32 -0
- package/dist/{WorkspaceFile-DOZkPwzu.d.ts → WorkspaceFile-CzyHnESE.d.ts} +1 -1
- package/dist/{WorkspaceFileView-rSN_yT0L.js → WorkspaceFileView-C68Ub8S8.js} +121 -128
- package/dist/{WorkspaceLink-DIPbXrUM.js → WorkspaceLink-BYYeTQLf.js} +20 -55
- package/dist/{WorkspaceLink-DK1DWMHe.d.ts → WorkspaceLink-O-EBKUJ8.d.ts} +6 -9
- package/dist/class-names-BiMDVpUo.js +14 -0
- package/dist/components/Accordion.d.ts +5 -15
- package/dist/components/Accordion.js +16 -10
- package/dist/components/Activity.d.ts +5 -10
- package/dist/components/Activity.js +2 -2
- package/dist/components/AgentActivity.d.ts +1 -1
- package/dist/components/AgentActivity.js +4 -5
- package/dist/components/AgentActivityPreview.d.ts +9 -9
- package/dist/components/AgentActivityPreview.js +8 -12
- package/dist/components/AgentAttention.d.ts +2 -2
- package/dist/components/AgentAttention.js +1 -1
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +113 -218
- package/dist/components/AgentChatMessageEditor.js +3 -3
- package/dist/components/AgentChatTurnError.js +2 -2
- package/dist/components/AgentConnection.js +4 -4
- package/dist/components/AgentMessageParts.d.ts +2 -0
- package/dist/components/AgentMessageParts.js +119 -0
- package/dist/components/AgentToolDetail.d.ts +57 -0
- package/dist/components/AgentToolDetail.js +100 -0
- package/dist/components/AgentToolRunsContext.d.ts +2 -0
- package/dist/components/AgentToolRunsContext.js +16 -0
- package/dist/components/AlertDialog.d.ts +7 -19
- package/dist/components/AlertDialog.js +21 -32
- package/dist/components/AppTopBar.d.ts +28 -8
- package/dist/components/AppTopBar.js +36 -12
- package/dist/components/Approval.d.ts +102 -0
- package/dist/components/Approval.js +227 -0
- package/dist/components/Artifact.d.ts +3 -5
- package/dist/components/Artifact.js +7 -5
- package/dist/components/Autocomplete.d.ts +11 -33
- package/dist/components/Autocomplete.js +23 -30
- package/dist/components/Avatar.d.ts +4 -12
- package/dist/components/Avatar.js +13 -12
- package/dist/components/Badge.js +3 -0
- package/dist/components/BrowserLiveView.js +27 -12
- package/dist/components/BrowserReplay.js +4 -3
- package/dist/components/BrowserRunPanel.js +58 -78
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +14 -16
- package/dist/components/Card.d.ts +7 -8
- package/dist/components/Card.js +19 -10
- package/dist/components/ChainOfThought.d.ts +5 -11
- package/dist/components/ChainOfThought.js +3 -2
- package/dist/components/ChatGptSignInScreen.js +8 -8
- package/dist/components/Checkbox.d.ts +2 -4
- package/dist/components/Checkbox.js +6 -5
- package/dist/components/CheckboxGroup.d.ts +1 -3
- package/dist/components/CheckboxGroup.js +15 -14
- package/dist/components/Checkpoint.d.ts +64 -0
- package/dist/components/Checkpoint.js +63 -0
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.d.ts +1 -1
- package/dist/components/CodexModelSelector.js +2 -2
- package/dist/components/Collapsible.d.ts +1 -124
- package/dist/components/Collapsible.js +7 -10
- package/dist/components/Combobox.d.ts +1 -1
- package/dist/components/Combobox.js +23 -30
- package/dist/components/Commit.d.ts +5 -11
- package/dist/components/Commit.js +6 -5
- package/dist/components/Context.js +1 -1
- package/dist/components/ContextMenu.d.ts +21 -37
- package/dist/components/ContextMenu.js +34 -51
- package/dist/components/Conversation.d.ts +3 -5
- package/dist/components/Conversation.js +5 -4
- package/dist/components/DescriptionListParts.js +1 -1
- package/dist/components/Dialog.d.ts +6 -17
- package/dist/components/Dialog.js +17 -24
- package/dist/components/EnvironmentVariables.d.ts +1 -1
- package/dist/components/EnvironmentVariables.js +4 -3
- package/dist/components/Field.d.ts +17 -20
- package/dist/components/Field.js +20 -17
- package/dist/components/Fieldset.d.ts +2 -7
- package/dist/components/Fieldset.js +7 -6
- package/dist/components/FileTree.d.ts +6 -0
- package/dist/components/FileTree.js +1 -1
- package/dist/components/Form.d.ts +1 -4
- package/dist/components/Form.js +3 -2
- package/dist/components/GithubMotionMark.js +1 -1
- package/dist/components/IconButton.d.ts +2 -3
- package/dist/components/IconButton.js +2 -1
- package/dist/components/InlineCitation.d.ts +66 -0
- package/dist/components/InlineCitation.js +142 -0
- package/dist/components/Input.d.ts +1 -4
- package/dist/components/Input.js +3 -2
- package/dist/components/Marker.js +1 -1
- package/dist/components/McpConnectionRequest.js +2 -2
- package/dist/components/McpServerPicker.d.ts +1 -1
- package/dist/components/McpServerPicker.js +6 -5
- package/dist/components/MediaPreviewCard.d.ts +103 -0
- package/dist/components/MediaPreviewCard.js +193 -0
- package/dist/components/Menu.d.ts +1 -1
- package/dist/components/Menu.js +33 -52
- package/dist/components/Menubar.d.ts +22 -43
- package/dist/components/Menubar.js +36 -53
- package/dist/components/Message.d.ts +7 -7
- package/dist/components/Message.js +1 -1
- package/dist/components/MessageScroller.d.ts +2 -2
- package/dist/components/MessageScroller.js +6 -5
- package/dist/components/Meter.d.ts +5 -20
- package/dist/components/Meter.js +11 -10
- package/dist/components/ModelSelector.d.ts +6 -9
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NavigationMenu.d.ts +11 -33
- package/dist/components/NavigationMenu.js +23 -30
- package/dist/components/NumberField.d.ts +6 -24
- package/dist/components/NumberField.js +13 -12
- package/dist/components/Plan.d.ts +103 -0
- package/dist/components/Plan.js +113 -0
- package/dist/components/Popover.d.ts +9 -36
- package/dist/components/Popover.js +23 -34
- package/dist/components/PreviewCard.d.ts +6 -24
- package/dist/components/PreviewCard.js +13 -24
- package/dist/components/PricingBillingToggle.js +1 -1
- package/dist/components/PricingFAQ.js +1 -1
- package/dist/components/PricingPage.js +2 -1
- package/dist/components/PricingPlanCard.js +5 -4
- package/dist/components/PricingUsageCalculator.js +3 -3
- package/dist/components/Progress.d.ts +3 -8
- package/dist/components/Progress.js +7 -10
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +83 -218
- package/dist/components/Queue.d.ts +7 -17
- package/dist/components/Queue.js +2 -3
- package/dist/components/RadioGroup.d.ts +3 -8
- package/dist/components/RadioGroup.js +7 -10
- package/dist/components/Reasoning.d.ts +4 -8
- package/dist/components/Reasoning.js +3 -6
- package/dist/components/ResizableSidePanel.js +2 -2
- package/dist/components/ResponsiveSidebarShell.d.ts +1 -1
- package/dist/components/ResponsiveSidebarShell.js +18 -11
- package/dist/components/ScrollArea.d.ts +5 -20
- package/dist/components/ScrollArea.js +12 -10
- package/dist/components/SearchField.d.ts +43 -0
- package/dist/components/SearchField.js +52 -0
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Select.js +33 -57
- package/dist/components/Separator.d.ts +1 -5
- package/dist/components/Separator.js +3 -6
- package/dist/components/Slider.d.ts +6 -19
- package/dist/components/Slider.js +15 -14
- package/dist/components/Sources.d.ts +4 -9
- package/dist/components/Sources.js +3 -2
- package/dist/components/Stepper.js +16 -9
- package/dist/components/SubagentRunDetails.js +1 -1
- package/dist/components/SubagentRunIndicator.js +2 -2
- package/dist/components/SubagentRunList.d.ts +3 -5
- package/dist/components/SubagentRunList.js +3 -5
- package/dist/components/SubagentRunSelector.d.ts +9 -22
- package/dist/components/SubagentRunSelector.js +29 -31
- package/dist/components/Switch.d.ts +4 -7
- package/dist/components/Switch.js +6 -10
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +21 -18
- package/dist/components/Task.d.ts +4 -9
- package/dist/components/Task.js +4 -3
- package/dist/components/Terminal.d.ts +3 -4
- package/dist/components/Terminal.js +5 -4
- package/dist/components/TestResults.d.ts +4 -9
- package/dist/components/TestResults.js +11 -6
- package/dist/components/Textarea.js +1 -1
- package/dist/components/ThemeModeControl.js +1 -1
- package/dist/components/ThinkChat.d.ts +45 -22
- package/dist/components/ThinkChat.js +7 -5
- package/dist/components/ThinkChatActivity.d.ts +2 -2
- package/dist/components/ThinkChatActivity.js +24 -7
- package/dist/components/ThinkChatActivitySummary.d.ts +1 -1
- package/dist/components/ThinkChatActivitySummary.js +7 -3
- package/dist/components/ThinkChatContext.d.ts +1 -1
- package/dist/components/ThinkChatToolPanels.js +27 -17
- package/dist/components/ThinkExecutionDetail.js +2 -2
- package/dist/components/ThinkExecutionStatus.js +2 -2
- package/dist/components/ThinkExecutionWorkbench.d.ts +30 -8
- package/dist/components/ThinkExecutionWorkbench.js +70 -134
- package/dist/components/ThinkFullApp.d.ts +40 -15
- package/dist/components/ThinkFullApp.js +193 -117
- package/dist/components/ThinkFullAppViewSwitch.d.ts +1 -1
- package/dist/components/ThinkFullAppViewSwitch.js +2 -2
- package/dist/components/ThinkPendingApproval.d.ts +60 -0
- package/dist/components/ThinkPendingApproval.js +99 -0
- package/dist/components/ThinkRecoveryNotice.d.ts +2 -0
- package/dist/components/ThinkRecoveryNotice.js +46 -0
- package/dist/components/ThinkRoutine.js +1 -0
- package/dist/components/ThinkRoutineBrowser.d.ts +17 -9
- package/dist/components/ThinkRoutineBrowser.js +37 -44
- package/dist/components/ThinkRoutineDetail.d.ts +5 -2
- package/dist/components/ThinkRoutineDetail.js +4 -4
- package/dist/components/ThinkRoutineForm.d.ts +3 -2
- package/dist/components/ThinkRoutineForm.js +11 -10
- package/dist/components/ThinkRoutineLibrary.d.ts +27 -25
- package/dist/components/ThinkRoutineLibrary.js +104 -80
- package/dist/components/ThinkRoutineRuns.d.ts +3 -2
- package/dist/components/ThinkRoutineRuns.js +31 -24
- package/dist/components/ThinkThreadPicker.d.ts +17 -11
- package/dist/components/ThinkThreadPicker.js +163 -39
- package/dist/components/ThinkThreadShell.d.ts +1 -1
- package/dist/components/Toast.d.ts +7 -28
- package/dist/components/Toast.js +15 -14
- package/dist/components/Toggle.d.ts +1 -1
- package/dist/components/Toggle.js +10 -8
- package/dist/components/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup.js +21 -26
- package/dist/components/ToolApproval.d.ts +28 -0
- package/dist/components/ToolApproval.js +35 -0
- package/dist/components/ToolInvocation.d.ts +26 -0
- package/dist/components/ToolInvocation.js +72 -0
- package/dist/components/Toolbar.d.ts +6 -24
- package/dist/components/Toolbar.js +13 -12
- package/dist/components/Tooltip.d.ts +11 -10
- package/dist/components/Tooltip.js +17 -11
- package/dist/components/TransitionSurface.d.ts +27 -0
- package/dist/components/TransitionSurface.js +20 -0
- package/dist/components/WebPreview.d.ts +6 -7
- package/dist/components/WebPreview.js +70 -55
- package/dist/components/Workspace.d.ts +2 -2
- package/dist/components/Workspace.js +361 -346
- package/dist/components/WorkspaceBrowser.d.ts +4 -7
- package/dist/components/WorkspaceBrowser.js +16 -26
- package/dist/components/WorkspaceExplorer.d.ts +5 -33
- package/dist/components/WorkspaceExplorer.js +19 -32
- package/dist/components/WorkspaceFile.d.ts +1 -1
- package/dist/components/WorkspaceFileView.d.ts +14 -2
- package/dist/components/WorkspaceFileView.js +1 -1
- package/dist/components/WorkspaceHeader.d.ts +0 -8
- package/dist/components/WorkspaceHeader.js +3 -15
- package/dist/components/WorkspaceLink.d.ts +1 -1
- package/dist/components/WorkspaceLink.js +1 -1
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-DtPMgN7e.d.ts → copy-button-D7aAYA-2.d.ts} +2 -3
- package/dist/{copy-button-Dejn5heL.js → copy-button-DeK6KXEV.js} +3 -2
- package/dist/{icons-CpfUer49.js → icons-CQJ-aMnI.js} +7 -3
- package/dist/{icons-GQd1xF4e.d.ts → icons-CYXmvKlJ.d.ts} +22 -2
- package/dist/navigation-link-Cob7KBlM.js +19 -0
- package/dist/styles/accordion.css +4 -19
- package/dist/styles/activity.css +48 -56
- package/dist/styles/agent-activity-preview.css +6 -0
- package/dist/styles/agent-chat.css +14 -63
- package/dist/styles/agent-connection.css +0 -12
- package/dist/styles/agent-tool-detail.css +54 -0
- package/dist/styles/alert-dialog.css +16 -18
- package/dist/styles/app-top-bar.css +17 -9
- package/dist/styles/approval.css +177 -0
- package/dist/styles/artifact.css +6 -18
- package/dist/styles/autocomplete.css +2 -1
- package/dist/styles/avatar.css +35 -30
- package/dist/styles/badge.css +10 -10
- package/dist/styles/base-ui-motion.css +94 -39
- package/dist/styles/browser-control-overlay.css +0 -1
- package/dist/styles/browser-live-view.css +39 -22
- package/dist/styles/browser-replay.css +1 -1
- package/dist/styles/browser-run-panel.css +13 -6
- package/dist/styles/button.css +36 -33
- package/dist/styles/card.css +5 -6
- package/dist/styles/chain-of-thought.css +22 -24
- package/dist/styles/checkbox.css +18 -5
- package/dist/styles/checkpoint.css +58 -0
- package/dist/styles/codex-model-selector.css +3 -7
- package/dist/styles/collapsible.css +10 -10
- package/dist/styles/combobox.css +4 -3
- package/dist/styles/commit.css +19 -39
- package/dist/styles/composition-motion.css +83 -0
- package/dist/styles/context-menu.css +3 -11
- package/dist/styles/context.css +11 -10
- package/dist/styles/conversation.css +18 -23
- package/dist/styles/dialog.css +15 -15
- package/dist/styles/environment-variables.css +0 -13
- package/dist/styles/field.css +32 -12
- package/dist/styles/file-tree.css +66 -22
- package/dist/styles/form.css +1 -1
- package/dist/styles/index.css +13 -4
- package/dist/styles/inline-citation.css +107 -0
- package/dist/styles/input.css +2 -2
- package/dist/styles/marker.css +14 -13
- package/dist/styles/mcp-server-picker.css +20 -47
- package/dist/styles/media-preview-card.css +160 -0
- package/dist/styles/menu.css +11 -40
- package/dist/styles/menubar.css +12 -19
- package/dist/styles/message-scroller.css +0 -12
- package/dist/styles/message.css +25 -31
- package/dist/styles/meter.css +2 -2
- package/dist/styles/model-selector.css +16 -34
- package/dist/styles/motion-reduction.css +29 -0
- package/dist/styles/navigation-menu.css +14 -30
- package/dist/styles/number-field.css +22 -4
- package/dist/styles/plan.css +132 -0
- package/dist/styles/popover.css +15 -52
- package/dist/styles/preview-card.css +2 -32
- package/dist/styles/progress.css +8 -3
- package/dist/styles/prompt-input.css +76 -269
- package/dist/styles/queue.css +48 -32
- package/dist/styles/radio.css +19 -12
- package/dist/styles/reasoning.css +2 -1
- package/dist/styles/recipes.css +207 -26
- package/dist/styles/resizable-side-panel.css +4 -10
- package/dist/styles/responsive-sidebar-shell.css +32 -34
- package/dist/styles/scroll-area.css +32 -15
- package/dist/styles/search-field.css +21 -0
- package/dist/styles/select.css +19 -12
- package/dist/styles/slider.css +25 -29
- package/dist/styles/sources.css +3 -11
- package/dist/styles/stepper.css +36 -26
- package/dist/styles/subagent-run.css +13 -71
- package/dist/styles/switch.css +32 -29
- package/dist/styles/tabs.css +79 -23
- package/dist/styles/task.css +11 -23
- package/dist/styles/test-results.css +29 -36
- package/dist/styles/theme-mode-control.css +8 -0
- package/dist/styles/think-execution-workbench.css +18 -15
- package/dist/styles/think-full-app.css +51 -100
- package/dist/styles/think-routine-library.css +51 -40
- package/dist/styles/think-thread-picker.css +207 -50
- package/dist/styles/toast.css +48 -34
- package/dist/styles/toggle-group.css +2 -36
- package/dist/styles/toggle.css +29 -5
- package/dist/styles/toolbar.css +25 -27
- package/dist/styles/tooltip.css +2 -32
- package/dist/styles/transition-surface.css +55 -0
- package/dist/styles/utilities.css +31 -0
- package/dist/styles/web-preview.css +0 -21
- package/dist/styles/workspace-explorer.css +104 -99
- package/dist/summarize-tool-input-CqTcGRYy.js +15 -0
- package/dist/think-agent-Cip5KAPj.d.ts +7 -0
- package/dist/utils/codex-model-catalog.d.ts +4 -4
- package/dist/utils/mcp-server-catalog.d.ts +132 -0
- package/dist/utils/mcp-server-catalog.js +90 -0
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/workspace-path-L_KmjRjq.js +26 -0
- package/package.json +14 -9
- package/dist/Workspace-D39LxGvP.d.ts +0 -62
- package/dist/class-names-9UtZwb0J.js +0 -12
- package/dist/components/AppFrame.d.ts +0 -24
- package/dist/components/AppFrame.js +0 -25
- package/dist/components/Shell.d.ts +0 -163
- package/dist/components/Shell.js +0 -137
- package/dist/components/SubagentRun.d.ts +0 -86
- package/dist/components/SubagentRun.js +0 -108
- package/dist/styles/app-frame.css +0 -15
- package/dist/styles/shell.css +0 -122
- package/dist/summarize-tool-input-BUJsENSn.js +0 -12
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Activity, ActivityContent, ActivityPanel, ActivityTrigger } from "./Activity.js";
|
|
2
|
+
import { getToolDisplayName, isToolPartFailed, isToolPartWorking } from "./ThinkChatToolParts.js";
|
|
3
|
+
import { t as summarizeToolInput } from "../summarize-tool-input-CqTcGRYy.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { getToolName } from "ai";
|
|
6
|
+
import { getToolInput, getToolOutput, getToolPartState } from "@cloudflare/think/react";
|
|
7
|
+
//#region src/components/ToolInvocation.tsx
|
|
8
|
+
function formatToolValue(value) {
|
|
9
|
+
if (value === void 0) return void 0;
|
|
10
|
+
return typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
11
|
+
}
|
|
12
|
+
function describeToolPart(part) {
|
|
13
|
+
const name = getToolDisplayName(part);
|
|
14
|
+
let action;
|
|
15
|
+
switch (part.state) {
|
|
16
|
+
case "approval-requested":
|
|
17
|
+
action = `${name} awaiting approval`;
|
|
18
|
+
break;
|
|
19
|
+
case "approval-responded":
|
|
20
|
+
action = part.approval.approved ? `Running ${name}` : `${name} denied`;
|
|
21
|
+
break;
|
|
22
|
+
case "output-error":
|
|
23
|
+
action = `${name} failed`;
|
|
24
|
+
break;
|
|
25
|
+
case "output-denied":
|
|
26
|
+
action = `${name} denied`;
|
|
27
|
+
break;
|
|
28
|
+
case "output-available":
|
|
29
|
+
action = part.preliminary ? `Running ${name}` : `Ran ${name}`;
|
|
30
|
+
break;
|
|
31
|
+
case "input-streaming":
|
|
32
|
+
case "input-available":
|
|
33
|
+
action = `Running ${name}`;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
const detail = summarizeToolInput(getToolInput(part));
|
|
37
|
+
return detail ? `${action} · ${detail}` : action;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Read-only generic disclosure for one upstream AI SDK tool invocation.
|
|
41
|
+
*
|
|
42
|
+
* The component derives its name, state, input, output, denial, and error
|
|
43
|
+
* presentation from the whole `ToolUIPart | DynamicToolUIPart`. Approval
|
|
44
|
+
* response controls belong to transport-aware adapters rather than this
|
|
45
|
+
* transcript renderer. ThinkChat may replace this fallback with richer panels
|
|
46
|
+
* for known workspace, browser, fetch, session, skill, and execute tools.
|
|
47
|
+
*/
|
|
48
|
+
function ToolInvocation({ part, defaultOpen }) {
|
|
49
|
+
const state = getToolPartState(part);
|
|
50
|
+
const failed = isToolPartFailed(part);
|
|
51
|
+
const deniedReason = part.state === "output-denied" ? part.approval.reason : void 0;
|
|
52
|
+
const output = state === "error" ? part.errorText : state === "denied" ? deniedReason ?? "Denied" : formatToolValue(getToolOutput(part));
|
|
53
|
+
const inputStatus = part.state === "approval-requested" ? "awaiting approval" : part.state === "approval-responded" ? part.approval.approved ? "approved" : "denied" : void 0;
|
|
54
|
+
const outputStatus = state === "denied" ? "denied" : failed ? "error" : part.state === "output-available" && part.preliminary ? "preliminary" : void 0;
|
|
55
|
+
return /* @__PURE__ */ jsxs(Activity, {
|
|
56
|
+
isStreaming: isToolPartWorking(part),
|
|
57
|
+
defaultOpen,
|
|
58
|
+
children: [/* @__PURE__ */ jsx(ActivityTrigger, { label: describeToolPart(part) }), /* @__PURE__ */ jsxs(ActivityContent, { children: [/* @__PURE__ */ jsx(ActivityPanel, {
|
|
59
|
+
label: part.title ?? getToolName(part),
|
|
60
|
+
text: formatToolValue(getToolInput(part)),
|
|
61
|
+
status: inputStatus,
|
|
62
|
+
error: inputStatus === "denied"
|
|
63
|
+
}), output !== void 0 ? /* @__PURE__ */ jsx(ActivityPanel, {
|
|
64
|
+
label: "output",
|
|
65
|
+
text: output,
|
|
66
|
+
status: outputStatus,
|
|
67
|
+
error: failed
|
|
68
|
+
}) : null] })]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { ToolInvocation };
|
|
@@ -5,45 +5,27 @@ import { Toolbar as Toolbar$1 } from "@base-ui/react/toolbar";
|
|
|
5
5
|
/**
|
|
6
6
|
* Props for the Toolbar.Root component.
|
|
7
7
|
*/
|
|
8
|
-
interface ToolbarRootProps extends
|
|
9
|
-
/** Additional CSS class names */
|
|
10
|
-
className?: string;
|
|
11
|
-
}
|
|
8
|
+
interface ToolbarRootProps extends React.ComponentPropsWithoutRef<typeof Toolbar$1.Root> {}
|
|
12
9
|
/**
|
|
13
10
|
* Props for the Toolbar.Button component.
|
|
14
11
|
*/
|
|
15
|
-
interface ToolbarButtonProps extends
|
|
16
|
-
/** Additional CSS class names */
|
|
17
|
-
className?: string;
|
|
18
|
-
}
|
|
12
|
+
interface ToolbarButtonProps extends React.ComponentPropsWithoutRef<typeof Toolbar$1.Button> {}
|
|
19
13
|
/**
|
|
20
14
|
* Props for the Toolbar.Link component.
|
|
21
15
|
*/
|
|
22
|
-
interface ToolbarLinkProps extends
|
|
23
|
-
/** Additional CSS class names */
|
|
24
|
-
className?: string;
|
|
25
|
-
}
|
|
16
|
+
interface ToolbarLinkProps extends React.ComponentPropsWithoutRef<typeof Toolbar$1.Link> {}
|
|
26
17
|
/**
|
|
27
18
|
* Props for the Toolbar.Group component.
|
|
28
19
|
*/
|
|
29
|
-
interface ToolbarGroupProps extends
|
|
30
|
-
/** Additional CSS class names */
|
|
31
|
-
className?: string;
|
|
32
|
-
}
|
|
20
|
+
interface ToolbarGroupProps extends React.ComponentPropsWithoutRef<typeof Toolbar$1.Group> {}
|
|
33
21
|
/**
|
|
34
22
|
* Props for the Toolbar.Separator component.
|
|
35
23
|
*/
|
|
36
|
-
interface ToolbarSeparatorProps extends
|
|
37
|
-
/** Additional CSS class names */
|
|
38
|
-
className?: string;
|
|
39
|
-
}
|
|
24
|
+
interface ToolbarSeparatorProps extends React.ComponentPropsWithoutRef<typeof Toolbar$1.Separator> {}
|
|
40
25
|
/**
|
|
41
26
|
* Props for the Toolbar.Input component.
|
|
42
27
|
*/
|
|
43
|
-
interface ToolbarInputProps extends
|
|
44
|
-
/** Additional CSS class names */
|
|
45
|
-
className?: string;
|
|
46
|
-
}
|
|
28
|
+
interface ToolbarInputProps extends React.ComponentPropsWithoutRef<typeof Toolbar$1.Input> {}
|
|
47
29
|
/**
|
|
48
30
|
* Container for grouping toolbar buttons and controls.
|
|
49
31
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-BiMDVpUo.js";
|
|
1
2
|
import "react";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { Toolbar as Toolbar$1 } from "@base-ui/react/toolbar";
|
|
@@ -17,8 +18,8 @@ import { Toolbar as Toolbar$1 } from "@base-ui/react/toolbar";
|
|
|
17
18
|
*
|
|
18
19
|
* @see {@link https://base-ui.com/react/components/toolbar | Base UI Toolbar}
|
|
19
20
|
*/
|
|
20
|
-
function ToolbarRoot({ className
|
|
21
|
-
const classes =
|
|
21
|
+
function ToolbarRoot({ className, ref, ...props }) {
|
|
22
|
+
const classes = mergeBaseClassName("toolbar", className);
|
|
22
23
|
return /* @__PURE__ */ jsx(Toolbar$1.Root, {
|
|
23
24
|
ref,
|
|
24
25
|
"data-slot": "toolbar",
|
|
@@ -29,8 +30,8 @@ function ToolbarRoot({ className = "", ref, ...props }) {
|
|
|
29
30
|
/**
|
|
30
31
|
* A clickable button within the toolbar.
|
|
31
32
|
*/
|
|
32
|
-
function ToolbarButton({ className
|
|
33
|
-
const classes =
|
|
33
|
+
function ToolbarButton({ className, ref, ...props }) {
|
|
34
|
+
const classes = mergeBaseClassName("toolbar__button", className);
|
|
34
35
|
return /* @__PURE__ */ jsx(Toolbar$1.Button, {
|
|
35
36
|
ref,
|
|
36
37
|
"data-slot": "toolbar-button",
|
|
@@ -41,8 +42,8 @@ function ToolbarButton({ className = "", ref, ...props }) {
|
|
|
41
42
|
/**
|
|
42
43
|
* A link element within the toolbar.
|
|
43
44
|
*/
|
|
44
|
-
function ToolbarLink({ className
|
|
45
|
-
const classes =
|
|
45
|
+
function ToolbarLink({ className, ref, ...props }) {
|
|
46
|
+
const classes = mergeBaseClassName("toolbar__link", className);
|
|
46
47
|
return /* @__PURE__ */ jsx(Toolbar$1.Link, {
|
|
47
48
|
ref,
|
|
48
49
|
"data-slot": "toolbar-link",
|
|
@@ -53,8 +54,8 @@ function ToolbarLink({ className = "", ref, ...props }) {
|
|
|
53
54
|
/**
|
|
54
55
|
* Groups toolbar items together.
|
|
55
56
|
*/
|
|
56
|
-
function ToolbarGroup({ className
|
|
57
|
-
const classes =
|
|
57
|
+
function ToolbarGroup({ className, ref, ...props }) {
|
|
58
|
+
const classes = mergeBaseClassName("toolbar__group", className);
|
|
58
59
|
return /* @__PURE__ */ jsx(Toolbar$1.Group, {
|
|
59
60
|
ref,
|
|
60
61
|
"data-slot": "toolbar-group",
|
|
@@ -65,8 +66,8 @@ function ToolbarGroup({ className = "", ref, ...props }) {
|
|
|
65
66
|
/**
|
|
66
67
|
* Visual separator between toolbar sections.
|
|
67
68
|
*/
|
|
68
|
-
function ToolbarSeparator({ className
|
|
69
|
-
const classes =
|
|
69
|
+
function ToolbarSeparator({ className, ref, ...props }) {
|
|
70
|
+
const classes = mergeBaseClassName("toolbar__separator", className);
|
|
70
71
|
return /* @__PURE__ */ jsx(Toolbar$1.Separator, {
|
|
71
72
|
ref,
|
|
72
73
|
"data-slot": "toolbar-separator",
|
|
@@ -77,8 +78,8 @@ function ToolbarSeparator({ className = "", ref, ...props }) {
|
|
|
77
78
|
/**
|
|
78
79
|
* Input element within the toolbar.
|
|
79
80
|
*/
|
|
80
|
-
function ToolbarInput({ className
|
|
81
|
-
const classes =
|
|
81
|
+
function ToolbarInput({ className, ref, ...props }) {
|
|
82
|
+
const classes = mergeBaseClassName("toolbar__input", className);
|
|
82
83
|
return /* @__PURE__ */ jsx(Toolbar$1.Input, {
|
|
83
84
|
ref,
|
|
84
85
|
"data-slot": "toolbar-input",
|
|
@@ -9,15 +9,9 @@ interface TooltipPositionerProps extends Tooltip$1.Positioner.Props {}
|
|
|
9
9
|
interface TooltipProviderProps extends Tooltip$1.Provider.Props {
|
|
10
10
|
delayDuration?: number;
|
|
11
11
|
}
|
|
12
|
-
interface TooltipPopupProps extends
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
interface TooltipViewportProps extends Omit<Tooltip$1.Viewport.Props, "className"> {
|
|
16
|
-
className?: string;
|
|
17
|
-
}
|
|
18
|
-
interface TooltipArrowProps extends Omit<Tooltip$1.Arrow.Props, "className"> {
|
|
19
|
-
className?: string;
|
|
20
|
-
}
|
|
12
|
+
interface TooltipPopupProps extends Tooltip$1.Popup.Props {}
|
|
13
|
+
interface TooltipViewportProps extends Tooltip$1.Viewport.Props {}
|
|
14
|
+
interface TooltipArrowProps extends Tooltip$1.Arrow.Props {}
|
|
21
15
|
/**
|
|
22
16
|
* A tooltip component for displaying helpful information on hover.
|
|
23
17
|
*
|
|
@@ -46,6 +40,13 @@ declare function TooltipProvider({
|
|
|
46
40
|
...props
|
|
47
41
|
}: TooltipProviderProps): React.JSX.Element;
|
|
48
42
|
declare function TooltipTrigger(props: TooltipTriggerProps): React.JSX.Element;
|
|
43
|
+
declare function TooltipPositioner({
|
|
44
|
+
className,
|
|
45
|
+
ref,
|
|
46
|
+
...props
|
|
47
|
+
}: TooltipPositionerProps & {
|
|
48
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
49
|
+
}): React.JSX.Element;
|
|
49
50
|
declare function TooltipPopup({
|
|
50
51
|
className,
|
|
51
52
|
ref,
|
|
@@ -83,7 +84,7 @@ declare const Tooltip: {
|
|
|
83
84
|
Provider: typeof TooltipProvider;
|
|
84
85
|
Trigger: typeof TooltipTrigger;
|
|
85
86
|
Portal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").TooltipPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
86
|
-
Positioner:
|
|
87
|
+
Positioner: typeof TooltipPositioner;
|
|
87
88
|
Popup: typeof TooltipPopup;
|
|
88
89
|
Viewport: typeof TooltipViewport;
|
|
89
90
|
Arrow: typeof TooltipArrow;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-BiMDVpUo.js";
|
|
1
2
|
import "react";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
@@ -36,12 +37,17 @@ function TooltipTrigger(props) {
|
|
|
36
37
|
...props
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
const classes = [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
function TooltipPositioner({ className, ref, ...props }) {
|
|
41
|
+
const classes = mergeBaseClassName(["tooltip__positioner", "base-ui-positioner"].filter(Boolean).join(" "), className);
|
|
42
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
43
|
+
ref,
|
|
44
|
+
"data-slot": "tooltip-positioner",
|
|
45
|
+
className: classes,
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function TooltipPopup({ className, ref, role = "tooltip", ...props }) {
|
|
50
|
+
const classes = mergeBaseClassName(["tooltip__popup", "base-ui-popup"].filter(Boolean).join(" "), className);
|
|
45
51
|
return /* @__PURE__ */ jsx(Tooltip$1.Popup, {
|
|
46
52
|
ref,
|
|
47
53
|
role,
|
|
@@ -55,8 +61,8 @@ function TooltipPopup({ className = "", ref, role = "tooltip", ...props }) {
|
|
|
55
61
|
* triggers. Pair the adaptive classes from `base-ui-motion.css` with the
|
|
56
62
|
* positioner, popup, and this viewport when that behavior is needed.
|
|
57
63
|
*/
|
|
58
|
-
function TooltipViewport({ className
|
|
59
|
-
const classes = ["tooltip__viewport"
|
|
64
|
+
function TooltipViewport({ className, ref, ...props }) {
|
|
65
|
+
const classes = mergeBaseClassName(["tooltip__viewport"].filter(Boolean).join(" "), className);
|
|
60
66
|
return /* @__PURE__ */ jsx(Tooltip$1.Viewport, {
|
|
61
67
|
ref,
|
|
62
68
|
"data-slot": "tooltip-viewport",
|
|
@@ -64,8 +70,8 @@ function TooltipViewport({ className = "", ref, ...props }) {
|
|
|
64
70
|
...props
|
|
65
71
|
});
|
|
66
72
|
}
|
|
67
|
-
function TooltipArrow({ className
|
|
68
|
-
const classes = ["tooltip__arrow"
|
|
73
|
+
function TooltipArrow({ className, ref, ...props }) {
|
|
74
|
+
const classes = mergeBaseClassName(["tooltip__arrow"].filter(Boolean).join(" "), className);
|
|
69
75
|
return /* @__PURE__ */ jsx(Tooltip$1.Arrow, {
|
|
70
76
|
ref,
|
|
71
77
|
"data-slot": "tooltip-arrow",
|
|
@@ -83,7 +89,7 @@ const Tooltip = {
|
|
|
83
89
|
Provider: TooltipProvider,
|
|
84
90
|
Trigger: TooltipTrigger,
|
|
85
91
|
Portal: Tooltip$1.Portal,
|
|
86
|
-
Positioner:
|
|
92
|
+
Positioner: TooltipPositioner,
|
|
87
93
|
Popup: TooltipPopup,
|
|
88
94
|
Viewport: TooltipViewport,
|
|
89
95
|
Arrow: TooltipArrow
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/TransitionSurface.d.ts
|
|
4
|
+
type TransitionSurfaceVariant = "fade" | "scale" | "slide-block" | "slide-inline";
|
|
5
|
+
interface TransitionSurfaceProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* The restrained entrance and hidden-state treatment applied to the surface.
|
|
8
|
+
* Pair separate surfaces around Suspense fallback and resolved content.
|
|
9
|
+
* @default "fade"
|
|
10
|
+
*/
|
|
11
|
+
variant?: TransitionSurfaceVariant;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A lightweight presence surface for content inserted by React or revealed
|
|
15
|
+
* from `hidden`. CSS owns its motion through `@starting-style` and discrete
|
|
16
|
+
* transitions; this component does not own data loading or Suspense state.
|
|
17
|
+
*/
|
|
18
|
+
declare function TransitionSurface({
|
|
19
|
+
className,
|
|
20
|
+
variant,
|
|
21
|
+
ref,
|
|
22
|
+
...props
|
|
23
|
+
}: TransitionSurfaceProps & {
|
|
24
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
25
|
+
}): React.JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { TransitionSurface, TransitionSurfaceProps, TransitionSurfaceVariant };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/TransitionSurface.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A lightweight presence surface for content inserted by React or revealed
|
|
7
|
+
* from `hidden`. CSS owns its motion through `@starting-style` and discrete
|
|
8
|
+
* transitions; this component does not own data loading or Suspense state.
|
|
9
|
+
*/
|
|
10
|
+
function TransitionSurface({ className, variant = "fade", ref, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
ref,
|
|
13
|
+
"data-slot": "transition-surface",
|
|
14
|
+
"data-variant": variant,
|
|
15
|
+
className: cx("transition-surface", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { TransitionSurface };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as ButtonProps } from "../Button-
|
|
1
|
+
import { r as ButtonProps } from "../Button-DLGzHsjc.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/WebPreview.d.ts
|
|
@@ -17,9 +17,9 @@ interface WebPreviewContextValue {
|
|
|
17
17
|
interface WebPreviewProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
18
18
|
/** Initial URL for uncontrolled preview history. */
|
|
19
19
|
defaultUrl?: string;
|
|
20
|
-
/** Controlled URL
|
|
20
|
+
/** Controlled URL. Controlled previews leave history ownership to the caller. */
|
|
21
21
|
url?: string;
|
|
22
|
-
/** Called when
|
|
22
|
+
/** Called when navigation requests a URL change. Controlled callers update `url`. */
|
|
23
23
|
onUrlChange?: (url: string) => void;
|
|
24
24
|
/** Additional class names for layout only; do not override iframe sandboxing from apps. */
|
|
25
25
|
className?: string;
|
|
@@ -28,8 +28,8 @@ interface WebPreviewProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* An iframe preview with a navigation bar, URL input, and optional console
|
|
31
|
-
* panel.
|
|
32
|
-
*
|
|
31
|
+
* panel. Uncontrolled previews track browsing history internally; controlled
|
|
32
|
+
* previews leave history and back/forward behavior to their caller.
|
|
33
33
|
*
|
|
34
34
|
* Built internally for agent/browser preview surfaces. Use it to display a
|
|
35
35
|
* known URL with local navigation controls. Do not use it for trusted app
|
|
@@ -77,8 +77,7 @@ declare function WebPreviewNavigation({
|
|
|
77
77
|
}: WebPreviewNavigationProps & {
|
|
78
78
|
ref?: React.Ref<HTMLDivElement>;
|
|
79
79
|
}): React.JSX.Element;
|
|
80
|
-
interface WebPreviewNavigationButtonProps extends Omit<ButtonProps, "variant" | "size" | "color" | "
|
|
81
|
-
className?: string;
|
|
80
|
+
interface WebPreviewNavigationButtonProps extends Omit<ButtonProps, "variant" | "size" | "color" | "onClick"> {
|
|
82
81
|
action?: "back" | "forward" | "reload";
|
|
83
82
|
label?: string;
|
|
84
83
|
tooltip?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { H as RefreshIcon, i as ArrowRightIcon, r as ArrowLeftIcon, u as ChevronDownIcon } from "../icons-CQJ-aMnI.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { Tooltip } from "./Tooltip.js";
|
|
5
5
|
import { Badge } from "./Badge.js";
|
|
@@ -16,8 +16,8 @@ function useWebPreviewContext() {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* An iframe preview with a navigation bar, URL input, and optional console
|
|
19
|
-
* panel.
|
|
20
|
-
*
|
|
19
|
+
* panel. Uncontrolled previews track browsing history internally; controlled
|
|
20
|
+
* previews leave history and back/forward behavior to their caller.
|
|
21
21
|
*
|
|
22
22
|
* Built internally for agent/browser preview surfaces. Use it to display a
|
|
23
23
|
* known URL with local navigation controls. Do not use it for trusted app
|
|
@@ -46,61 +46,65 @@ function useWebPreviewContext() {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
function WebPreview({ className, defaultUrl = "", url: controlledUrl, onUrlChange, children, ref, ...props }) {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
const [navigation, setNavigation] = React.useState(() => ({
|
|
50
|
+
history: defaultUrl ? [defaultUrl] : [],
|
|
51
|
+
index: defaultUrl ? 0 : -1
|
|
52
|
+
}));
|
|
52
53
|
const [reloadToken, setReloadToken] = React.useState(0);
|
|
53
54
|
const [consoleOpen, setConsoleOpen] = React.useState(false);
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const historyRef = React.useRef(history);
|
|
58
|
-
historyRef.current = history;
|
|
59
|
-
const indexRef = React.useRef(index);
|
|
60
|
-
indexRef.current = index;
|
|
61
|
-
const prevControlledUrlRef = React.useRef(controlledUrl);
|
|
62
|
-
React.useEffect(() => {
|
|
63
|
-
if (controlledUrl === void 0) return;
|
|
64
|
-
if (controlledUrl === prevControlledUrlRef.current) return;
|
|
65
|
-
prevControlledUrlRef.current = controlledUrl;
|
|
66
|
-
if (!controlledUrl) {
|
|
67
|
-
setHistory([]);
|
|
68
|
-
setIndex(-1);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const currentHistory = historyRef.current;
|
|
72
|
-
const currentIndex = indexRef.current;
|
|
73
|
-
if (currentIndex >= 0 && currentHistory[currentIndex] === controlledUrl) return;
|
|
74
|
-
setHistory([...currentHistory.slice(0, currentIndex + 1), controlledUrl]);
|
|
75
|
-
setIndex(currentIndex + 1);
|
|
76
|
-
}, [controlledUrl]);
|
|
55
|
+
const { history, index } = navigation;
|
|
56
|
+
const isControlled = controlledUrl !== void 0;
|
|
57
|
+
const url = controlledUrl ?? (index >= 0 ? history[index] ?? "" : "");
|
|
77
58
|
const setUrl = React.useCallback((next) => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
59
|
+
if (!isControlled) setNavigation((current) => {
|
|
60
|
+
const history = [...current.history.slice(0, current.index + 1), next];
|
|
61
|
+
return {
|
|
62
|
+
history,
|
|
63
|
+
index: history.length - 1
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
onUrlChange?.(next);
|
|
67
|
+
}, [isControlled, onUrlChange]);
|
|
82
68
|
const goBack = React.useCallback(() => {
|
|
83
|
-
|
|
84
|
-
|
|
69
|
+
if (isControlled) return;
|
|
70
|
+
const nextIndex = Math.max(0, index - 1);
|
|
71
|
+
if (nextIndex === index) return;
|
|
72
|
+
setNavigation((current) => ({
|
|
73
|
+
...current,
|
|
74
|
+
index: nextIndex
|
|
75
|
+
}));
|
|
76
|
+
onUrlChange?.(history[nextIndex] ?? "");
|
|
77
|
+
}, [
|
|
78
|
+
history,
|
|
79
|
+
index,
|
|
80
|
+
isControlled,
|
|
81
|
+
onUrlChange
|
|
82
|
+
]);
|
|
85
83
|
const goForward = React.useCallback(() => {
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
if (isControlled) return;
|
|
85
|
+
const nextIndex = Math.min(history.length - 1, index + 1);
|
|
86
|
+
if (nextIndex === index) return;
|
|
87
|
+
setNavigation((current) => ({
|
|
88
|
+
...current,
|
|
89
|
+
index: nextIndex
|
|
90
|
+
}));
|
|
91
|
+
onUrlChange?.(history[nextIndex] ?? "");
|
|
92
|
+
}, [
|
|
93
|
+
history,
|
|
94
|
+
index,
|
|
95
|
+
isControlled,
|
|
96
|
+
onUrlChange
|
|
97
|
+
]);
|
|
88
98
|
const reload = React.useCallback(() => {
|
|
89
99
|
setReloadToken((n) => n + 1);
|
|
90
100
|
}, []);
|
|
91
|
-
const prevIndexRef = React.useRef(index);
|
|
92
|
-
React.useEffect(() => {
|
|
93
|
-
if (index === prevIndexRef.current) return;
|
|
94
|
-
prevIndexRef.current = index;
|
|
95
|
-
if (index >= 0) onUrlChangeRef.current?.(history[index] ?? "");
|
|
96
|
-
}, [index, history]);
|
|
97
101
|
const ctxValue = React.useMemo(() => ({
|
|
98
102
|
url,
|
|
99
103
|
setUrl,
|
|
100
104
|
consoleOpen,
|
|
101
105
|
setConsoleOpen,
|
|
102
|
-
canGoBack: index > 0,
|
|
103
|
-
canGoForward: index >= 0 && index < history.length - 1,
|
|
106
|
+
canGoBack: !isControlled && index > 0,
|
|
107
|
+
canGoForward: !isControlled && index >= 0 && index < history.length - 1,
|
|
104
108
|
goBack,
|
|
105
109
|
goForward,
|
|
106
110
|
reload,
|
|
@@ -109,6 +113,7 @@ function WebPreview({ className, defaultUrl = "", url: controlledUrl, onUrlChang
|
|
|
109
113
|
url,
|
|
110
114
|
setUrl,
|
|
111
115
|
consoleOpen,
|
|
116
|
+
isControlled,
|
|
112
117
|
index,
|
|
113
118
|
history.length,
|
|
114
119
|
goBack,
|
|
@@ -122,6 +127,7 @@ function WebPreview({ className, defaultUrl = "", url: controlledUrl, onUrlChang
|
|
|
122
127
|
ref,
|
|
123
128
|
className: cx("web-preview", className),
|
|
124
129
|
...props,
|
|
130
|
+
"data-recipe": "framed-panel",
|
|
125
131
|
children
|
|
126
132
|
})
|
|
127
133
|
});
|
|
@@ -163,7 +169,8 @@ function WebPreviewNavigationButton({ className, action, label, tooltip, childre
|
|
|
163
169
|
};
|
|
164
170
|
const button = /* @__PURE__ */ jsx(Button, {
|
|
165
171
|
variant: "ghost",
|
|
166
|
-
size: "
|
|
172
|
+
size: "sm",
|
|
173
|
+
iconOnly: true,
|
|
167
174
|
"aria-label": resolvedLabel,
|
|
168
175
|
disabled: def?.disabled,
|
|
169
176
|
className: cx("web-preview__nav-button", action && `web-preview__nav-button--${action}`, className),
|
|
@@ -176,11 +183,16 @@ function WebPreviewNavigationButton({ className, action, label, tooltip, childre
|
|
|
176
183
|
}
|
|
177
184
|
function WebPreviewUrl({ className, placeholder = "Enter URL…", value, onChange, onKeyDown, ref, ...props }) {
|
|
178
185
|
const { url, setUrl } = useWebPreviewContext();
|
|
179
|
-
const [draft, setDraft] = React.useState(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
const [draft, setDraft] = React.useState(() => ({
|
|
187
|
+
url,
|
|
188
|
+
value: url
|
|
189
|
+
}));
|
|
190
|
+
if (draft.url !== url) setDraft({
|
|
191
|
+
url,
|
|
192
|
+
value: url
|
|
193
|
+
});
|
|
194
|
+
const derivedDraft = draft.url === url ? draft.value : url;
|
|
195
|
+
const inputValue = value ?? derivedDraft;
|
|
184
196
|
return /* @__PURE__ */ jsx("form", {
|
|
185
197
|
className: "web-preview__url-form",
|
|
186
198
|
onSubmit: (e) => {
|
|
@@ -193,7 +205,10 @@ function WebPreviewUrl({ className, placeholder = "Enter URL…", value, onChang
|
|
|
193
205
|
type: "text",
|
|
194
206
|
value: inputValue,
|
|
195
207
|
onChange: (e) => {
|
|
196
|
-
setDraft(
|
|
208
|
+
setDraft({
|
|
209
|
+
url,
|
|
210
|
+
value: e.target.value
|
|
211
|
+
});
|
|
197
212
|
onChange?.(e);
|
|
198
213
|
},
|
|
199
214
|
onKeyDown: (e) => {
|
|
@@ -217,7 +232,7 @@ function WebPreviewBody({ className, loading, src, ref, interactive = true, ...p
|
|
|
217
232
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("iframe", {
|
|
218
233
|
ref,
|
|
219
234
|
src: iframeSrc,
|
|
220
|
-
sandbox: "allow-scripts allow-
|
|
235
|
+
sandbox: "allow-scripts allow-forms allow-popups allow-presentation",
|
|
221
236
|
title: "Web preview",
|
|
222
237
|
className: cx("web-preview__body", !interactive && "web-preview__body--readonly", className),
|
|
223
238
|
...props
|
|
@@ -246,7 +261,7 @@ function WebPreviewConsole({ className, logs = [], children, ref, ...props }) {
|
|
|
246
261
|
children: [/* @__PURE__ */ jsxs(ScrollArea.Viewport, {
|
|
247
262
|
className: "web-preview__console-viewport",
|
|
248
263
|
children: [/* @__PURE__ */ jsx("ul", {
|
|
249
|
-
className: "web-preview__console-list",
|
|
264
|
+
className: "web-preview__console-list sigvelo-stack-list",
|
|
250
265
|
children: logs.length === 0 ? /* @__PURE__ */ jsx("li", {
|
|
251
266
|
className: "web-preview__console-empty",
|
|
252
267
|
children: "No console output"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { UseWorkspaceOptions, WorkspaceInfo, WorkspaceSource, WorkspaceState, useWorkspace };
|
|
1
|
+
import { a as WorkspaceSource, c as workspaceBinaryFileQueryOptions, d as workspaceFileStatQueryOptions, f as workspaceInfoQueryOptions, i as WorkspaceQueryKey, l as workspaceDirectoryQueryOptions, m as workspaceTextFileQueryOptions, n as WorkspaceFileReadTarget, o as WorkspaceState, p as workspaceQueryKey, r as WorkspaceInfo, s as useWorkspace, t as UseWorkspaceOptions, u as workspaceFileAssetQueryOptions } from "../Workspace-Jez8ffUj.js";
|
|
2
|
+
export { UseWorkspaceOptions, WorkspaceFileReadTarget, WorkspaceInfo, WorkspaceQueryKey, WorkspaceSource, WorkspaceState, useWorkspace, workspaceBinaryFileQueryOptions, workspaceDirectoryQueryOptions, workspaceFileAssetQueryOptions, workspaceFileStatQueryOptions, workspaceInfoQueryOptions, workspaceQueryKey, workspaceTextFileQueryOptions };
|