@marimo-team/islands 0.23.7-dev9 → 0.23.7
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/{ConnectedDataExplorerComponent-DnRhpPMJ.js → ConnectedDataExplorerComponent-2lBNiUv6.js} +13 -13
- package/dist/{ErrorBoundary-Da4UeYxT.js → ErrorBoundary-D3wrPNma.js} +1 -1
- package/dist/{any-language-editor-DDubl8YH.js → any-language-editor-VWs_7v27.js} +5 -5
- package/dist/assets/__vite-browser-external-CAdMKBac.js +1 -0
- package/dist/assets/worker-CpBbwbQo.js +73 -0
- package/dist/{button-CA5pI2YF.js → button-Dj4BTre0.js} +5 -0
- package/dist/{capabilities-6laDasij.js → capabilities-C9rrYCzf.js} +1 -1
- package/dist/{chat-ui-BmWZZ3mE.js → chat-ui-D3XBept8.js} +625 -233
- package/dist/{check-CFM2mVDr.js → check-BcUIXnUT.js} +1 -1
- package/dist/{code-visibility-CRHzv49w.js → code-visibility-sKGUbHmr.js} +11480 -1992
- package/dist/{copy-TGGAUEWp.js → copy-DLf4aN7I.js} +2 -2
- package/dist/{dist-ESg7xyoD.js → dist-D3ZI9nhS.js} +2 -2
- package/dist/{error-banner-DnBPzEWg.js → error-banner-CVkfBUT3.js} +2 -2
- package/dist/{esm-Dd1z1auZ.js → esm-CWp0KQeK.js} +1 -1
- package/dist/{extends-CzJgxo2J.js → extends-vAi97cpa.js} +4 -4
- package/dist/{formats-CgaK7Gmx.js → formats-Dsy9kkZu.js} +3 -3
- package/dist/{glide-data-editor-B-3A3G02.js → glide-data-editor-DucgdjRo.js} +9 -9
- package/dist/{html-to-image-BwZL1Pkk.js → html-to-image-CpggM7u1.js} +2667 -2408
- package/dist/{input-BAOe64zx.js → input-D4kjoQUB.js} +8 -6
- package/dist/{label-BCWi-Oqu.js → label-BLqV33b1.js} +2 -2
- package/dist/{loader-BvW0-YWZ.js → loader-Dr8Qem8p.js} +1 -1
- package/dist/main.js +1697 -10282
- package/dist/{mermaid-cXSZ1pfD.js → mermaid-DO-Daq7u.js} +5 -5
- package/dist/{process-output-lpVrk7d5.js → process-output-X8TR20AK.js} +3 -3
- package/dist/reveal-component-BBAxPTso.js +7447 -0
- package/dist/{spec-DSIuqd3f.js → spec-hVaaZsY5.js} +4 -4
- package/dist/{strings-B_FOH6eV.js → strings-BiIhGaI8.js} +4 -4
- package/dist/style.css +1 -1
- package/dist/{swiper-component-BHs0PWwp.js → swiper-component-DlD2GU2g.js} +2 -2
- package/dist/{toDate-CHtl9vts.js → toDate-CIpC_34u.js} +33 -20
- package/dist/{tooltip-B0mtKTXm.js → tooltip-DRaMBu06.js} +3 -3
- package/dist/{types-DBtDeUKD.js → types-Dzuoc3LN.js} +1 -1
- package/dist/{useAsyncData-B6hCGywC.js → useAsyncData-C56Khv_R.js} +1 -1
- package/dist/{useDateFormatter-B3mCQMP3.js → useDateFormatter-B_9k85Ex.js} +2 -2
- package/dist/{useDeepCompareMemoize-CmwDuYUH.js → useDeepCompareMemoize-Dt98v2ua.js} +1 -1
- package/dist/{useIframeCapabilities-DbdLoEDm.js → useIframeCapabilities-BkYHTrss.js} +1 -1
- package/dist/{useLifecycle-CjMjllqy.js → useLifecycle-BF6-z62y.js} +3 -3
- package/dist/{useTheme-CByZUW0p.js → useTheme-DykuNHR2.js} +2 -2
- package/dist/{vega-component-C2BYPkfd.js → vega-component-cSdqoAxe.js} +10 -10
- package/dist/{zod-BxdsqRPd.js → zod-BWkcDORu.js} +1 -1
- package/package.json +3 -3
- package/src/components/chat/chat-components.tsx +47 -0
- package/src/components/chat/chat-display.tsx +41 -7
- package/src/components/chat/chat-panel.tsx +37 -10
- package/src/components/chat/chat-utils.ts +42 -20
- package/src/components/chat/reasoning-accordion.tsx +14 -3
- package/src/components/chat/tool-call/shared.ts +13 -0
- package/src/components/chat/tool-call/tool-approval-card.tsx +62 -0
- package/src/components/chat/tool-call/tool-args.tsx +26 -0
- package/src/components/chat/tool-call/tool-call-view.tsx +99 -0
- package/src/components/chat/tool-call/tool-error-card.tsx +81 -0
- package/src/components/chat/tool-call/tool-history-row.tsx +153 -0
- package/src/components/chat/tool-call/tool-result.tsx +101 -0
- package/src/components/data-table/__tests__/column-header.test.ts +3 -1
- package/src/components/data-table/__tests__/column-header.test.tsx +308 -0
- package/src/components/data-table/__tests__/filter-by-values-picker.test.tsx +112 -0
- package/src/components/data-table/__tests__/filter-pill-editor.test.tsx +261 -0
- package/src/components/data-table/__tests__/filters.test.ts +196 -49
- package/src/components/data-table/charts/components/form-fields.tsx +1 -0
- package/src/components/data-table/column-header.tsx +349 -170
- package/src/components/data-table/date-filter-inputs.tsx +325 -0
- package/src/components/data-table/filter-by-values-picker.tsx +70 -9
- package/src/components/data-table/filter-pill-editor.tsx +410 -156
- package/src/components/data-table/filter-pills.tsx +69 -54
- package/src/components/data-table/filters.ts +218 -101
- package/src/components/data-table/header-items.tsx +8 -1
- package/src/components/data-table/operator-labels.ts +25 -0
- package/src/components/data-table/regex-input.tsx +61 -0
- package/src/components/dependency-graph/minimap-content.tsx +14 -3
- package/src/components/editor/actions/pair-with-agent-modal.tsx +140 -49
- package/src/components/editor/actions/useNotebookActions.tsx +3 -1
- package/src/components/editor/app-container.tsx +7 -1
- package/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx +10 -2
- package/src/components/editor/chrome/wrapper/app-chrome.tsx +1 -0
- package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +1 -1
- package/src/components/editor/chrome/wrapper/footer.tsx +4 -1
- package/src/components/editor/chrome/wrapper/panels.tsx +4 -1
- package/src/components/editor/chrome/wrapper/sidebar.tsx +4 -1
- package/src/components/editor/controls/Controls.tsx +11 -3
- package/src/components/editor/file-tree/file-explorer.tsx +12 -2
- package/src/components/editor/header/__tests__/status.test.tsx +108 -0
- package/src/components/editor/header/status.tsx +44 -10
- package/src/components/editor/navigation/__tests__/clipboard.test.ts +106 -0
- package/src/components/editor/navigation/__tests__/navigation.test.ts +70 -0
- package/src/components/editor/navigation/clipboard.ts +99 -25
- package/src/components/editor/navigation/navigation.ts +15 -1
- package/src/components/editor/notebook-cell.tsx +5 -0
- package/src/components/editor/output/console/ConsoleOutput.tsx +23 -5
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +114 -0
- package/src/components/editor/renderers/slides-layout/__tests__/compute-slide-cells.test.ts +5 -4
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +55 -15
- package/src/components/editor/renderers/slides-layout/plugin.tsx +8 -25
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +19 -6
- package/src/components/editor/renderers/slides-layout/types.ts +40 -31
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -0
- package/src/components/home/components.tsx +6 -0
- package/src/components/pages/run-page.tsx +4 -1
- package/src/components/scratchpad/scratchpad.tsx +1 -0
- package/src/components/slides/__tests__/slide-notes.test.ts +131 -0
- package/src/components/slides/reveal-component.tsx +252 -147
- package/src/components/slides/slide-notes-editor.tsx +127 -0
- package/src/components/slides/slide-notes.ts +64 -0
- package/src/components/slides/slides.css +14 -0
- package/src/components/ui/combobox.tsx +24 -5
- package/src/components/ui/number-field.tsx +2 -0
- package/src/core/ai/tools/__tests__/registry.test.ts +10 -12
- package/src/core/ai/tools/registry.ts +9 -5
- package/src/core/cells/__tests__/cells.test.ts +187 -0
- package/src/core/cells/__tests__/pending-cut-service.test.tsx +123 -0
- package/src/core/cells/cells.ts +102 -17
- package/src/core/cells/document-changes.ts +6 -1
- package/src/core/cells/pending-cut-service.ts +55 -0
- package/src/core/cells/utils.ts +11 -0
- package/src/core/codemirror/cells/extensions.ts +10 -0
- package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +152 -0
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +99 -0
- package/src/core/codemirror/go-to-definition/commands.ts +382 -22
- package/src/core/codemirror/go-to-definition/utils.ts +23 -5
- package/src/core/edit-app.tsx +3 -2
- package/src/core/hotkeys/hotkeys.ts +5 -0
- package/src/core/islands/worker/worker.tsx +3 -2
- package/src/core/run-app.tsx +2 -1
- package/src/core/runtime/__tests__/runtime.test.ts +38 -17
- package/src/core/runtime/runtime.ts +57 -34
- package/src/core/wasm/__tests__/utils.test.ts +34 -0
- package/src/core/wasm/utils.ts +14 -0
- package/src/core/wasm/worker/bootstrap.ts +3 -2
- package/src/core/wasm/worker/worker.ts +3 -2
- package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +156 -0
- package/src/core/websocket/__tests__/useMarimoKernelConnection.test.ts +101 -0
- package/src/core/websocket/transports/__tests__/ws.test.ts +125 -0
- package/src/core/websocket/transports/basic.ts +1 -1
- package/src/core/websocket/transports/ws.ts +96 -0
- package/src/core/websocket/useMarimoKernelConnection.tsx +133 -54
- package/src/core/websocket/useWebSocket.tsx +3 -15
- package/src/css/app/Cell.css +10 -0
- package/src/plugins/core/__test__/sanitize.test.ts +30 -0
- package/src/plugins/impl/DropdownPlugin.tsx +12 -1
- package/src/plugins/impl/MultiselectPlugin.tsx +4 -0
- package/src/plugins/impl/SearchableSelect.tsx +11 -1
- package/src/plugins/impl/TabsPlugin.tsx +35 -7
- package/src/plugins/impl/__tests__/DropdownPlugin.test.tsx +56 -0
- package/src/plugins/impl/__tests__/TabsPlugin.test.tsx +154 -0
- package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +48 -36
- package/src/plugins/impl/data-frames/schema.ts +4 -1
- package/src/plugins/layout/DownloadPlugin.tsx +9 -7
- package/src/utils/__tests__/id-tree.test.ts +71 -0
- package/src/utils/download.ts +4 -2
- package/src/utils/id-tree.tsx +89 -0
- package/dist/assets/__vite-browser-external-rrUYDKRl.js +0 -1
- package/dist/assets/worker-Bfy15ViQ.js +0 -73
- package/dist/reveal-component-C97Ceb7e.js +0 -4863
- package/src/components/chat/tool-call-accordion.tsx +0 -247
|
@@ -21,6 +21,7 @@ import { extractCellPreview } from "./utils/cell-preview";
|
|
|
21
21
|
|
|
22
22
|
interface MinimapCellProps {
|
|
23
23
|
cellId: CellId;
|
|
24
|
+
index: number;
|
|
24
25
|
cellPositions: Readonly<Record<CellId, number>>;
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -67,7 +68,7 @@ const MinimapCell: React.FC<MinimapCellProps> = (props) => {
|
|
|
67
68
|
className={cn(
|
|
68
69
|
"group bg-transparent text-left w-full flex relative justify-between items-center",
|
|
69
70
|
"border-none rounded cursor-pointer",
|
|
70
|
-
"h-[21px] pl-[
|
|
71
|
+
"h-[21px] pl-[59px] font-inherit",
|
|
71
72
|
isSelected
|
|
72
73
|
? "text-primary-foreground"
|
|
73
74
|
: "text-(--gray-8) hover:text-(--gray-9)",
|
|
@@ -78,6 +79,12 @@ const MinimapCell: React.FC<MinimapCellProps> = (props) => {
|
|
|
78
79
|
// transitions from current cell -> null -> new cell.
|
|
79
80
|
onMouseDown={(e) => e.preventDefault()}
|
|
80
81
|
>
|
|
82
|
+
<span
|
|
83
|
+
className="absolute left-0 top-0 h-full w-5 flex items-center justify-end pr-1.5 text-[10px] tabular-nums pointer-events-none select-none text-(--gray-9)"
|
|
84
|
+
aria-hidden="true"
|
|
85
|
+
>
|
|
86
|
+
{props.index}
|
|
87
|
+
</span>
|
|
81
88
|
<div
|
|
82
89
|
className={cn(
|
|
83
90
|
"group-hover:bg-(--gray-2) flex h-full w-full px-0.5 items-center rounded",
|
|
@@ -99,7 +106,7 @@ const MinimapCell: React.FC<MinimapCellProps> = (props) => {
|
|
|
99
106
|
</div>
|
|
100
107
|
<svg
|
|
101
108
|
className={cn(
|
|
102
|
-
"absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)+
|
|
109
|
+
"absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)+25px)] pointer-events-none",
|
|
103
110
|
isSelected ? "z-[1]" : "z-0",
|
|
104
111
|
getTextColor({ cell, selectedCell }),
|
|
105
112
|
)}
|
|
@@ -404,7 +411,11 @@ export const MinimapContent: React.FC = () => {
|
|
|
404
411
|
aria-hidden="true"
|
|
405
412
|
/>
|
|
406
413
|
)}
|
|
407
|
-
<MinimapCell
|
|
414
|
+
<MinimapCell
|
|
415
|
+
cellId={cellId}
|
|
416
|
+
index={idx}
|
|
417
|
+
cellPositions={cellPositions}
|
|
418
|
+
/>
|
|
408
419
|
</React.Fragment>
|
|
409
420
|
);
|
|
410
421
|
})}
|
|
@@ -18,14 +18,16 @@ import { assertNever } from "@/utils/assertNever";
|
|
|
18
18
|
import { asRemoteURL, useRuntimeManager } from "@/core/runtime/config";
|
|
19
19
|
import { API } from "@/core/network/api";
|
|
20
20
|
|
|
21
|
-
type AgentTab = "claude" | "codex" | "opencode";
|
|
21
|
+
type AgentTab = "claude" | "codex" | "opencode" | "prompt";
|
|
22
|
+
|
|
23
|
+
const TERMINAL_TABS = ["claude", "codex", "opencode"] as const;
|
|
22
24
|
|
|
23
25
|
function getMarimoCommand(): string {
|
|
24
26
|
return import.meta.env.DEV ? "uv run marimo" : "uvx marimo@latest";
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
function
|
|
28
|
-
agent: AgentTab,
|
|
29
|
+
function getTerminalCommand(
|
|
30
|
+
agent: Exclude<AgentTab, "prompt">,
|
|
29
31
|
url: string,
|
|
30
32
|
withToken: boolean,
|
|
31
33
|
): string {
|
|
@@ -43,6 +45,21 @@ function getPromptCommand(
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
function getRawPrompt(url: string, token: string | null): string {
|
|
49
|
+
const tokenHint = token
|
|
50
|
+
? `\n\nUse this auth token when calling \`execute-code.sh\`: \`execute-code.sh --url '${url}' --token '${token}'\`.`
|
|
51
|
+
: "";
|
|
52
|
+
return [
|
|
53
|
+
"Use the /marimo-pair skill to pair-program on a running marimo notebook.",
|
|
54
|
+
"",
|
|
55
|
+
`Connect to the notebook at: ${url}`,
|
|
56
|
+
"",
|
|
57
|
+
`Use \`execute-code.sh --url ${url}\` from the marimo-pair skill to execute code in the notebook.${tokenHint}`,
|
|
58
|
+
"",
|
|
59
|
+
"Once you are connected, send a fun toast (mo.status.toast(...)) to the user inside marimo letting them know you're ready to pair.",
|
|
60
|
+
].join("\n");
|
|
61
|
+
}
|
|
62
|
+
|
|
46
63
|
function maskToken(token: string): string {
|
|
47
64
|
if (token.length <= 4) {
|
|
48
65
|
return "****";
|
|
@@ -52,6 +69,13 @@ function maskToken(token: string): string {
|
|
|
52
69
|
|
|
53
70
|
const SKILL_INSTALL = "npx skills add marimo-team/marimo-pair";
|
|
54
71
|
|
|
72
|
+
const AGENT_LABELS: Record<AgentTab, string> = {
|
|
73
|
+
claude: "Claude",
|
|
74
|
+
codex: "Codex",
|
|
75
|
+
opencode: "OpenCode",
|
|
76
|
+
prompt: "Prompt",
|
|
77
|
+
};
|
|
78
|
+
|
|
55
79
|
function useAuthToken(): string | null {
|
|
56
80
|
const [token, setToken] = useState<string | null>(null);
|
|
57
81
|
useEffect(() => {
|
|
@@ -75,10 +99,9 @@ export const PairWithAgentModal: React.FC<{
|
|
|
75
99
|
const authToken = useAuthToken();
|
|
76
100
|
const hasToken = Boolean(authToken);
|
|
77
101
|
const remoteUrl = runtimeManager.httpURL.toString();
|
|
78
|
-
const promptCommand = getPromptCommand(activeTab, remoteUrl, hasToken);
|
|
79
102
|
|
|
80
103
|
return (
|
|
81
|
-
<DialogContent className="sm:max-w-
|
|
104
|
+
<DialogContent className="sm:max-w-2xl">
|
|
82
105
|
<DialogHeader>
|
|
83
106
|
<DialogTitle>Pair with an agent</DialogTitle>
|
|
84
107
|
<DialogDescription>
|
|
@@ -96,49 +119,75 @@ export const PairWithAgentModal: React.FC<{
|
|
|
96
119
|
</DialogHeader>
|
|
97
120
|
|
|
98
121
|
<div className="flex flex-col gap-4 py-2">
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
value={activeTab}
|
|
108
|
-
onValueChange={(v) => setActiveTab(v as AgentTab)}
|
|
109
|
-
>
|
|
110
|
-
<TabsList className="w-full">
|
|
111
|
-
<TabsTrigger value="claude" className="flex-1">
|
|
112
|
-
Claude
|
|
113
|
-
</TabsTrigger>
|
|
114
|
-
<TabsTrigger value="codex" className="flex-1">
|
|
115
|
-
Codex
|
|
122
|
+
<Tabs
|
|
123
|
+
value={activeTab}
|
|
124
|
+
onValueChange={(v) => setActiveTab(v as AgentTab)}
|
|
125
|
+
>
|
|
126
|
+
<TabsList className="w-full">
|
|
127
|
+
{(["claude", "codex", "opencode", "prompt"] as const).map((tab) => (
|
|
128
|
+
<TabsTrigger key={tab} value={tab} className="flex-1">
|
|
129
|
+
{AGENT_LABELS[tab]}
|
|
116
130
|
</TabsTrigger>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
</TabsTrigger>
|
|
120
|
-
</TabsList>
|
|
131
|
+
))}
|
|
132
|
+
</TabsList>
|
|
121
133
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
134
|
+
{TERMINAL_TABS.map((tab) => (
|
|
135
|
+
<TabsContent
|
|
136
|
+
key={tab}
|
|
137
|
+
value={tab}
|
|
138
|
+
className="mt-4 flex flex-col gap-4"
|
|
139
|
+
>
|
|
140
|
+
<Step
|
|
141
|
+
index={1}
|
|
142
|
+
title="Install the skill"
|
|
143
|
+
hint="Run once per machine."
|
|
144
|
+
>
|
|
145
|
+
<CommandBlock command={SKILL_INSTALL} />
|
|
146
|
+
</Step>
|
|
147
|
+
<Step index={2} title="Run in your terminal">
|
|
148
|
+
<CommandBlock
|
|
149
|
+
command={getTerminalCommand(tab, remoteUrl, hasToken)}
|
|
150
|
+
/>
|
|
151
|
+
</Step>
|
|
152
|
+
{hasToken && authToken && (
|
|
153
|
+
<Step index={3} title="Paste when prompted for a token">
|
|
154
|
+
<CommandBlock
|
|
155
|
+
command={authToken}
|
|
156
|
+
display={maskToken(authToken)}
|
|
157
|
+
/>
|
|
158
|
+
</Step>
|
|
159
|
+
)}
|
|
127
160
|
</TabsContent>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
161
|
+
))}
|
|
162
|
+
|
|
163
|
+
<TabsContent value="prompt" className="mt-4 flex flex-col gap-4">
|
|
164
|
+
<Step
|
|
165
|
+
index={1}
|
|
166
|
+
title="Make sure the marimo-pair skill is available to your agent"
|
|
167
|
+
hint="Skip if your agent already has it."
|
|
168
|
+
>
|
|
169
|
+
<CommandBlock command={SKILL_INSTALL} />
|
|
170
|
+
</Step>
|
|
171
|
+
<Step
|
|
172
|
+
index={2}
|
|
173
|
+
title="Copy this prompt into your agent"
|
|
174
|
+
hint={
|
|
175
|
+
hasToken
|
|
176
|
+
? "Includes your auth token — keep it private."
|
|
177
|
+
: undefined
|
|
178
|
+
}
|
|
179
|
+
>
|
|
180
|
+
<CommandBlock
|
|
181
|
+
command={getRawPrompt(remoteUrl, authToken)}
|
|
182
|
+
display={getRawPrompt(
|
|
183
|
+
remoteUrl,
|
|
184
|
+
authToken ? maskToken(authToken) : null,
|
|
185
|
+
)}
|
|
186
|
+
multiline={true}
|
|
187
|
+
/>
|
|
188
|
+
</Step>
|
|
189
|
+
</TabsContent>
|
|
190
|
+
</Tabs>
|
|
142
191
|
</div>
|
|
143
192
|
|
|
144
193
|
<DialogFooter>
|
|
@@ -150,10 +199,28 @@ export const PairWithAgentModal: React.FC<{
|
|
|
150
199
|
);
|
|
151
200
|
};
|
|
152
201
|
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
202
|
+
const Step: React.FC<{
|
|
203
|
+
index: number;
|
|
204
|
+
title: string;
|
|
205
|
+
hint?: string;
|
|
206
|
+
children: React.ReactNode;
|
|
207
|
+
}> = ({ index, title, hint, children }) => (
|
|
208
|
+
<div className="flex flex-col gap-2">
|
|
209
|
+
<div className="flex items-baseline gap-2">
|
|
210
|
+
<span className="text-sm font-medium">
|
|
211
|
+
{index}. {title}
|
|
212
|
+
</span>
|
|
213
|
+
{hint && <span className="text-xs text-muted-foreground">{hint}</span>}
|
|
214
|
+
</div>
|
|
215
|
+
{children}
|
|
216
|
+
</div>
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const CommandBlock: React.FC<{
|
|
220
|
+
command: string;
|
|
221
|
+
display?: string;
|
|
222
|
+
multiline?: boolean;
|
|
223
|
+
}> = ({ command, display, multiline = false }) => {
|
|
157
224
|
const [copied, setCopied] = useState(false);
|
|
158
225
|
|
|
159
226
|
const copy = Events.stopPropagation(async (e) => {
|
|
@@ -163,6 +230,30 @@ const CommandBlock: React.FC<{ command: string; display?: string }> = ({
|
|
|
163
230
|
setTimeout(() => setCopied(false), 2000);
|
|
164
231
|
});
|
|
165
232
|
|
|
233
|
+
if (multiline) {
|
|
234
|
+
return (
|
|
235
|
+
<div className="relative rounded-md bg-muted">
|
|
236
|
+
<pre className="max-h-64 overflow-auto whitespace-pre-wrap break-words px-3 py-2 pr-10 font-mono text-xs select-all">
|
|
237
|
+
{display ?? command}
|
|
238
|
+
</pre>
|
|
239
|
+
<Tooltip content="Copied!" open={copied}>
|
|
240
|
+
<Button
|
|
241
|
+
onClick={copy}
|
|
242
|
+
size="xs"
|
|
243
|
+
variant="ghost"
|
|
244
|
+
className="absolute right-1 top-1"
|
|
245
|
+
>
|
|
246
|
+
{copied ? (
|
|
247
|
+
<CheckIcon size={14} strokeWidth={1.5} />
|
|
248
|
+
) : (
|
|
249
|
+
<CopyIcon size={14} strokeWidth={1.5} />
|
|
250
|
+
)}
|
|
251
|
+
</Button>
|
|
252
|
+
</Tooltip>
|
|
253
|
+
</div>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
166
257
|
return (
|
|
167
258
|
<div className="flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs">
|
|
168
259
|
<code className="flex-1 select-all break-words">
|
|
@@ -53,6 +53,7 @@ import {
|
|
|
53
53
|
canUndoDeletesAtom,
|
|
54
54
|
getNotebook,
|
|
55
55
|
hasDisabledCellsAtom,
|
|
56
|
+
undoLabelAtom,
|
|
56
57
|
useCellActions,
|
|
57
58
|
} from "@/core/cells/cells";
|
|
58
59
|
import { disabledCellIds } from "@/core/cells/utils";
|
|
@@ -137,6 +138,7 @@ export function useNotebookActions() {
|
|
|
137
138
|
|
|
138
139
|
const hasDisabledCells = useAtomValue(hasDisabledCellsAtom);
|
|
139
140
|
const canUndoDeletes = useAtomValue(canUndoDeletesAtom);
|
|
141
|
+
const undoLabel = useAtomValue(undoLabelAtom);
|
|
140
142
|
const { selectedLayout } = useLayoutState();
|
|
141
143
|
const { setLayoutView } = useLayoutActions();
|
|
142
144
|
const togglePresenting = useTogglePresenting();
|
|
@@ -525,7 +527,7 @@ export function useNotebookActions() {
|
|
|
525
527
|
},
|
|
526
528
|
{
|
|
527
529
|
icon: <Undo2Icon size={14} strokeWidth={1.5} />,
|
|
528
|
-
label:
|
|
530
|
+
label: undoLabel,
|
|
529
531
|
hidden: !canUndoDeletes || kioskMode,
|
|
530
532
|
handle: () => {
|
|
531
533
|
undoDeleteCell();
|
|
@@ -15,6 +15,7 @@ interface Props {
|
|
|
15
15
|
connection: ConnectionStatus;
|
|
16
16
|
isRunning: boolean;
|
|
17
17
|
width: AppConfig["width"];
|
|
18
|
+
onReconnect?: () => void;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export const AppContainer: React.FC<PropsWithChildren<Props>> = ({
|
|
@@ -22,13 +23,18 @@ export const AppContainer: React.FC<PropsWithChildren<Props>> = ({
|
|
|
22
23
|
connection,
|
|
23
24
|
isRunning,
|
|
24
25
|
children,
|
|
26
|
+
onReconnect,
|
|
25
27
|
}) => {
|
|
26
28
|
const connectionState = connection.state;
|
|
27
29
|
|
|
28
30
|
return (
|
|
29
31
|
<>
|
|
30
32
|
<DynamicFavicon isRunning={isRunning} />
|
|
31
|
-
<StatusOverlay
|
|
33
|
+
<StatusOverlay
|
|
34
|
+
connection={connection}
|
|
35
|
+
isRunning={isRunning}
|
|
36
|
+
onReconnect={onReconnect}
|
|
37
|
+
/>
|
|
32
38
|
<PyodideLoader>
|
|
33
39
|
<WrappedWithSidebar>
|
|
34
40
|
{/** oxlint-ignore-next-line -- ID is used by other components to grab the DOM element */}
|
|
@@ -133,7 +133,12 @@ export const ContextAwarePanel: React.FC = () => {
|
|
|
133
133
|
onDragging={handleDragging}
|
|
134
134
|
className="resize-handle border-border z-20 print:hidden border-l"
|
|
135
135
|
/>
|
|
136
|
-
<Panel
|
|
136
|
+
<Panel
|
|
137
|
+
data-testid="chrome-context-aware-panel"
|
|
138
|
+
defaultSize={25}
|
|
139
|
+
minSize={25}
|
|
140
|
+
maxSize={80}
|
|
141
|
+
>
|
|
137
142
|
{renderBody()}
|
|
138
143
|
</Panel>
|
|
139
144
|
</>
|
|
@@ -167,7 +172,10 @@ const ResizableComponent = ({ children }: ResizableComponentProps) => {
|
|
|
167
172
|
});
|
|
168
173
|
|
|
169
174
|
return (
|
|
170
|
-
<div
|
|
175
|
+
<div
|
|
176
|
+
data-testid="chrome-context-aware-panel"
|
|
177
|
+
className="absolute z-40 right-0 h-full bg-background flex flex-row"
|
|
178
|
+
>
|
|
171
179
|
<div
|
|
172
180
|
ref={handleRefs.left}
|
|
173
181
|
className="w-1 h-full cursor-col-resize border-l"
|
|
@@ -537,6 +537,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
|
|
|
537
537
|
{helperPanel}
|
|
538
538
|
<Panel
|
|
539
539
|
id="app-chrome-body"
|
|
540
|
+
data-testid="chrome-body"
|
|
540
541
|
className={cn(isDeveloperPanelOpen && !isSidebarOpen && "border-l")}
|
|
541
542
|
>
|
|
542
543
|
<PanelGroup autoSaveId="marimo:chrome:v1:l1" direction="vertical">
|
|
@@ -58,7 +58,10 @@ export const Footer: React.FC = () => {
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
|
-
<footer
|
|
61
|
+
<footer
|
|
62
|
+
data-testid="chrome-footer"
|
|
63
|
+
className="h-10 py-1 gap-1 bg-background flex items-center text-muted-foreground text-md pl-2 pr-1 border-t border-border select-none print:hidden text-sm z-50 hide-on-fullscreen overflow-x-auto overflow-y-hidden scrollbar-thin"
|
|
64
|
+
>
|
|
62
65
|
<FooterItem
|
|
63
66
|
className="h-full"
|
|
64
67
|
tooltip={
|
|
@@ -3,7 +3,10 @@ import type { PropsWithChildren } from "react";
|
|
|
3
3
|
|
|
4
4
|
export const PanelsWrapper: React.FC<PropsWithChildren> = ({ children }) => {
|
|
5
5
|
return (
|
|
6
|
-
<div
|
|
6
|
+
<div
|
|
7
|
+
data-testid="chrome-wrapper"
|
|
8
|
+
className="flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative"
|
|
9
|
+
>
|
|
7
10
|
{children}
|
|
8
11
|
</div>
|
|
9
12
|
);
|
|
@@ -115,7 +115,10 @@ export const Sidebar: React.FC = () => {
|
|
|
115
115
|
]);
|
|
116
116
|
|
|
117
117
|
return (
|
|
118
|
-
<div
|
|
118
|
+
<div
|
|
119
|
+
data-testid="chrome-sidebar"
|
|
120
|
+
className="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen"
|
|
121
|
+
>
|
|
119
122
|
<ReorderableList<PanelDescriptor>
|
|
120
123
|
value={sidebarItems}
|
|
121
124
|
setValue={handleSetSidebarItems}
|
|
@@ -27,6 +27,7 @@ import { Functions } from "@/utils/functions";
|
|
|
27
27
|
import {
|
|
28
28
|
canUndoDeletesAtom,
|
|
29
29
|
needsRunAtom,
|
|
30
|
+
undoLabelAtom,
|
|
30
31
|
useCellActions,
|
|
31
32
|
} from "../../../core/cells/cells";
|
|
32
33
|
import { ConfigButton } from "../../app-config/app-config-button";
|
|
@@ -56,6 +57,7 @@ export const Controls = ({
|
|
|
56
57
|
running,
|
|
57
58
|
}: ControlsProps): JSX.Element => {
|
|
58
59
|
const undoAvailable = useAtomValue(canUndoDeletesAtom);
|
|
60
|
+
const undoLabel = useAtomValue(undoLabelAtom);
|
|
59
61
|
const needsRun = useAtomValue(needsRunAtom);
|
|
60
62
|
const { undoDeleteCell } = useCellActions();
|
|
61
63
|
const closed = connectionState === WebSocketState.CLOSED;
|
|
@@ -63,7 +65,7 @@ export const Controls = ({
|
|
|
63
65
|
let undoControl: JSX.Element | null = null;
|
|
64
66
|
if (!closed && undoAvailable) {
|
|
65
67
|
undoControl = (
|
|
66
|
-
<Tooltip content=
|
|
68
|
+
<Tooltip content={undoLabel}>
|
|
67
69
|
<Button
|
|
68
70
|
data-testid="undo-delete-cell"
|
|
69
71
|
size="medium"
|
|
@@ -86,7 +88,10 @@ export const Controls = ({
|
|
|
86
88
|
{!presenting && <FindReplace />}
|
|
87
89
|
|
|
88
90
|
{!closed && (
|
|
89
|
-
<div
|
|
91
|
+
<div
|
|
92
|
+
data-testid="chrome-controls-top-right"
|
|
93
|
+
className={topRightControls}
|
|
94
|
+
>
|
|
90
95
|
{presenting && <LayoutSelect />}
|
|
91
96
|
<NotebookMenuDropdown
|
|
92
97
|
disabled={disabled}
|
|
@@ -101,7 +106,10 @@ export const Controls = ({
|
|
|
101
106
|
</div>
|
|
102
107
|
)}
|
|
103
108
|
|
|
104
|
-
<div
|
|
109
|
+
<div
|
|
110
|
+
data-testid="chrome-controls-bottom-right"
|
|
111
|
+
className={cn(bottomRightControls)}
|
|
112
|
+
>
|
|
105
113
|
<HideInKioskMode>
|
|
106
114
|
<SaveComponent kioskMode={false} />
|
|
107
115
|
</HideInKioskMode>
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
CopyMinusIcon,
|
|
10
10
|
DownloadIcon,
|
|
11
11
|
ExternalLinkIcon,
|
|
12
|
+
EyeIcon,
|
|
12
13
|
EyeOffIcon,
|
|
13
14
|
FilePlus2Icon,
|
|
14
15
|
FolderPlusIcon,
|
|
@@ -198,6 +199,7 @@ export const FileExplorer: React.FC<{
|
|
|
198
199
|
<Toolbar
|
|
199
200
|
onRefresh={handleRefresh}
|
|
200
201
|
onHidden={handleHiddenFilesToggle}
|
|
202
|
+
showHiddenFiles={showHiddenFiles}
|
|
201
203
|
onCreateFile={handleCreateFile}
|
|
202
204
|
onCreateNotebook={handleCreateNotebook}
|
|
203
205
|
onCreateFolder={handleCreateFolder}
|
|
@@ -265,6 +267,7 @@ const INDENT_STEP = 15;
|
|
|
265
267
|
interface ToolbarProps {
|
|
266
268
|
onRefresh: () => void;
|
|
267
269
|
onHidden: () => void;
|
|
270
|
+
showHiddenFiles: boolean;
|
|
268
271
|
onCreateFile: () => void;
|
|
269
272
|
onCreateNotebook: () => void;
|
|
270
273
|
onCreateFolder: () => void;
|
|
@@ -275,6 +278,7 @@ interface ToolbarProps {
|
|
|
275
278
|
const Toolbar = ({
|
|
276
279
|
onRefresh,
|
|
277
280
|
onHidden,
|
|
281
|
+
showHiddenFiles,
|
|
278
282
|
onCreateFile,
|
|
279
283
|
onCreateNotebook,
|
|
280
284
|
onCreateFolder,
|
|
@@ -334,14 +338,20 @@ const Toolbar = ({
|
|
|
334
338
|
data-testid="file-explorer-refresh-button"
|
|
335
339
|
onClick={onRefresh}
|
|
336
340
|
/>
|
|
337
|
-
<Tooltip
|
|
341
|
+
<Tooltip
|
|
342
|
+
content={showHiddenFiles ? "Hide hidden files" : "Show hidden files"}
|
|
343
|
+
>
|
|
338
344
|
<Button
|
|
339
345
|
data-testid="file-explorer-hidden-files-button"
|
|
340
346
|
onClick={onHidden}
|
|
341
347
|
variant="text"
|
|
342
348
|
size="xs"
|
|
343
349
|
>
|
|
344
|
-
|
|
350
|
+
{showHiddenFiles ? (
|
|
351
|
+
<EyeIcon size={16} className="text-primary" />
|
|
352
|
+
) : (
|
|
353
|
+
<EyeOffIcon size={16} />
|
|
354
|
+
)}
|
|
345
355
|
</Button>
|
|
346
356
|
</Tooltip>
|
|
347
357
|
<Tooltip content="Collapse all folders">
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
// @vitest-environment jsdom
|
|
3
|
+
|
|
4
|
+
import { fireEvent, render } from "@testing-library/react";
|
|
5
|
+
import { createStore, Provider as JotaiProvider } from "jotai";
|
|
6
|
+
import type React from "react";
|
|
7
|
+
import { describe, expect, it, vi } from "vitest";
|
|
8
|
+
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
9
|
+
import { viewStateAtom } from "@/core/mode";
|
|
10
|
+
import {
|
|
11
|
+
type ConnectionStatus,
|
|
12
|
+
WebSocketClosedReason,
|
|
13
|
+
WebSocketState,
|
|
14
|
+
} from "@/core/websocket/types";
|
|
15
|
+
import { StatusOverlay } from "../status";
|
|
16
|
+
|
|
17
|
+
function renderOverlay(
|
|
18
|
+
connection: ConnectionStatus,
|
|
19
|
+
onReconnect?: () => void,
|
|
20
|
+
): ReturnType<typeof render> {
|
|
21
|
+
const store = createStore();
|
|
22
|
+
store.set(viewStateAtom, { mode: "edit", cellAnchor: null });
|
|
23
|
+
const wrapper: React.FC<React.PropsWithChildren> = ({ children }) => (
|
|
24
|
+
<JotaiProvider store={store}>
|
|
25
|
+
<TooltipProvider>{children}</TooltipProvider>
|
|
26
|
+
</JotaiProvider>
|
|
27
|
+
);
|
|
28
|
+
return render(
|
|
29
|
+
<StatusOverlay
|
|
30
|
+
connection={connection}
|
|
31
|
+
isRunning={false}
|
|
32
|
+
onReconnect={onReconnect}
|
|
33
|
+
/>,
|
|
34
|
+
{ wrapper },
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
describe("StatusOverlay disconnect indicator", () => {
|
|
39
|
+
it("invokes onReconnect when the disconnect icon is clicked", () => {
|
|
40
|
+
const onReconnect = vi.fn();
|
|
41
|
+
const { getByTestId } = renderOverlay(
|
|
42
|
+
{
|
|
43
|
+
state: WebSocketState.CLOSED,
|
|
44
|
+
code: WebSocketClosedReason.KERNEL_DISCONNECTED,
|
|
45
|
+
reason: "kernel not found",
|
|
46
|
+
},
|
|
47
|
+
onReconnect,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const icon = getByTestId("disconnected-indicator") as HTMLButtonElement;
|
|
51
|
+
expect(icon.tagName).toBe("BUTTON");
|
|
52
|
+
expect(icon.disabled).toBe(false);
|
|
53
|
+
expect(icon.getAttribute("aria-label")).toBe("Reconnect to app");
|
|
54
|
+
fireEvent.click(icon);
|
|
55
|
+
expect(onReconnect).toHaveBeenCalledTimes(1);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("renders a disabled button when no onReconnect is provided", () => {
|
|
59
|
+
const { getByTestId } = renderOverlay({
|
|
60
|
+
state: WebSocketState.CLOSED,
|
|
61
|
+
code: WebSocketClosedReason.KERNEL_DISCONNECTED,
|
|
62
|
+
reason: "kernel not found",
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const button = getByTestId("disconnected-indicator");
|
|
66
|
+
expect((button as HTMLButtonElement).disabled).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it.each([
|
|
70
|
+
[
|
|
71
|
+
WebSocketClosedReason.MALFORMED_QUERY,
|
|
72
|
+
"the kernel did not recognize a request; please file a bug with marimo",
|
|
73
|
+
],
|
|
74
|
+
[
|
|
75
|
+
WebSocketClosedReason.KERNEL_STARTUP_ERROR,
|
|
76
|
+
"Failed to start kernel sandbox",
|
|
77
|
+
],
|
|
78
|
+
])(
|
|
79
|
+
"renders a disabled button for non-recoverable close reason %s",
|
|
80
|
+
(code, reason) => {
|
|
81
|
+
const onReconnect = vi.fn();
|
|
82
|
+
const { getByTestId } = renderOverlay(
|
|
83
|
+
{ state: WebSocketState.CLOSED, code, reason },
|
|
84
|
+
onReconnect,
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const button = getByTestId("disconnected-indicator") as HTMLButtonElement;
|
|
88
|
+
expect(button.disabled).toBe(true);
|
|
89
|
+
fireEvent.click(button);
|
|
90
|
+
expect(onReconnect).not.toHaveBeenCalled();
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
it("does not render the disconnect icon when another tab has taken over", () => {
|
|
95
|
+
const onReconnect = vi.fn();
|
|
96
|
+
const { queryByTestId } = renderOverlay(
|
|
97
|
+
{
|
|
98
|
+
state: WebSocketState.CLOSED,
|
|
99
|
+
code: WebSocketClosedReason.ALREADY_RUNNING,
|
|
100
|
+
reason: "another browser tab is already connected to the kernel",
|
|
101
|
+
canTakeover: true,
|
|
102
|
+
},
|
|
103
|
+
onReconnect,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
expect(queryByTestId("disconnected-indicator")).toBeNull();
|
|
107
|
+
});
|
|
108
|
+
});
|