diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 1dc588d3..eaac77b0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -67,7 +67,7 @@ jobs: pipx run build server pipx run build server/example-client --outdir server/dist - name: Upload sdist and wheel as artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: dist path: server/dist @@ -88,7 +88,7 @@ jobs: steps: # Download sdist and wheel from dist job - - uses: actions/download-artifact@v7 + - uses: actions/download-artifact@v8 with: path: dist # Publish to PyPI using trusted publishing diff --git a/client/component/README.md b/client/component/README.md index 9badcd71..28c35ef6 100644 --- a/client/component/README.md +++ b/client/component/README.md @@ -4,10 +4,14 @@ View the frontend Typescript documentation [here](https://diamondlightsource.git ## Installation +Currently, only React 18 is supported. + ### `pnpm add @diamondlightsource/davidia` ## Vite configuration +Use `vite < 8` in your devDependencies. + Some davidia dependencies require a global object to be defined when used in Vite applications. Add the following to your vite.config.ts: ```js diff --git a/client/component/package.json b/client/component/package.json index e2c95ac8..39d79788 100644 --- a/client/component/package.json +++ b/client/component/package.json @@ -6,7 +6,7 @@ "url": "git+https://github.com/DiamondLightSource/davidia.git" }, "private": false, - "version": "1.1.0", + "version": "1.2.0", "type": "module", "scripts": { "build": "tsc && vite build", @@ -23,8 +23,10 @@ }, "publishConfig": { "exports": { - ".": "./dist/index.js", - "types": "./dist/index.d.ts", + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, "./index.css": "./dist/index.css" } }, @@ -43,7 +45,7 @@ "ndarray-tile": "^1.0.3", "ndarray-unsqueeze": "^1.0.3", "react-colorful": "^5.8.0", - "react-draggable": "^4.7.0", + "react-draggable": "^4.7.1", "react-icons": "^5.7.0", "react-select": "^5.10.2", "react-use-websocket": "^4.13.0", diff --git a/client/component/src/AspectConfigModal.tsx b/client/component/src/AspectConfigModal.tsx index 9063c445..a82ab453 100644 --- a/client/component/src/AspectConfigModal.tsx +++ b/client/component/src/AspectConfigModal.tsx @@ -33,8 +33,8 @@ function AspectConfigModal(props: PropsWithChildren) { const [aspectRatio, setAspectRatio] = useState(2.0); const initType = getAspectType(initAspect); - console.log('Set initial type', props); if (initType != aspectType) { + console.log('Set initial type', props); setAspectType(initType); if (initType === 'number') { setAspectRatio(initAspect as number); diff --git a/client/component/src/ConnectedPlot.tsx b/client/component/src/ConnectedPlot.tsx index 8c5c8d17..2e1afc0a 100644 --- a/client/component/src/ConnectedPlot.tsx +++ b/client/component/src/ConnectedPlot.tsx @@ -226,6 +226,16 @@ interface ConnectedPlotProps { port?: string; /** The universally unique identifier */ uuid: string; + /** + * If enabled, forces the plot to shrink or expand to keep the image flush with the axes. + * Has no effect if the aspect is not equal. + */ + tightAxes?: boolean; + /** + * Children to customize the toolbar. If undefined then use default toolbar, if null, disable toolbar, + * otherwise use given children + */ + customToolbarChildren?: React.ReactNode; } /** @@ -239,6 +249,8 @@ function ConnectedPlot({ hostname = '127.0.0.1', port = '80', uuid, + tightAxes = false, + customToolbarChildren = undefined, }: ConnectedPlotProps) { const [plotProps, setPlotProps] = useState(); const [lineData, setLineData] = useState([]); @@ -648,7 +660,14 @@ function ConnectedPlot({ let currentProps = plotProps; if (currentProps) { - currentProps = { ...currentProps, batonProps, updateSelection, selections }; + currentProps = { + ...currentProps, + batonProps, + updateSelection, + selections, + tightAxes, + customToolbarChildren, + }; } if (currentProps) { diff --git a/client/component/src/LinePlot.tsx b/client/component/src/LinePlot.tsx index 66ebf263..249d8fba 100644 --- a/client/component/src/LinePlot.tsx +++ b/client/component/src/LinePlot.tsx @@ -120,7 +120,7 @@ function createDataCurve( curveType={curveType} glyphType={p.glyphType ?? GlyphType.Circle} glyphSize={p.pointSize} - width={p.width} + width={p.width ?? 1} visible={visible} /> ); diff --git a/client/component/src/Modal.tsx b/client/component/src/Modal.tsx index 969d199c..9d2fe3cc 100644 --- a/client/component/src/Modal.tsx +++ b/client/component/src/Modal.tsx @@ -67,7 +67,6 @@ function Modal(props: PropsWithChildren) { {!toggleHidden && toggle} {showModal && props.children && ( - /* @ts-expect-error see https://github.com/react-grid-layout/react-draggable/issues/807, fix post 4.7.0 */