@marimo-team/islands 0.19.5-dev4 → 0.19.5-dev40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/{ConnectedDataExplorerComponent-D5KcOOzu.js → ConnectedDataExplorerComponent-DjQ_E5BA.js} +3 -3
  2. package/dist/assets/__vite-browser-external-DRa9CT_O.js +1 -0
  3. package/dist/assets/{worker-BR7KVExK.js → worker-SqntmiwV.js} +2 -2
  4. package/dist/{glide-data-editor-DsVDCmV2.js → glide-data-editor-zEomQJ3U.js} +2 -2
  5. package/dist/main.js +280 -237
  6. package/dist/{mermaid-DZjjc-kI.js → mermaid-D7wtYc6C.js} +2 -2
  7. package/dist/{spec-B1PGDiGh.js → spec-Cif4tBMJ.js} +1 -1
  8. package/dist/style.css +1 -1
  9. package/dist/{types-CbQF8CBX.js → types-BQOP2pRy.js} +1 -1
  10. package/dist/{useAsyncData-TLXJC7yx.js → useAsyncData-kqbhbSuf.js} +1 -1
  11. package/dist/{useDeepCompareMemoize-DVnEG7jx.js → useDeepCompareMemoize-B2QEm3jo.js} +1 -1
  12. package/dist/{useTheme-BllQjRdW.js → useTheme-CVr6Gb_R.js} +4 -1
  13. package/dist/{vega-component-B2QrGnW8.js → vega-component-DAeU1_cV.js} +3 -3
  14. package/package.json +1 -1
  15. package/src/__mocks__/requests.ts +1 -0
  16. package/src/components/app-config/user-config-form.tsx +34 -1
  17. package/src/components/chat/chat-panel.tsx +1 -1
  18. package/src/components/data-table/cell-utils.ts +10 -0
  19. package/src/components/editor/Output.tsx +21 -14
  20. package/src/components/editor/actions/useNotebookActions.tsx +44 -12
  21. package/src/components/editor/cell/cell-actions.tsx +6 -1
  22. package/src/components/editor/controls/Controls.tsx +1 -8
  23. package/src/components/editor/file-tree/file-explorer.tsx +4 -2
  24. package/src/components/editor/file-tree/file-viewer.tsx +9 -6
  25. package/src/components/editor/navigation/navigation.ts +39 -1
  26. package/src/components/editor/renderMimeIcon.tsx +2 -0
  27. package/src/core/codemirror/language/panel/panel.tsx +3 -0
  28. package/src/core/codemirror/language/panel/sql.tsx +6 -2
  29. package/src/core/config/config-schema.ts +5 -1
  30. package/src/core/config/config.ts +4 -0
  31. package/src/core/config/feature-flag.tsx +2 -0
  32. package/src/core/export/__tests__/hooks.test.ts +120 -1
  33. package/src/core/export/hooks.ts +41 -7
  34. package/src/core/islands/bridge.ts +1 -0
  35. package/src/core/lsp/__tests__/transport.test.ts +149 -0
  36. package/src/core/lsp/transport.ts +48 -0
  37. package/src/core/network/requests-lazy.ts +1 -0
  38. package/src/core/network/requests-network.ts +9 -0
  39. package/src/core/network/requests-static.ts +1 -0
  40. package/src/core/network/requests-toasting.tsx +1 -0
  41. package/src/core/network/types.ts +2 -0
  42. package/src/core/wasm/bridge.ts +1 -0
  43. package/src/css/app/Cell.css +0 -2
  44. package/src/plugins/layout/TexPlugin.tsx +7 -5
  45. package/src/utils/__tests__/download.test.tsx +96 -0
  46. package/src/utils/download.ts +54 -0
  47. package/src/utils/filenames.ts +3 -0
  48. package/dist/assets/__vite-browser-external-CgHmDpAZ.js +0 -1
