@marimo-team/islands 0.19.3-dev28 → 0.19.3-dev30

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/main.js CHANGED
@@ -18579,11 +18579,9 @@ ${JSON.stringify(e2, null, 4)}`);
18579
18579
  }
18580
18580
  ])), f.hoverEnabled && h.push(hoverTooltip((e2, c2) => r == null ? null : r.requestHoverTooltip(e2, offsetToPos(e2.state.doc, c2)), e.hoverConfig)), f.signatureHelpEnabled) {
18581
18581
  h.push(signatureHelpTooltipField);
18582
- let e2 = (e3) => {
18583
- e3.state.field(signatureHelpTooltipField) && e3.dispatch({
18584
- effects: setSignatureHelpTooltip.of(null)
18585
- });
18586
- };
18582
+ let e2 = (e3) => e3.state.field(signatureHelpTooltipField) ? (e3.dispatch({
18583
+ effects: setSignatureHelpTooltip.of(null)
18584
+ }), true) : false;
18587
18585
  h.push(EditorView.domEventHandlers({
18588
18586
  mousedown: (r2, c2) => (e2(c2), false)
18589
18587
  })), h.push(keymap.of([
@@ -18593,7 +18591,7 @@ ${JSON.stringify(e2, null, 4)}`);
18593
18591
  },
18594
18592
  {
18595
18593
  key: "Escape",
18596
- run: (r2) => (e2(r2), true)
18594
+ run: (r2) => e2(r2)
18597
18595
  }
18598
18596
  ])), h.push(EditorView.updateListener.of((c2) => {
18599
18597
  if (!(r && f.signatureActivateOnTyping) || !c2.state.field(signatureHelpTooltipField) || !(c2.selectionSet || c2.docChanged)) return;
@@ -101157,7 +101155,7 @@ Defaulting to \`null\`.`;
101157
101155
  return Logger.warn("Failed to get version from mount config"), null;
101158
101156
  }
101159
101157
  }
101160
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.3-dev28"), showCodeInRunModeAtom = atom(true);
101158
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.3-dev30"), showCodeInRunModeAtom = atom(true);
101161
101159
  atom(null);
101162
101160
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
101163
101161
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.19.3-dev28",
3
+ "version": "0.19.3-dev30",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -55,7 +55,7 @@
55
55
  "@lezer/markdown": "^1.6.2",
56
56
  "@lezer/python": "^1.1.18",
57
57
  "@marimo-team/codemirror-ai": "^0.3.5",
58
- "@marimo-team/codemirror-languageserver": "^1.16.8",
58
+ "@marimo-team/codemirror-languageserver": "^1.16.10",
59
59
  "@marimo-team/codemirror-mcp": "^0.1.5",
60
60
  "@marimo-team/codemirror-sql": "^0.2.4",
61
61
  "@marimo-team/llm-info": "workspace:*",
@@ -20,7 +20,7 @@ import { XIcon } from "lucide-react";
20
20
  import { Button } from "@/components/ui/button";
21
21
  import { ReorderableList } from "@/components/ui/reorderable-list";
22
22
  import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
23
- import { LazyMount } from "@/components/utils/lazy-mount";
23
+ import { LazyActivity } from "@/components/utils/lazy-mount";
24
24
  import { cellErrorCount } from "@/core/cells/cells";
25
25
  import { capabilitiesAtom } from "@/core/config/capabilities";
26
26
  import { getFeatureFlag } from "@/core/config/feature-flag";
@@ -34,6 +34,7 @@ import {
34
34
  PANEL_MAP,
35
35
  PANELS,
36
36
  type PanelDescriptor,
37
+ type PanelType,
37
38
  } from "../types";
38
39
  import { BackendConnectionStatus } from "./footer-items/backend-status";
39
40
  import { PanelsWrapper } from "./panels";
@@ -253,6 +254,29 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
253
254
  return <LazyChatPanel />;
254
255
  };
255
256
 
