@marimo-team/islands 0.18.5-dev198 → 0.18.5-dev199

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.18.5-dev198",
3
+ "version": "0.18.5-dev199",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -3,6 +3,7 @@
3
3
  import { CommandList } from "cmdk";
4
4
  import { BetweenHorizontalStartIcon, PlusIcon, XIcon } from "lucide-react";
5
5
  import React from "react";
6
+ import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
6
7
  import {
7
8
  Command,
8
9
  CommandEmpty,
@@ -29,12 +30,15 @@ import { useTheme } from "@/theme/useTheme";
29
30
  import { cn } from "@/utils/cn";
30
31
  import { HideInKioskMode } from "../../kiosk-mode";
31
32
  import { ContributeSnippetButton } from "../components/contribute-snippet-button";
33
+ import { usePanelOrientation, usePanelSection } from "./panel-context";
32
34
 
33
35
  const extensions = [EditorView.lineWrapping];
34
36
 
35
37
  const SnippetsPanel: React.FC = () => {
36
38
  const { readSnippets } = useRequestClient();
37
39
  const [selectedSnippet, setSelectedSnippet] = React.useState<Snippet>();
40
+ const orientation = usePanelOrientation();
41
+ const section = usePanelSection();
38
42
  const {
39
43
  data: snippets,
40
44
  error,
@@ -51,49 +55,60 @@ const SnippetsPanel: React.FC = () => {
51
55
  return <Spinner size="medium" centered={true} />;
52
56
  }
53
57
 
58
+ const isVertical = orientation === "vertical";
59
+
54
60
  return (
55
- <div className="flex-1 overflow-hidden">
56
- <Command
57
- className={cn(
58
- "border-b rounded-none",
59
- selectedSnippet ? "h-1/3" : "h-full",
60
- )}
61
- >
62
- <div className="flex items-center w-full">
63
- <CommandInput
64
- placeholder="Search snippets..."
65
- className="h-6 m-1"
66
- rootClassName="flex-1 border-r"
67
- />
68
- <ContributeSnippetButton>
69
- <button className="float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground">
70
- <PlusIcon className="h-4 w-4" />
71
- </button>
72
- </ContributeSnippetButton>
73
- </div>
61
+ <div className="flex-1 overflow-hidden h-full">
62
+ <PanelGroup key={section} direction={orientation} className="h-full">
63
+ {/* Snippet list panel */}
64
+ <Panel defaultSize={40} minSize={20} maxSize={70}>
65
+ <Command className="h-full rounded-none">
66
+ <div className="flex items-center w-full border-b">
67
+ <CommandInput
68
+ placeholder="Search snippets..."
69
+ className="h-6 m-1"
70
+ rootClassName="flex-1 border-r"
71
+ />
72
+ <ContributeSnippetButton>
73
+ <button className="float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground">
74
+ <PlusIcon className="h-4 w-4" />
75
+ </button>
76
+ </ContributeSnippetButton>
77
+ </div>
74
78
 
75
- <CommandEmpty>No results</CommandEmpty>
76
- <SnippetList
77
- onSelect={(snippet) => setSelectedSnippet(snippet)}
78
- snippets={snippets.snippets}
79
- />
80
- </Command>
81
- <Suspense>
82
- <div className="h-2/3 snippet-viewer flex flex-col">
83
- {selectedSnippet ? (
84
- <SnippetViewer
85
- key={selectedSnippet.title}
86
- snippet={selectedSnippet}
87
- onClose={() => setSelectedSnippet(undefined)}
88
- />
89
- ) : (
90
- <PanelEmptyState
91
- title=""
92
- description="Click on a snippet to view its content."
79
+ <CommandEmpty>No results</CommandEmpty>
80
+ <SnippetList
81
+ onSelect={(snippet) => setSelectedSnippet(snippet)}
82
+ snippets={snippets.snippets}
93
83
  />
84
+ </Command>
85
+ </Panel>
86
+ <PanelResizeHandle
87
+ className={cn(
88
+ "bg-border hover:bg-primary/50 transition-colors",
89
+ isVertical ? "h-1" : "w-1",
94
90
  )}
95
- </div>
96
- </Suspense>
91
+ />
92
+ {/* Snippet viewer panel */}
93
+ <Panel defaultSize={60} minSize={20}>
94
+ <Suspense>
95
+ <div className="h-full snippet-viewer flex flex-col overflow-hidden">
96
+ {selectedSnippet ? (
97
+ <SnippetViewer
98
+ key={selectedSnippet.title}
99
+ snippet={selectedSnippet}
100
+ onClose={() => setSelectedSnippet(undefined)}
101
+ />
102
+ ) : (
103
+ <PanelEmptyState
104
+ title=""
105
+ description="Click on a snippet to view its content."
106
+ />
107
+ )}
108
+ </div>
109
+ </Suspense>
110
+ </Panel>
111
+ </PanelGroup>
97
112
  </div>
98
113
  );
99
114
  };