@marimo-team/islands 0.18.5-dev172 → 0.18.5-dev174

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
@@ -30396,7 +30396,16 @@ ${c.sqlString}
30396
30396
  }
30397
30397
  };
30398
30398
  }
30399
- const jotaiJsonStorage = createJSONStorage(() => availableStorage);
30399
+ const jotaiJsonStorage = createJSONStorage(() => availableStorage), capabilitiesAtom = atom({
30400
+ terminal: false,
30401
+ pylsp: false,
30402
+ basedpyright: false,
30403
+ ty: false
30404
+ });
30405
+ function hasCapability(e) {
30406
+ var _a2;
30407
+ return ((_a2 = store.get(capabilitiesAtom)) == null ? void 0 : _a2[e]) ?? false;
30408
+ }
30400
30409
  function repl(e, r) {
30401
30410
  if (typeof window > "u") return;
30402
30411
  let c = `__marimo__${r}`;
@@ -30523,7 +30532,9 @@ ${c.sqlString}
30523
30532
  Icon: SquareTerminal,
30524
30533
  label: "Terminal",
30525
30534
  tooltip: "Terminal",
30526
- defaultSection: "developer-panel"
30535
+ hidden: isWasm(),
30536
+ defaultSection: "developer-panel",
30537
+ requiredCapability: "terminal"
30527
30538
  },
30528
30539
  {
30529
30540
  type: "cache",
@@ -30537,9 +30548,13 @@ ${c.sqlString}
30537
30548
  new Map(PANELS.map((e) => [
30538
30549
  e.type,
30539
30550
  e
30540
- ])), require_compiler_runtime(), atomWithStorage("marimo:panel-layout", {
30541
- sidebar: PANELS.filter((e) => !e.hidden && e.defaultSection === "sidebar").map((e) => e.type),
30542
- developerPanel: PANELS.filter((e) => !e.hidden && e.defaultSection === "developer-panel").map((e) => e.type)
30551
+ ]));
30552
+ function isPanelHidden(e) {
30553
+ return !!(e.hidden || e.requiredCapability && !hasCapability(e.requiredCapability));
30554
+ }
30555
+ require_compiler_runtime(), atomWithStorage("marimo:panel-layout", {
30556
+ sidebar: PANELS.filter((e) => !isPanelHidden(e) && e.defaultSection === "sidebar").map((e) => e.type),
30557
+ developerPanel: PANELS.filter((e) => !isPanelHidden(e) && e.defaultSection === "developer-panel").map((e) => e.type)
30543
30558
  }, jotaiJsonStorage, {
30544
30559
  getOnInit: true
30545
30560
  });
@@ -30599,15 +30614,6 @@ ${c.sqlString}
30599
30614
  function useChromeActions() {
30600
30615
  return useActions$2();
30601
30616
  }
30602
- const capabilitiesAtom = atom({
30603
- terminal: false,
30604
- pylsp: false,
30605
- basedpyright: false,
30606
- ty: false
30607
- });
30608
- function hasCapability(e) {
30609
- return store.get(capabilitiesAtom)[e] ?? false;
30610
- }
30611
30617
  const documentationAtom = atom({
30612
30618
  documentation: null
30613
30619
  });
@@ -101019,7 +101025,7 @@ Defaulting to \`null\`.`;
101019
101025
  return Logger.warn("Failed to get version from mount config"), null;
101020
101026
  }
101021
101027
  }
101022
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.18.5-dev172"), showCodeInRunModeAtom = atom(true);
101028
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.18.5-dev174"), showCodeInRunModeAtom = atom(true);
101023
101029
  atom(null);
101024
101030
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
101025
101031
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.18.5-dev172",
3
+ "version": "0.18.5-dev174",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -7,7 +7,7 @@ import { createReducerAndAtoms } from "@/utils/createReducer";
7
7
  import { jotaiJsonStorage } from "@/utils/storage/jotai";
8
8
  import { ZodLocalStorage } from "@/utils/storage/typed";
9
9
  import type { PanelType } from "./types";
10
- import { PANELS } from "./types";
10
+ import { isPanelHidden, PANELS } from "./types";
11
11
 