@@ -13,7 +13,7 @@ import { c as useComposedRefs, l as Events, s as composeRefs, t as Button, u as
13
13
  import { s as Logger } from "./hotkeys-C4e3s3sJ.js";
14
14
  import { t as require_jsx_runtime } from "./jsx-runtime-CTBg5pdT.js";
15
15
  import { t as require_react_dom } from "./react-dom-DJW8xUDg.js";
16
- import { h as useEvent_default } from "./useTheme-BllQjRdW.js";
16
+ import { h as useEvent_default } from "./useTheme-CVr6Gb_R.js";
17
17
  import { t as toString_default } from "./toString-C4TLO6FA.js";
18
18
  import { i as debounce_default, n as Constants } from "./constants-DuN_eoAL.js";
19
19
  import { t as memoizeLastValue } from "./once-C-NkXwWJ.js";
@@ -1,7 +1,7 @@
1
1
  import { s as __toESM } from "./chunk-BNovOVIE.js";
2
2
  import { t as require_react } from "./react-DdA8EBol.js";
3
3
  import { t as require_compiler_runtime } from "./compiler-runtime-DHFVbq0b.js";
4
- import { h as useEvent_default } from "./useTheme-BllQjRdW.js";
4
+ import { h as useEvent_default } from "./useTheme-CVr6Gb_R.js";
5
5
  import { t as invariant } from "./invariant-BW72tHBT.js";
6
6
  var import_compiler_runtime = require_compiler_runtime(), import_react = /* @__PURE__ */ __toESM(require_react(), 1), Result = {
7
7
  error(e, s) {
@@ -8,7 +8,7 @@ import { N as createLucideIcon } from "./Combination-BOmAhdTT.js";
8
8
  import { a as cva, u as cn } from "./button-D6ZIdUA3.js";
9
9
  import { s as Logger } from "./hotkeys-C4e3s3sJ.js";
10
10
  import { t as require_jsx_runtime } from "./jsx-runtime-CTBg5pdT.js";
11
- import { f as waitFor, p as isIslands, u as store, x as atom } from "./useTheme-BllQjRdW.js";
11
+ import { f as waitFor, p as isIslands, u as store, x as atom } from "./useTheme-CVr6Gb_R.js";
12
12
  import { r as KnownQueryParams } from "./constants-DuN_eoAL.js";
13
13
  import { i as tableFromIPC } from "./loader-DH7xXi-E.js";
14
14
  var CircleQuestionMark = createLucideIcon("circle-question-mark", [
@@ -598,7 +598,7 @@ const UserConfigSchema = looseObject({
598
598
  markdown: boolean().optional(),
599
599
  rtc: boolean().optional()
600
600
  }).prefault(() => ({})),
601
- server: looseObject({}).prefault(() => ({})),
601
+ server: looseObject({ disable_file_downloads: boolean().optional() }).prefault(() => ({})),
602
602
  diagnostics: looseObject({
603
603
  enabled: boolean().optional(),
604
604
  sql_linter: boolean().optional()
@@ -681,6 +681,9 @@ atom((e) => e(appConfigAtom).width), atom((e) => {
681
681
  var _a, _b;
682
682
  let k = e(resolvedMarimoConfigAtom), A = ((_a = k.snippets) == null ? void 0 : _a.custom_paths) ?? [], j = (_b = k.snippets) == null ? void 0 : _b.include_default_snippets;
683
683
  return A.length > 0 || j === true;
684
+ }), atom((e) => {
685
+ var _a;
686
+ return ((_a = e(resolvedMarimoConfigAtom).server) == null ? void 0 : _a.disable_file_downloads) ?? false;
684
687
  });
685
688
  var import_compiler_runtime = require_compiler_runtime(), themeAtom = atom((e) => {
686
689
  if (isIslands()) {
@@ -2,18 +2,18 @@ import { s as __toESM } from "./chunk-BNovOVIE.js";
2
2
  import { t as require_react } from "./react-DdA8EBol.js";
3
3
  import { t as require_compiler_runtime } from "./compiler-runtime-DHFVbq0b.js";
4
4
  import "./Combination-BOmAhdTT.js";
5
- import { S as CircleQuestionMark, a as AlertTitle, m as asRemoteURL, n as arrow, o as isValid, r as Alert, t as useDeepCompareMemoize } from "./useDeepCompareMemoize-DVnEG7jx.js";
5
+ import { S as CircleQuestionMark, a as AlertTitle, m as asRemoteURL, n as arrow, o as isValid, r as Alert, t as useDeepCompareMemoize } from "./useDeepCompareMemoize-B2QEm3jo.js";
6
6
  import { l as Events } from "./button-D6ZIdUA3.js";
7
7
  import { o as Objects, s as Logger } from "./hotkeys-C4e3s3sJ.js";
8
8
  import { t as require_jsx_runtime } from "./jsx-runtime-CTBg5pdT.js";
9
9
  import "./react-dom-DJW8xUDg.js";
10
10
  import { l as Tooltip, n as ErrorBanner } from "./error-banner-BhqH4mGj.js";
11
- import { h as useEvent_default, n as useTheme } from "./useTheme-BllQjRdW.js";
11
+ import { h as useEvent_default, n as useTheme } from "./useTheme-CVr6Gb_R.js";
12
12
  import { t as _baseUniq_default } from "./_baseUniq-BUGws47x.js";
13
13
  import { i as debounce_default } from "./constants-DuN_eoAL.js";
14
14
  import { a as tooltipHandler, n as vegaLoadData } from "./loader-DH7xXi-E.js";
15
15
  import { n as formats } from "./vega-loader.browser-nTy1NZD3.js";
16
- import { t as useAsyncData } from "./useAsyncData-TLXJC7yx.js";
16
+ import { t as useAsyncData } from "./useAsyncData-kqbhbSuf.js";
17
17
  import { t as j } from "./react-vega-z40f-dXy.js";
18
18
  import "./defaultLocale-DZtxSCkJ.js";
19
19
  import "./defaultLocale-DMZFeDB8.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.19.5-dev4",
3
+ "version": "0.19.5-dev40",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -60,6 +60,7 @@ export const MockRequestClient = {
60
60
  shutdownSession: vi.fn().mockResolvedValue({}),
61
61
  exportAsHTML: vi.fn().mockResolvedValue({ html: "" }),
62
62
  exportAsMarkdown: vi.fn().mockResolvedValue({ markdown: "" }),
63
+ exportAsPDF: vi.fn().mockResolvedValue(new Blob()),
63
64
  autoExportAsHTML: vi.fn().mockResolvedValue({}),
64
65
  autoExportAsMarkdown: vi.fn().mockResolvedValue({}),
65
66
  autoExportAsIPYNB: vi.fn().mockResolvedValue({}),
@@ -993,7 +993,7 @@ export const UserConfigForm: React.FC = () => {
993
993
  <br />
994
994
  <br />
995
995
  Running marimo in a{" "}
996
- <ExternalLink href="https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only">
996
+ <ExternalLink href="https://docs.marimo.io/guides/package_management/inlining_dependencies.html">
997
997
  sandboxed environment
998
998
  </ExternalLink>{" "}
999
999
  is only supported by <Kbd className="inline">uv</Kbd>
@@ -1283,6 +1283,39 @@ export const UserConfigForm: React.FC = () => {
1283
1283
  </div>
1284
1284
  )}
1285
1285
  />
1286
+ <FormField
1287
+ control={form.control}
1288
+ name="experimental.server_side_pdf_export"
1289
+ render={({ field }) => (
1290
+ <div className="flex flex-col gap-y-1">
1291
+ <FormItem className={formItemClasses}>
1292
+ <FormLabel className="font-normal">
1293
+ Better PDF Export
1294
+ </FormLabel>
1295
+ <FormControl>
1296
+ <Checkbox
1297
+ data-testid="server-side-pdf-export-checkbox"
1298
+ checked={field.value === true}
1299
+ onCheckedChange={field.onChange}
1300
+ />
1301
+ </FormControl>
1302
+ </FormItem>
1303
+ <IsOverridden
1304
+ userConfig={config}
1305
+ name="experimental.server_side_pdf_export"
1306
+ />
1307
+ <FormDescription>
1308
+ Enable PDF export using{" "}
1309
+ <Kbd className="inline">nbconvert</Kbd> and{" "}
1310
+ <Kbd className="inline">playwright</Kbd>. Refer to{" "}
1311
+ <ExternalLink href="https://docs.marimo.io/guides/exporting/#exporting-to-pdf-slides-or-rst">
1312
+ the docs
1313
+ </ExternalLink>
1314
+ .
1315
+ </FormDescription>
1316
+ </div>
1317
+ )}
1318
+ />
1286
1319
  </SettingGroup>
1287
1320
  );
1288
1321
  }
@@ -262,7 +262,7 @@ const ChatInputFooter: React.FC<ChatInputFooterProps> = memo(
262
262
 
263
263
  return (
264
264
  <TooltipProvider>
265
- <div className="px-3 py-2 border-t border-border/20 flex flex-row items-center justify-between">
265
+ <div className="px-3 py-2 border-t border-border/20 flex flex-row flex-wrap items-center justify-between gap-1">
266
266
  <div className="flex items-center gap-2">
267
267
  <FeatureFlagged feature="chat_modes">
268
268
  <Select value={currentMode} onValueChange={saveModeChange}>
@@ -1,5 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
+ import type { CellId } from "@/core/cells/ids";
4
+
3
5
  export const DATA_CELL_ID = "data-cell-id";
4
6
 
5
7
  export function getCellDomProps(cellId: string) {
@@ -7,3 +9,11 @@ export function getCellDomProps(cellId: string) {
7
9
  [DATA_CELL_ID]: cellId,
8
10
  };
9
11
  }
12
+
13
+ export const DATA_FOR_CELL_ID = "data-for-cell-id";
14
+
15
+ export function getCellForDomProps(cellId: CellId) {
16
+ return {
17
+ [DATA_FOR_CELL_ID]: cellId,
18
+ };
19
+ }
@@ -20,6 +20,7 @@ import { TextOutput } from "./output/TextOutput";
20
20
  import { VideoOutput } from "./output/VideoOutput";
21
21
 
22
22
  import "./output/Outputs.css";
23
+ import { useAtomValue } from "jotai";
23
24
  import {
24
25
  ChevronsDownUpIcon,
25
26
  ChevronsUpDownIcon,
@@ -27,6 +28,7 @@ import {
27
28
  } from "lucide-react";
28
29
  import { tooltipHandler } from "@/components/charts/tooltip";
29
30
  import { useExpandedOutput } from "@/core/cells/outputs";
31
+ import { viewStateAtom } from "@/core/mode";
30
32
  import { useIframeCapabilities } from "@/hooks/useIframeCapabilities";
31
33
  import { renderHTML } from "@/plugins/core/RenderHTML";
32
34
  import { Banner } from "@/plugins/impl/common/error-banner";
@@ -46,10 +48,9 @@ import { renderMimeIcon } from "./renderMimeIcon";
46
48
 
47
49
  const METADATA_KEY = "__metadata__";
48
50
 
49
- type MimeBundleWithoutMetadata = Record<
50
- OutputMessage["mimetype"],
51
- { [key: string]: unknown }
52
- >;
51
+ export type MimeType = OutputMessage["mimetype"];
52
+
53
+ type MimeBundleWithoutMetadata = Record<MimeType, { [key: string]: unknown }>;
53
54
 
54
55
  type MimeBundle = MimeBundleWithoutMetadata & {
55
56
  [METADATA_KEY]?: Record<string, { width?: number; height?: number }>;
@@ -70,7 +71,7 @@ export const OutputRenderer: React.FC<{
70
71
  onRefactorWithAI?: OnRefactorWithAI;
71
72
  wrapText?: boolean;
72
73
  metadata?: { width?: number; height?: number };
73
- renderFallback?: (mimetype: OutputMessage["mimetype"]) => React.ReactNode;
74
+ renderFallback?: (mimetype: MimeType) => React.ReactNode;
74
75
  }> = memo((props) => {
75
76
  const {
76
77
  message,
@@ -90,6 +91,8 @@ export const OutputRenderer: React.FC<{
90
91
  case "application/vnd.marimo+mimebundle":
91
92
  case "application/vnd.vegalite.v5+json":
92
93
  case "application/vnd.vega.v5+json":
94
+ case "application/vnd.vegalite.v6+json":
95
+ case "application/vnd.vega.v6+json":
93
96
  return typeof data === "string" ? JSON.parse(data) : data;
94
97
  default:
95
98
  return;
@@ -199,6 +202,8 @@ export const OutputRenderer: React.FC<{
199
202
  );
200
203
  case "application/vnd.vegalite.v5+json":
201
204
  case "application/vnd.vega.v5+json":
205
+ case "application/vnd.vegalite.v6+json":
206
+ case "application/vnd.vega.v6+json":
202
207
  return (
203
208
  <Suspense fallback={<ChartLoadingState />}>
204
209
  <LazyVegaEmbed
@@ -216,9 +221,7 @@ export const OutputRenderer: React.FC<{
216
221
  return (
217
222
  <MimeBundleOutputRenderer
218
223
  channel={channel}
219
- data={
220
- parsedJsonData as Record<OutputMessage["mimetype"], OutputMessage>
221
- }
224
+ data={parsedJsonData as Record<MimeType, OutputMessage>}
222
225
  />
223
226
  );
224
227
  case "application/vnd.jupyter.widget-view+json":
@@ -258,6 +261,8 @@ const MimeBundleOutputRenderer: React.FC<{
258
261
  cellId?: CellId;
259
262
  }> = memo(({ data, channel, cellId }) => {
260
263
  const mimebundle = Array.isArray(data) ? data[0] : data;
264
+ const { mode } = useAtomValue(viewStateAtom);
265
+ const appView = mode === "present" || mode === "read";
261
266
 
262
267
  // Extract metadata if present (e.g., for retina image rendering)
263
268
  const metadata = mimebundle[METADATA_KEY];
@@ -265,10 +270,7 @@ const MimeBundleOutputRenderer: React.FC<{
265
270
  // Filter out metadata from the mime entries and type narrow
266
271
  const mimeEntries = Objects.entries(mimebundle as Record<string, unknown>)
267
272
  .filter(([key]) => key !== METADATA_KEY)
268
- .map(
269
- ([mime, data]) =>
270
- [mime, data] as [OutputMessage["mimetype"], CellOutput["data"]],
271
- );
273
+ .map(([mime, data]) => [mime, data] as [MimeType, CellOutput["data"]]);
272
274
 
273
275
  // If there is none, return null
274
276
  const first = mimeEntries[0]?.[0];
@@ -302,7 +304,12 @@ const MimeBundleOutputRenderer: React.FC<{
302
304
  return (
303
305
  <Tabs defaultValue={first} orientation="vertical">
304
306
  <div className="flex">
305
- <TabsList className="self-start max-h-none flex flex-col gap-2 mr-4 shrink-0">
307
+ <TabsList
308
+ className={cn(
309
+ "self-start max-h-none flex flex-col gap-2 mr-3 shrink-0",
310
+ appView && "mt-4",
311
+ )}
312
+ >
306
313
  {mimeEntries.map(([mime]) => (
307
314
  <TabsTrigger
308
315
  key={mime}
@@ -315,7 +322,7 @@ const MimeBundleOutputRenderer: React.FC<{
315
322
  </TabsTrigger>
316
323
  ))}
317
324
  </TabsList>
318
- <div className="flex-1">
325
+ <div className="flex-1 w-full">
319
326
  {mimeEntries.map(([mime, output]) => (
320
327
  <TabsContent key={mime} value={mime}>
321
328
  <ErrorBoundary>
@@ -54,7 +54,12 @@ import {
54
54
  } from "@/core/cells/cells";
55
55
  import { disabledCellIds } from "@/core/cells/utils";
56
56
  import { useResolvedMarimoConfig } from "@/core/config/config";
57
+ import { getFeatureFlag } from "@/core/config/feature-flag";
57
58
  import { Constants } from "@/core/constants";
59
+ import {
60
+ updateCellOutputsWithScreenshots,
61
+ useEnrichCellOutputs,
62
+ } from "@/core/export/hooks";
58
63
  import { useLayoutActions, useLayoutState } from "@/core/layout/layout";
59
64
  import { useTogglePresenting } from "@/core/layout/useTogglePresenting";
60
65
  import { kioskModeAtom, viewStateAtom } from "@/core/mode";
@@ -64,7 +69,12 @@ import { downloadAsHTML } from "@/core/static/download-html";
64
69
  import { createShareableLink } from "@/core/wasm/share";
65
70
  import { isWasm } from "@/core/wasm/utils";
66
71
  import { copyToClipboard } from "@/utils/copy";
67
- import { downloadBlob, downloadHTMLAsImage } from "@/utils/download";
72
+ import {
73
+ downloadAsPDF,
74
+ downloadBlob,
75
+ downloadHTMLAsImage,
76
+ withLoadingToast,
77
+ } from "@/utils/download";
68
78
  import { Filenames } from "@/utils/filenames";
69
79
  import { Objects } from "@/utils/objects";
70
80
  import { newNotebookURL } from "@/utils/urls";
@@ -110,13 +120,15 @@ export function useNotebookActions() {
110
120
  const setCommandPaletteOpen = useSetAtom(commandPaletteAtom);
111
121
  const setSettingsDialogOpen = useSetAtom(settingDialogAtom);
112
122
  const setKeyboardShortcutsOpen = useSetAtom(keyboardShortcutsAtom);
113
- const { exportAsMarkdown, readCode, saveCellConfig } = useRequestClient();
123
+ const { exportAsMarkdown, readCode, saveCellConfig, updateCellOutputs } =
124
+ useRequestClient();
114
125
 
115
126
  const hasDisabledCells = useAtomValue(hasDisabledCellsAtom);
116
127
  const canUndoDeletes = useAtomValue(canUndoDeletesAtom);
117
128
  const { selectedLayout } = useLayoutState();
118
129
  const { setLayoutView } = useLayoutActions();
119
130
  const togglePresenting = useTogglePresenting();
131
+ const takeScreenshots = useEnrichCellOutputs();
120
132
 
121
133
  // Fallback: if sharing is undefined, both are enabled by default
122
134
  const sharingHtmlEnabled = resolvedConfig.sharing?.html ?? true;
@@ -139,11 +151,7 @@ export function useNotebookActions() {
139
151
  label: "Download as HTML",
140
152
  handle: async () => {
141
153
  if (!filename) {
142
- toast({
143
- variant: "danger",
144
- title: "Error",
145
- description: "Notebooks must be named to be exported.",
146
- });
154
+ toastNotebookMustBeNamed();
147
155
  return;
148
156
  }
149
157
  await downloadAsHTML({ filename, includeCode: true });
@@ -154,11 +162,7 @@ export function useNotebookActions() {
154
162
  label: "Download as HTML (exclude code)",
155
163
  handle: async () => {
156
164
  if (!filename) {
157
- toast({
158
- variant: "danger",
159
- title: "Error",
160
- description: "Notebooks must be named to be exported.",
161
- });
165
+ toastNotebookMustBeNamed();
162
166
  return;
163
167
  }
164
168
  await downloadAsHTML({ filename, includeCode: false });
@@ -220,6 +224,26 @@ export function useNotebookActions() {
220
224
  </span>
221
225
  ),
222
226
  handle: async () => {
227
+ if (getFeatureFlag("server_side_pdf_export")) {
228
+ if (!filename) {
229
+ toastNotebookMustBeNamed();
230
+ return;
231
+ }
232
+
233
+ const downloadPDF = async () => {
234
+ await updateCellOutputsWithScreenshots(
235
+ takeScreenshots,
236
+ updateCellOutputs,
237
+ );
238
+ await downloadAsPDF({
239
+ filename: filename,
240
+ webpdf: false,
241
+ });
242
+ };
243
+ await withLoadingToast("Downloading PDF...", downloadPDF);
244
+ return;
245
+ }
246
+
223
247
  const beforeprint = new Event("export-beforeprint");
224
248
  const afterprint = new Event("export-afterprint");
225
249
  function print() {
@@ -527,3 +551,11 @@ export function useNotebookActions() {
527
551
  return action;
528
552
  });
529
553
  }
554
+
555
+ function toastNotebookMustBeNamed() {
556
+ toast({
557
+ title: "Error",
558
+ description: "Notebooks must be named to be exported.",
559
+ variant: "danger",
560
+ });
561
+ }
@@ -12,6 +12,7 @@ import React, {
12
12
  useState,
13
13
  } from "react";
14
14
  import useEvent from "react-use-event-hook";
15
+ import { getCellForDomProps } from "@/components/data-table/cell-utils";
15
16
  import {
16
17
  renderMinimalShortcut,
17
18
  renderShortcut,
@@ -104,7 +105,11 @@ const CellActionsDropdownInternal = (
104
105
  {...restoreFocus}
105
106
  >
106
107
  <Command>
107
- <CommandInput placeholder="Search actions..." className="h-6 m-1" />
108
+ <CommandInput
109
+ placeholder="Search actions..."
110
+ className="h-6 m-1"
111
+ {...getCellForDomProps(props.cellId)}
112
+ />
108
113
  <CommandList>
109
114
  <CommandEmpty>No results</CommandEmpty>
110
115
  {actions.map((group, i) => (
@@ -54,9 +54,7 @@ export const Controls = ({
54
54
  onRun,
55
55
  connectionState,
56
56
  running,
57
- appConfig,
58
57
  }: ControlsProps): JSX.Element => {
59
- const appWidth = appConfig.width;
60
58
  const undoAvailable = useAtomValue(canUndoDeletesAtom);
61
59
  const needsRun = useAtomValue(needsRunAtom);
62
60
  const { undoDeleteCell } = useCellActions();
@@ -103,12 +101,7 @@ export const Controls = ({
103
101
  </div>
104
102
  )}
105
103
 
106
- <div
107
- className={cn(
108
- bottomRightControls,
109
- appWidth === "compact" && "xl:flex-row items-end",
110
- )}
111
- >
104
+ <div className={cn(bottomRightControls)}>
112
105
  <HideInKioskMode>
113
106
  <SaveComponent kioskMode={false} />
114
107
  </HideInKioskMode>
@@ -1,6 +1,6 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
- import { useAtom } from "jotai";
3
+ import { useAtom, useAtomValue } from "jotai";
4
4
  import { atomWithStorage } from "jotai/utils";
5
5
  import {
6
6
  ArrowLeftIcon,
@@ -47,6 +47,7 @@ import { Tooltip } from "@/components/ui/tooltip";
47
47
  import { toast } from "@/components/ui/use-toast";
48
48
  import { useCellActions } from "@/core/cells/cells";
49
49
  import { useLastFocusedCellId } from "@/core/cells/focus";
50
+ import { disableFileDownloadsAtom } from "@/core/config/config";
50
51
  import { useRequestClient } from "@/core/network/requests";
51
52
  import type { FileInfo } from "@/core/network/types";
52
53
  import { isWasm } from "@/core/wasm/utils";
@@ -396,6 +397,7 @@ const Edit = ({ node }: { node: NodeApi<FileInfo> }) => {
396
397
  const Node = ({ node, style, dragHandle }: NodeRendererProps<FileInfo>) => {
397
398
  const { openFile, sendCreateFileOrFolder, sendFileDetails } =
398
399
  useRequestClient();
400
+ const disableFileDownloads = useAtomValue(disableFileDownloadsAtom);
399
401
 
400
402
  const fileType: FileType = node.data.isDirectory
401
403
  ? "directory"
@@ -611,7 +613,7 @@ const Node = ({ node, style, dragHandle }: NodeRendererProps<FileInfo>) => {
611
613
  </>
612
614
  )}
613
615
  <DropdownMenuSeparator />
614
- {!node.data.isDirectory && (
616
+ {!node.data.isDirectory && !disableFileDownloads && (
615
617
  <>
616
618
  <DropdownMenuItem
617
619
  onSelect={async () => {
@@ -15,7 +15,7 @@ import { Suspense, useEffect, useRef, useState } from "react";
15
15
  import { renderShortcut } from "@/components/shortcuts/renderShortcut";
16
16
  import { Alert, AlertDescription } from "@/components/ui/alert";
17
17
  import { Tooltip } from "@/components/ui/tooltip";
18
- import { hotkeysAtom } from "@/core/config/config";
18
+ import { disableFileDownloadsAtom, hotkeysAtom } from "@/core/config/config";
19
19
  import { useRequestClient } from "@/core/network/requests";
20
20
  import type { FileInfo } from "@/core/network/types";
21
21
  import { filenameAtom } from "@/core/saving/file-state";
@@ -49,6 +49,7 @@ export const FileViewer: React.FC<Props> = ({ file, onOpenNotebook }) => {
49
49
  const { theme } = useTheme();
50
50
  const { sendFileDetails, sendUpdateFile } = useRequestClient();
51
51
  const hotkeys = useAtomValue(hotkeysAtom);
52
+ const disableFileDownloads = useAtomValue(disableFileDownloadsAtom);
52
53
  const currentNotebookFilename = useAtomValue(filenameAtom);
53
54
  // undefined value means not modified yet
54
55
  const [internalValue, setInternalValue] = useState<string>("");
@@ -152,11 +153,13 @@ export const FileViewer: React.FC<Props> = ({ file, onOpenNotebook }) => {
152
153
  </Button>
153
154
  </Tooltip>
154
155
  )}
155
- <Tooltip content="Download">
156
- <Button size="small" onClick={handleDownload}>
157
- <DownloadIcon />
158
- </Button>
159
- </Tooltip>
156
+ {!disableFileDownloads && (
157
+ <Tooltip content="Download">
158
+ <Button size="small" onClick={handleDownload}>
159
+ <DownloadIcon />
160
+ </Button>
161
+ </Tooltip>
162
+ )}
160
163
  {!isMedia(mimeType) && (
161
164
  <>
162
165
  <Tooltip content="Copy contents to clipboard">
@@ -10,6 +10,7 @@ import {
10
10
  import { useAtomValue, useSetAtom, useStore } from "jotai";
11
11
  import { useMemo } from "react";
12
12
  import { mergeProps, useFocusWithin, useKeyboard } from "react-aria";
13
+ import { DATA_FOR_CELL_ID } from "@/components/data-table/cell-utils";
13
14
  import { aiCompletionCellAtom } from "@/core/ai/state";
14
15
  import { cellIdsAtom, notebookAtom, useCellActions } from "@/core/cells/cells";
15
16
  import { useCellFocusActions } from "@/core/cells/focus";
@@ -101,7 +102,23 @@ function useCellFocusProps(
101
102
  // On focus, set the last focused cell id.
102
103
  focusActions.focusCell({ cellId });
103
104
  },
104
- onBlurWithin: () => {
105
+ onBlurWithin: (e) => {
106
+ // Check if blur is happening because of vim search panel interaction
107
+ if (isInVimPanel(e.relatedTarget) || isInVimPanel(e.target)) {
108
+ // Don't hide code if we're just interacting with vim search
109
+ return;
110
+ }
111
+
112
+ // If the related target is for a cell id (data-for-cell-id), then we don't want to hide the code, otherwise it might
113
+ // close the dropdown.
114
+ if (
115
+ getDataForCellId(e.relatedTarget) === cellId ||
116
+ getDataForCellId(e.relatedTarget?.closest(`[${DATA_FOR_CELL_ID}]`)) ===
117
+ cellId
118
+ ) {
119
+ return;
120
+ }
121
+
105
122
  // On blur, hide the code if it was temporarily shown.
106
123
  temporarilyShownCodeActions.remove(cellId);
107
124
  actions.markTouched({ cellId });
@@ -116,6 +133,27 @@ function useCellFocusProps(
116
133
  return focusWithinProps;
117
134
  }
118
135
 
136
+ function isInVimPanel(element: Element | null): boolean {
137
+ if (!element) {
138
+ return false;
139
+ }
140
+ if (element instanceof HTMLElement) {
141
+ return element.closest(".cm-vim-panel") !== null;
142
+ }
143
+ return false;
144
+ }
145
+
146
+ function getDataForCellId(element: Element | null | undefined): CellId | null {
147
+ if (!element) {
148
+ return null;
149
+ }
150
+ const cellId = element.getAttribute(DATA_FOR_CELL_ID);
151
+ if (!cellId) {
152
+ return null;
153
+ }
154
+ return cellId as CellId;
155
+ }
156
+
119
157
  type KeymapHandlers = Record<string, () => boolean>;
120
158
 
121
159
  /**
@@ -29,6 +29,8 @@ export function renderMimeIcon(mime: string) {
29
29
  return "📝";
30
30
  case "application/vnd.vegalite.v5+json":
31
31
  case "application/vnd.vega.v5+json":
32
+ case "application/vnd.vegalite.v6+json":
33
+ case "application/vnd.vega.v6+json":
32
34
  return "📊";
33
35
  case "application/vnd.marimo+mimebundle":
34
36
  return "📦";
@@ -8,6 +8,7 @@ import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
8
8
  import { normalizeName } from "@/core/cells/names";
9
9
  import { type ConnectionName, DUCKDB_ENGINE } from "@/core/datasets/engines";
10
10
  import { useAutoGrowInputProps } from "@/hooks/useAutoGrowInputProps";
11
+ import { cellIdState } from "../../cells/state";
11
12
  import { formatSQL } from "../../format";
12
13
  import { languageAdapterState } from "../extension";
13
14
  import { MarkdownLanguageAdapter } from "../languages/markdown";
@@ -31,6 +32,7 @@ export const LanguagePanelComponent: React.FC<{
31
32
  }> = ({ view }) => {
32
33
  const { spanProps, inputProps } = useAutoGrowInputProps({ minWidth: 50 });
33
34
  const languageAdapter = view.state.field(languageAdapterState);
35
+ const cellId = view.state.facet(cellIdState);
34
36
 
35
37
  let actions: React.ReactNode = <div />;
36
38
  let showDivider = false;
@@ -93,6 +95,7 @@ export const LanguagePanelComponent: React.FC<{
93
95
  <SQLEngineSelect
94
96
  selectedEngine={metadata.engine}
95
97
  onChange={switchEngine}
98
+ cellId={cellId}
96
99
  />
97
100
  <div className="flex items-center gap-2 ml-auto">
98
101
  {metadata.engine === DUCKDB_ENGINE && <SQLModeSelect />}
@@ -8,6 +8,7 @@ import {
8
8
  DatabaseBackup,
9
9
  SearchCheck,
10
10
  } from "lucide-react";
11
+ import { getCellForDomProps } from "@/components/data-table/cell-utils";
11
12
  import { transformDisplayName } from "@/components/databases/display";
12
13
  import { DatabaseLogo } from "@/components/databases/icon";
13
14
  import { Button } from "@/components/ui/button";
@@ -22,6 +23,7 @@ import {
22
23
  SelectValue,
23
24
  } from "@/components/ui/select";
24
25
  import { Tooltip } from "@/components/ui/tooltip";
26
+ import type { CellId } from "@/core/cells/ids";
25
27
  import {
26
28
  dataConnectionsMapAtom,
27
29
  setLatestEngineSelected,
@@ -38,11 +40,13 @@ import { type SQLMode, useSQLMode } from "../languages/sql/sql-mode";
38
40
  interface SelectProps {
39
41
  selectedEngine: ConnectionName;
40
42
  onChange: (engine: ConnectionName) => void;
43
+ cellId: CellId;
41
44
  }
42
45
 
43
46
  export const SQLEngineSelect: React.FC<SelectProps> = ({
44
47
  selectedEngine,
45
48
  onChange,
49
+ cellId,
46
50
  }) => {
47
51
  const connectionsMap = useAtomValue(dataConnectionsMapAtom);
48
52
 
@@ -98,10 +102,10 @@ export const SQLEngineSelect: React.FC<SelectProps> = ({
98
102
  return (
99
103
  <div className="flex flex-row gap-1 items-center">
100
104
  <Select value={selectedEngine} onValueChange={handleSelectEngine}>
101
- <SQLSelectTrigger>
105
+ <SQLSelectTrigger {...getCellForDomProps(cellId)}>
102
106
  <SelectValue placeholder="Select an engine" />
103
107
  </SQLSelectTrigger>
104
- <SelectContent>
108
+ <SelectContent {...getCellForDomProps(cellId)}>
105
109
  <SelectGroup>
106
110
  <SelectLabel>Database connections</SelectLabel>
107
111
  {engineIsDisconnected && (
@@ -190,7 +190,11 @@ export const UserConfigSchema = z
190
190
  })
191
191
  // Pass through so that we don't remove any extra keys that the user has added.
192
192
  .prefault(() => ({})),
193
- server: z.looseObject({}).prefault(() => ({})),
193
+ server: z
194
+ .looseObject({
195
+ disable_file_downloads: z.boolean().optional(),
196
+ })
197
+ .prefault(() => ({})),
194
198
  diagnostics: z
195
199
  .looseObject({
196
200
  enabled: z.boolean().optional(),