257
+ const SIDEBAR_PANELS: Record<PanelType, React.ReactNode> = {
258
+ files: <LazyFileExplorerPanel />,
259
+ variables: <LazySessionPanel />,
260
+ dependencies: <LazyDependencyGraphPanel />,
261
+ packages: <LazyPackagesPanel />,
262
+ outline: <LazyOutlinePanel />,
263
+ documentation: <LazyDocumentationPanel />,
264
+ snippets: <LazySnippetsPanel />,
265
+ ai: renderAiPanel(),
266
+ errors: <LazyErrorsPanel />,
267
+ scratchpad: <LazyScratchpadPanel />,
268
+ tracing: <LazyTracingPanel />,
269
+ secrets: <LazySecretsPanel />,
270
+ logs: <LazyLogsPanel />,
271
+ terminal: (
272
+ <LazyTerminal
273
+ visible={isSidebarOpen && selectedPanel === "terminal"}
274
+ onClose={() => setIsSidebarOpen(false)}
275
+ />
276
+ ),
277
+ cache: <LazyCachePanel />,
278
+ };
279
+
256
280
  const helpPaneBody = (
257
281
  <ErrorBoundary>
258
282
  <PanelSectionProvider value="sidebar">
@@ -328,26 +352,14 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
328
352
  </div>
329
353
  <Suspense>
330
354
  <TooltipProvider>
331
- {selectedPanel === "files" && <LazyFileExplorerPanel />}
332
- {selectedPanel === "variables" && <LazySessionPanel />}
333
- {selectedPanel === "dependencies" && <LazyDependencyGraphPanel />}
334
- {selectedPanel === "packages" && <LazyPackagesPanel />}
335
- {selectedPanel === "outline" && <LazyOutlinePanel />}
336
- {selectedPanel === "documentation" && <LazyDocumentationPanel />}
337
- {selectedPanel === "snippets" && <LazySnippetsPanel />}
338
- {selectedPanel === "ai" && renderAiPanel()}
339
- {selectedPanel === "errors" && <LazyErrorsPanel />}
340
- {selectedPanel === "scratchpad" && <LazyScratchpadPanel />}
341
- {selectedPanel === "tracing" && <LazyTracingPanel />}
342
- {selectedPanel === "secrets" && <LazySecretsPanel />}
343
- {selectedPanel === "logs" && <LazyLogsPanel />}
344
- {selectedPanel === "terminal" && (
345
- <LazyTerminal
346
- visible={isSidebarOpen}
347
- onClose={() => setIsSidebarOpen(false)}
348
- />
349
- )}
350
- {selectedPanel === "cache" && <LazyCachePanel />}
355
+ {Object.entries(SIDEBAR_PANELS).map(([key, Panel]) => (
356
+ <LazyActivity
357
+ key={key}
358
+ mode={selectedPanel === key ? "visible" : "hidden"}
359
+ >
360
+ {Panel}
361
+ </LazyActivity>
362
+ ))}
351
363
  </TooltipProvider>
352
364
  </Suspense>
353
365
  </div>
@@ -388,6 +400,18 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
388
400
  </Panel>
389
401
  );
390
402
 
