diff --git a/src/package-lock.json b/src/package-lock.json index cb1a0d7b..7fe68f37 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -23,6 +23,7 @@ "react-accessible-treeview": "^2.6.1", "react-dom": "^18.2.0", "react-icons": "^4.10.1", + "react-resizable-panels": "^2.0.19", "tsx": "^4.0.0", "xmlhttprequest-ssl": "^2.1.0", "xterm": "^5.1.0", @@ -2524,12 +2525,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -3739,9 +3740,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -6635,6 +6636,15 @@ "integrity": "sha512-wRiUsea88TjKDc4FBEn+sLvIDesp6brMbGWnJGjew2waAc9evdhja/2LvePc898HJbHw0L+MTWy7NhpnELAvLQ==", "dev": true }, + "node_modules/react-resizable-panels": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-2.0.19.tgz", + "integrity": "sha512-v3E41kfKSuCPIvJVb4nL4mIZjjKIn/gh6YqZF/gDfQDolv/8XnhJBek4EiV2gOr3hhc5A3kOGOayk3DhanpaQw==", + "peerDependencies": { + "react": "^16.14.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/reflect.getprototypeof": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.6.tgz", diff --git a/src/package.json b/src/package.json index c46c66d8..319f66a0 100644 --- a/src/package.json +++ b/src/package.json @@ -69,6 +69,7 @@ "react-accessible-treeview": "^2.6.1", "react-dom": "^18.2.0", "react-icons": "^4.10.1", + "react-resizable-panels": "^2.0.19", "tsx": "^4.0.0", "xmlhttprequest-ssl": "^2.1.0", "xterm": "^5.1.0", diff --git a/src/repl/App.css b/src/repl/App.css index 3c0a33e6..e09c03d2 100644 --- a/src/repl/App.css +++ b/src/repl/App.css @@ -14,54 +14,20 @@ body { } .repl { - display: grid; - grid-template-columns: repeat(2, 1fr); - grid-template-rows: repeat(6, 1fr); width: 100vw; height: 100vh; } -.editor { - grid-row: 1 / 5; - grid-column: 1; - overflow: auto; - border-style: solid; - border-color: var(--bg-secondary); - border-width: 0px 2px 2px 0px; - padding-top: 5px; +div[data-panel] { + display: flex; + flex-direction: column; } -.term { - grid-row-start: 5; - grid-row-end: -1; - grid-column: 1; - border-style: solid; - background-color: var(--bg-primary); - border-color: var(--bg-secondary); - border-width: 2px 2px 0px 0px; - overflow: hidden; - padding: 0px 5px; +div[data-resize-handle] { + padding: 2px; + background-color: var(--bg-secondary); } -.editor[style*='display: none']~.term { - grid-row-start: 1; -} - -.files { - grid-row: 1 / 3; - grid-column: 2; - border-style: solid; - border-color: var(--bg-secondary); - border-width: 0px 0px 2px 2px; - overflow: auto; - padding: 5px 0; -} - -.plot { - grid-row: 3 / -1; - grid-column: 2; - border-style: solid; - border-color: var(--bg-secondary); - border-width: 2px 0px 0px 2px; - overflow: hidden; +.d-none + div[data-resize-handle] { + display: none !important; } diff --git a/src/repl/App.tsx b/src/repl/App.tsx index 233053df..1e169627 100644 --- a/src/repl/App.tsx +++ b/src/repl/App.tsx @@ -5,6 +5,7 @@ import Editor from './components/Editor'; import Plot from './components/Plot'; import Files from './components/Files'; import { Readline } from 'xterm-readline'; +import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels'; import { WebR } from '../webR/webr-main'; import { CanvasMessage, PagerMessage } from '../webR/webr-chan'; import './App.css'; @@ -73,14 +74,27 @@ async function handlePagerMessage(msg: PagerMessage) { function App() { return (
+
This component is an instance of the CodeMirror interactive text editor. The editor has been configured so that the Tab key controls the indentation of code. To move focus away from the editor, press the Escape key, and then press the Tab key directly after it. @@ -382,7 +384,7 @@ export function Editor({ Save }