@marimo-team/islands 0.18.5-dev200 → 0.18.5-dev202

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
@@ -30404,16 +30404,7 @@ ${c.sqlString}
30404
30404
  }
30405
30405
  };
30406
30406
  }
30407
- const jotaiJsonStorage = createJSONStorage(() => availableStorage), capabilitiesAtom = atom({
30408
- terminal: false,
30409
- pylsp: false,
30410
- basedpyright: false,
30411
- ty: false
30412
- });
30413
- function hasCapability(e) {
30414
- var _a2;
30415
- return ((_a2 = store.get(capabilitiesAtom)) == null ? void 0 : _a2[e]) ?? false;
30416
- }
30407
+ const jotaiJsonStorage = createJSONStorage(() => availableStorage);
30417
30408
  function repl(e, r) {
30418
30409
  if (typeof window > "u") return;
30419
30410
  let c = `__marimo__${r}`;
@@ -30556,14 +30547,10 @@ ${c.sqlString}
30556
30547
  new Map(PANELS.map((e) => [
30557
30548
  e.type,
30558
30549
  e
30559
- ]));
30560
- function isPanelHidden(e) {
30561
- return !!(e.hidden || e.requiredCapability && !hasCapability(e.requiredCapability));
30562
- }
30563
- require_compiler_runtime();
30550
+ ])), require_compiler_runtime();
30564
30551
  const panelLayoutAtom = atomWithStorage("marimo:panel-layout", {
30565
- sidebar: PANELS.filter((e) => !isPanelHidden(e) && e.defaultSection === "sidebar").map((e) => e.type),
30566
- developerPanel: PANELS.filter((e) => !isPanelHidden(e) && e.defaultSection === "developer-panel").map((e) => e.type)
30552
+ sidebar: PANELS.filter((e) => !e.hidden && e.defaultSection === "sidebar").map((e) => e.type),
30553
+ developerPanel: PANELS.filter((e) => !e.hidden && e.defaultSection === "developer-panel").map((e) => e.type)
30567
30554
  }, jotaiJsonStorage, {
30568
30555
  getOnInit: true
30569
30556
  });
@@ -30632,6 +30619,16 @@ ${c.sqlString}
30632
30619
  function useChromeActions() {
30633
30620
  return useActions$2();
30634
30621
  }
30622
+ const capabilitiesAtom = atom({
30623
+ terminal: false,
30624
+ pylsp: false,
30625
+ basedpyright: false,
30626
+ ty: false
30627
+ });
30628
+ function hasCapability(e) {
30629
+ var _a2;
30630
+ return ((_a2 = store.get(capabilitiesAtom)) == null ? void 0 : _a2[e]) ?? false;
30631
+ }
30635
30632
  const documentationAtom = atom({
30636
30633
  documentation: null
30637
30634
  });
@@ -101071,7 +101068,7 @@ Defaulting to \`null\`.`;
101071
101068
  return Logger.warn("Failed to get version from mount config"), null;
101072
101069
  }
101073
101070
  }
101074
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.18.5-dev200"), showCodeInRunModeAtom = atom(true);
101071
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.18.5-dev202"), showCodeInRunModeAtom = atom(true);
101075
101072
  atom(null);
101076
101073
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
101077
101074
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.18.5-dev200",
3
+ "version": "0.18.5-dev202",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -8,7 +8,7 @@ import { createReducerAndAtoms } from "@/utils/createReducer";
8
8
  import { jotaiJsonStorage } from "@/utils/storage/jotai";
9
9
  import { ZodLocalStorage } from "@/utils/storage/typed";
10
10
  import type { PanelSection, PanelType } from "./types";
11
- import { isPanelHidden, PANELS } from "./types";
11
+ import { PANELS } from "./types";
12
12
 