403
+ const DEVELOPER_PANELS: Record<PanelType, React.ReactNode> = {
404
+ ...SIDEBAR_PANELS,
405
+ terminal: (
406
+ <LazyTerminal
407
+ visible={
408
+ isDeveloperPanelOpen && selectedDeveloperPanelTab === "terminal"
409
+ }
410
+ onClose={() => setIsDeveloperPanelOpen(false)}
411
+ />
412
+ ),
413
+ };
414
+
391
415
  const bottomPanel = (
392
416
  <Panel
393
417
  ref={developerPanelRef}
@@ -475,43 +499,16 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
475
499
  <Suspense fallback={<div />}>
476
500
  <PanelSectionProvider value="developer-panel">
477
501
  <div className="flex-1 overflow-hidden">
478
- {selectedDeveloperPanelTab === "files" && (
479
- <LazyFileExplorerPanel />
480
- )}
481
- {selectedDeveloperPanelTab === "variables" && (
482
- <LazySessionPanel />
483
- )}
484
- {selectedDeveloperPanelTab === "dependencies" && (
485
- <LazyDependencyGraphPanel />
486
- )}
487
- {selectedDeveloperPanelTab === "packages" && (
488
- <LazyPackagesPanel />
489
- )}
490
- {selectedDeveloperPanelTab === "outline" && <LazyOutlinePanel />}
491
- {selectedDeveloperPanelTab === "documentation" && (
492
- <LazyDocumentationPanel />
493
- )}
494
- {selectedDeveloperPanelTab === "snippets" && (
495
- <LazySnippetsPanel />
496
- )}
497
- {selectedDeveloperPanelTab === "ai" && renderAiPanel()}
498
- {selectedDeveloperPanelTab === "errors" && <LazyErrorsPanel />}
499
- {selectedDeveloperPanelTab === "scratchpad" && (
500
- <LazyScratchpadPanel />
501
- )}
502
- {selectedDeveloperPanelTab === "tracing" && <LazyTracingPanel />}
503
- {selectedDeveloperPanelTab === "secrets" && <LazySecretsPanel />}
504
- {selectedDeveloperPanelTab === "logs" && <LazyLogsPanel />}
505
- {/* LazyMount needed for Terminal to avoid spurious connection */}
506
- {selectedDeveloperPanelTab === "terminal" && (
507
- <LazyMount isOpen={isDeveloperPanelOpen}>
508
- <LazyTerminal
509
- visible={isDeveloperPanelOpen}
510
- onClose={() => setIsDeveloperPanelOpen(false)}
511
- />
512
- </LazyMount>
513
- )}
514
- {selectedDeveloperPanelTab === "cache" && <LazyCachePanel />}
502
+ {Object.entries(DEVELOPER_PANELS).map(([key, Panel]) => (
503
+ <LazyActivity
504
+ key={key}
505
+ mode={
506
+ selectedDeveloperPanelTab === key ? "visible" : "hidden"
507
+ }
508
+ >
509
+ {Panel}
510
+ </LazyActivity>
511
+ ))}
515
512
  </div>
516
513
  </PanelSectionProvider>
517
514
  </Suspense>
@@ -1,5 +1,9 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
- import React, { type PropsWithChildren } from "react";
2
+ import React, {
3
+ Activity,
4
+ type ActivityProps,
5
+ type PropsWithChildren,
6
+ } from "react";
3
7
 
4
8
  interface Props {
5
9
  isOpen: boolean;
@@ -12,13 +16,30 @@ export const LazyMount: React.FC<PropsWithChildren<Props>> = ({
12
16
  isOpen,
13
17
  children,
14
18
  }) => {
15
- const [isMounted, setIsMounted] = React.useState(false);
19
+ const [hasMountedBefore, setHasMountedBefore] = React.useState(false);
16
20
 
17
- React.useEffect(() => {
18
- if (isOpen && !isMounted) {
19
- setIsMounted(true);
20
- }
21
- }, [isOpen, isMounted]);
21
+ if (isOpen && !hasMountedBefore) {
22
+ setHasMountedBefore(true);
23
+ }
22
24
 
23
- return isMounted ? children : null;
25
+ return hasMountedBefore || isOpen ? children : null;
26
+ };
27
+
28
+ /**
29
+ * Wraps a component in an Activity component. It is not mounted until it is open for the first time.
30
+ */
31
+ export const LazyActivity: React.FC<PropsWithChildren<ActivityProps>> = (
32
+ props,
33
+ ) => {
34
+ const [hasMountedBefore, setHasMountedBefore] = React.useState(false);
35
+
36
+ if (props.mode === "visible" && !hasMountedBefore) {
37
+ setHasMountedBefore(true);
38
+ }
39
+
40
+ if (hasMountedBefore) {
41
+ return <Activity {...props} />;
42
+ }
43
+
44
+ return null;
24
45
  };