12
12
  export interface ChromeState {
13
13
  selectedPanel: PanelType | undefined;
@@ -27,10 +27,10 @@ export interface PanelLayout {
27
27
 
28
28
  const DEFAULT_PANEL_LAYOUT: PanelLayout = {
29
29
  sidebar: PANELS.filter(
30
- (p) => !p.hidden && p.defaultSection === "sidebar",
30
+ (p) => !isPanelHidden(p) && p.defaultSection === "sidebar",
31
31
  ).map((p) => p.type),
32
32
  developerPanel: PANELS.filter(
33
- (p) => !p.hidden && p.defaultSection === "developer-panel",
33
+ (p) => !isPanelHidden(p) && p.defaultSection === "developer-panel",
34
34
  ).map((p) => p.type),
35
35
  };
36
36
 
@@ -18,7 +18,9 @@ import {
18
18
  VariableIcon,
19
19
  XCircleIcon,
20
20
  } from "lucide-react";
21
+ import { hasCapability } from "@/core/config/capabilities";
21
22
  import { getFeatureFlag } from "@/core/config/feature-flag";
23
+ import type { Capabilities } from "@/core/kernel/messages";
22
24
  import { isWasm } from "@/core/wasm/utils";
23
25
 
24
26
  /**
@@ -56,6 +58,8 @@ export interface PanelDescriptor {
56
58
  hidden?: boolean;
57
59
  /** Which section this panel belongs to by default */
58
60
  defaultSection: PanelSection;
61
+ /** Capability required for this panel to be visible. If the capability is false, the panel is hidden. */
62
+ requiredCapability?: keyof Capabilities;
59
63
  }
60
64
 
61
65
  /**
@@ -162,7 +166,9 @@ export const PANELS: PanelDescriptor[] = [
162
166
  Icon: TerminalSquareIcon,
163
167
  label: "Terminal",
164
168
  tooltip: "Terminal",
169
+ hidden: isWasm(),
165
170
  defaultSection: "developer-panel",
171
+ requiredCapability: "terminal",
166
172
  },
167
173
  {
168
174
  type: "cache",
@@ -177,3 +183,19 @@ export const PANELS: PanelDescriptor[] = [
177
183
  export const PANEL_MAP = new Map<PanelType, PanelDescriptor>(
178
184
  PANELS.map((p) => [p.type, p]),
179
185
  );
186
+
187
+ /**
188
+ * Check if a panel should be hidden based on its `hidden` property
189
+ * and `requiredCapability`.
190
+ */
191
+ export function isPanelHidden(panel: PanelDescriptor): boolean {
192
+ if (panel.hidden) {
193
+ return true;
194
+ }
195
+ if (panel.requiredCapability) {
196
+ if (!hasCapability(panel.requiredCapability)) {
197
+ return true;
198
+ }
199
+ }
200
+ return false;
201
+ }
@@ -28,7 +28,12 @@ import { ErrorBoundary } from "../../boundary/ErrorBoundary";
28
28
  import { ContextAwarePanel } from "../panels/context-aware-panel/context-aware-panel";
29
29
  import { PanelSectionProvider } from "../panels/panel-context";
30
30
  import { panelLayoutAtom, useChromeActions, useChromeState } from "../state";
31
- import { PANEL_MAP, PANELS, type PanelDescriptor } from "../types";
31
+ import {
32
+ isPanelHidden,
33
+ PANEL_MAP,
34
+ PANELS,
35
+ type PanelDescriptor,
36
+ } from "../types";
32
37
  import { BackendConnectionStatus } from "./footer-items/backend-status";
33
38
  import { Minimap } from "./minimap";
34
39
  import { PanelsWrapper } from "./panels";
@@ -125,7 +130,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
125
130
  const availableDevPanels = useMemo(() => {
126
131
  const sidebarIds = new Set(panelLayout.sidebar);
127
132
  return PANELS.filter((p) => {
128
- if (p.hidden) {
133
+ if (isPanelHidden(p)) {
129
134
  return false;
130
135
  }
131
136
  // Exclude panels that are in the sidebar
@@ -11,7 +11,12 @@ import { notebookQueuedOrRunningCountAtom } from "@/core/cells/cells";
11
11
  import { cn } from "@/utils/cn";
12
12
  import { FeedbackButton } from "../components/feedback-button";
13
13
  import { panelLayoutAtom, useChromeActions, useChromeState } from "../state";
14
- import { PANEL_MAP, PANELS, type PanelDescriptor } from "../types";
14
+ import {
15
+ isPanelHidden,
16
+ PANEL_MAP,
17
+ PANELS,
18
+ type PanelDescriptor,
19
+ } from "../types";
15
20
 
16
21
  export const Sidebar: React.FC = () => {
17
22
  const { selectedPanel, selectedDeveloperPanelTab } = useChromeState();
@@ -28,7 +33,7 @@ export const Sidebar: React.FC = () => {
28
33
  const availableSidebarPanels = useMemo(() => {
29
34
  const devPanelIds = new Set(panelLayout.developerPanel);
30
35
  return PANELS.filter((p) => {
31
- if (p.hidden) {
36
+ if (isPanelHidden(p)) {
32
37
  return false;
33
38
  }
34
39
  // Exclude panels that are in the developer panel
@@ -11,5 +11,5 @@ export const capabilitiesAtom = atom<Capabilities>({
11
11
  });
12
12
 
13
13
  export function hasCapability(key: keyof Capabilities): boolean {
14
- return store.get(capabilitiesAtom)[key] ?? false;
14
+ return store.get(capabilitiesAtom)?.[key] ?? false;
15
15
  }
@@ -15,7 +15,7 @@ import type { ResolvedTheme } from "@/theme/useTheme";
15
15
  import { Logger } from "@/utils/Logger";
16
16
  import { ErrorBanner } from "../common/error-banner";
17
17
 
18
- export const LANGUAGE_MAP: Record<string, string> = {
18
+ export const LANGUAGE_MAP: Record<string, LanguageName | undefined> = {
19
19
  python: "py",
20
20
  javascript: "js",
21
21
  typescript: "ts",