13
13
  export interface ChromeState {
14
14
  selectedPanel: PanelType | undefined;
@@ -28,10 +28,10 @@ export interface PanelLayout {
28
28
 
29
29
  const DEFAULT_PANEL_LAYOUT: PanelLayout = {
30
30
  sidebar: PANELS.filter(
31
- (p) => !isPanelHidden(p) && p.defaultSection === "sidebar",
31
+ (p) => !p.hidden && p.defaultSection === "sidebar",
32
32
  ).map((p) => p.type),
33
33
  developerPanel: PANELS.filter(
34
- (p) => !isPanelHidden(p) && p.defaultSection === "developer-panel",
34
+ (p) => !p.hidden && p.defaultSection === "developer-panel",
35
35
  ).map((p) => p.type),
36
36
  };
37
37
 
@@ -18,7 +18,6 @@ import {
18
18
  VariableIcon,
19
19
  XCircleIcon,
20
20
  } from "lucide-react";
21
- import { hasCapability } from "@/core/config/capabilities";
22
21
  import { getFeatureFlag } from "@/core/config/feature-flag";
23
22
  import type { Capabilities } from "@/core/kernel/messages";
24
23
  import { isWasm } from "@/core/wasm/utils";
@@ -188,12 +187,15 @@ export const PANEL_MAP = new Map<PanelType, PanelDescriptor>(
188
187
  * Check if a panel should be hidden based on its `hidden` property
189
188
  * and `requiredCapability`.
190
189
  */
191
- export function isPanelHidden(panel: PanelDescriptor): boolean {
190
+ export function isPanelHidden(
191
+ panel: PanelDescriptor,
192
+ capabilities: Capabilities,
193
+ ): boolean {
192
194
  if (panel.hidden) {
193
195
  return true;
194
196
  }
195
197
  if (panel.requiredCapability) {
196
- if (!hasCapability(panel.requiredCapability)) {
198
+ if (!capabilities[panel.requiredCapability]) {
197
199
  return true;
198
200
  }
199
201
  }
@@ -22,6 +22,7 @@ import { ReorderableList } from "@/components/ui/reorderable-list";
22
22
  import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
23
23
  import { LazyMount } from "@/components/utils/lazy-mount";
24
24
  import { cellErrorCount } from "@/core/cells/cells";
25
+ import { capabilitiesAtom } from "@/core/config/capabilities";
25
26
  import { getFeatureFlag } from "@/core/config/feature-flag";
26
27
  import { cn } from "@/utils/cn";
27
28
  import { ErrorBoundary } from "../../boundary/ErrorBoundary";
@@ -83,14 +84,20 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
83
84
  const { dependencyPanelTab, setDependencyPanelTab } = useDependencyPanelTab();
84
85
  const errorCount = useAtomValue(cellErrorCount);
85
86
  const [panelLayout, setPanelLayout] = useAtom(panelLayoutAtom);
87
+ // Subscribe to capabilities to re-render when they change (e.g., terminal capability)
88
+ const capabilities = useAtomValue(capabilitiesAtom);
86
89
 
87
90
  // Convert current developer panel items to PanelDescriptors
91
+ // Filter out hidden panels (e.g., terminal when capability is not available)
88
92
  const devPanelItems = useMemo(() => {
89
93
  return panelLayout.developerPanel.flatMap((id) => {
90
94
  const panel = PANEL_MAP.get(id);
91
- return panel ? [panel] : [];
95
+ if (!panel || isPanelHidden(panel, capabilities)) {
96
+ return [];
97
+ }
98
+ return [panel];
92
99
  });
93
- }, [panelLayout.developerPanel]);
100
+ }, [panelLayout.developerPanel, capabilities]);
94
101
 
95
102
  const handleSetDevPanelItems = (items: PanelDescriptor[]) => {
96
103
  setPanelLayout((prev) => ({
@@ -127,7 +134,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
127
134
  const availableDevPanels = useMemo(() => {
128
135
  const sidebarIds = new Set(panelLayout.sidebar);
129
136
  return PANELS.filter((p) => {
130
- if (isPanelHidden(p)) {
137
+ if (isPanelHidden(p, capabilities)) {
131
138
  return false;
132
139
  }
133
140
  // Exclude panels that are in the sidebar
@@ -136,7 +143,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
136
143
  }
137
144
  return true;
138
145
  });
139
- }, [panelLayout.sidebar]);
146
+ }, [panelLayout.sidebar, capabilities]);
140
147
 
141
148
  // sync sidebar
142
149
  useEffect(() => {
@@ -11,6 +11,7 @@ import {
11
11
  cellErrorCount,
12
12
  notebookQueuedOrRunningCountAtom,
13
13
  } from "@/core/cells/cells";
14
+ import { capabilitiesAtom } from "@/core/config/capabilities";
14
15
  import { cn } from "@/utils/cn";
15
16
  import { FeedbackButton } from "../components/feedback-button";
16
17
  import { panelLayoutAtom, useChromeActions, useChromeState } from "../state";
@@ -25,6 +26,8 @@ export const Sidebar: React.FC = () => {
25
26
  const { selectedPanel, selectedDeveloperPanelTab } = useChromeState();
26
27
  const { toggleApplication, openApplication } = useChromeActions();
27
28
  const [panelLayout, setPanelLayout] = useAtom(panelLayoutAtom);
29
+ // Subscribe to capabilities to re-render when they change
30
+ const capabilities = useAtomValue(capabilitiesAtom);
28
31
 
29
32
  const renderIcon = ({ Icon }: PanelDescriptor, className?: string) => {
30
33
  return <Icon className={cn("h-5 w-5", className)} />;
@@ -35,7 +38,7 @@ export const Sidebar: React.FC = () => {
35
38
  const availableSidebarPanels = useMemo(() => {
36
39
  const devPanelIds = new Set(panelLayout.developerPanel);
37
40
  return PANELS.filter((p) => {
38
- if (isPanelHidden(p)) {
41
+ if (isPanelHidden(p, capabilities)) {
39
42
  return false;
40
43
  }
41
44
  // Exclude panels that are in the developer panel
@@ -44,15 +47,19 @@ export const Sidebar: React.FC = () => {
44
47
  }
45
48
  return true;
46
49
  });
47
- }, [panelLayout.developerPanel]);
50
+ }, [panelLayout.developerPanel, capabilities]);
48
51
 
49
52
  // Convert current sidebar items to PanelDescriptors
53
+ // Filter out hidden panels (e.g., when capability is not available)
50
54
  const sidebarItems = useMemo(() => {
51
55
  return panelLayout.sidebar.flatMap((id) => {
52
56
  const panel = PANEL_MAP.get(id);
53
- return panel ? [panel] : [];
57
+ if (!panel || isPanelHidden(panel, capabilities)) {
58
+ return [];
59
+ }
60
+ return [panel];
54
61
  });
55
- }, [panelLayout.sidebar]);
62
+ }, [panelLayout.sidebar, capabilities]);
56
63
 
57
64
  const handleSetSidebarItems = (items: PanelDescriptor[]) => {
58
65
  setPanelLayout((prev) => ({