react-science 0.20.0 → 0.21.0
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/lib/app/hooks/file-loading.js +7 -1
- package/lib/components/dropdown-menu/MenuItems.js +2 -1
- package/lib/components/split-pane/SplitPane.js +23 -8
- package/lib-esm/app/hooks/file-loading.d.ts.map +1 -1
- package/lib-esm/app/hooks/file-loading.js +8 -2
- package/lib-esm/app/hooks/file-loading.js.map +1 -1
- package/lib-esm/app-data/loaders/utility/getMeasurementInfoFromFile.d.ts +2 -2
- package/lib-esm/components/dropdown-menu/MenuItems.js +2 -1
- package/lib-esm/components/dropdown-menu/MenuItems.js.map +1 -1
- package/lib-esm/components/split-pane/SplitPane.d.ts +3 -3
- package/lib-esm/components/split-pane/SplitPane.d.ts.map +1 -1
- package/lib-esm/components/split-pane/SplitPane.js +24 -9
- package/lib-esm/components/split-pane/SplitPane.js.map +1 -1
- package/package.json +31 -31
- package/src/app/hooks/file-loading.ts +8 -2
- package/src/components/dropdown-menu/MenuItems.tsx +2 -1
- package/src/components/split-pane/SplitPane.tsx +29 -14
|
@@ -16,7 +16,13 @@ function useLoadFileCollectionFromHash(onLoad) {
|
|
|
16
16
|
if (!filelistUrl) {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const request = await fetch(filelistUrl);
|
|
20
|
+
const data = await request.json();
|
|
21
|
+
let baseURL = filelistUrl.replace(/\/[^/]*$/, '/');
|
|
22
|
+
const fileCollection = await (0, filelist_utils_1.fileCollectionFromWebSource)({
|
|
23
|
+
entries: data,
|
|
24
|
+
baseURL,
|
|
25
|
+
});
|
|
20
26
|
void onLoad(fileCollection, appDispatch);
|
|
21
27
|
return true;
|
|
22
28
|
},
|
|
@@ -72,7 +72,8 @@ function Item(props) {
|
|
|
72
72
|
if (isDivider) {
|
|
73
73
|
return (0, jsx_runtime_1.jsx)(Divider, {});
|
|
74
74
|
}
|
|
75
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Menu.Item, { disabled: option.disabled, children: ({ active }) => ((0, jsx_runtime_1.jsxs)(ItemDiv, { onClick: () => {
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Menu.Item, { disabled: option.disabled, children: ({ active }) => ((0, jsx_runtime_1.jsxs)(ItemDiv, { onClick: (event) => {
|
|
76
|
+
event.stopPropagation();
|
|
76
77
|
onSelect(option);
|
|
77
78
|
}, active: active, disabled: option.disabled || false, children: [(0, jsx_runtime_1.jsx)(IconDiv, { children: option.icon }), (0, jsx_runtime_1.jsx)(LabelDiv, { children: option.label })] })) }));
|
|
78
79
|
}
|
|
@@ -17,14 +17,27 @@ function useSplitPaneContext() {
|
|
|
17
17
|
}
|
|
18
18
|
exports.useSplitPaneContext = useSplitPaneContext;
|
|
19
19
|
function SplitPane(props) {
|
|
20
|
-
const { direction = 'horizontal', controlledSide = 'start',
|
|
21
|
-
const minimumSize = typeof
|
|
20
|
+
const { direction = 'horizontal', controlledSide = 'start', size = '50%', closed = false, onResize, onToggle, children, } = props;
|
|
21
|
+
const minimumSize = typeof closed === 'number' ? closed : null;
|
|
22
22
|
// Whether the pane is explicitly closed. If the value is `false`, the pane
|
|
23
23
|
// may still be currently closed because it is smaller than the minimum size.
|
|
24
|
-
const [isPaneClosed, closePane, openPane] = (0, useOnOff_1.useOnOff)(typeof
|
|
24
|
+
const [isPaneClosed, closePane, openPane] = (0, useOnOff_1.useOnOff)(typeof closed === 'boolean' ? closed : false);
|
|
25
25
|
// Whether the user has already interacted with the pane.
|
|
26
26
|
const [hasTouched, touch] = (0, react_2.useReducer)(() => true, false);
|
|
27
|
-
const [[
|
|
27
|
+
const [[splitSize, sizeType], setSize] = (0, react_2.useState)(() => parseSize(size));
|
|
28
|
+
(0, react_2.useEffect)(() => {
|
|
29
|
+
setSize(parseSize(size));
|
|
30
|
+
}, [size]);
|
|
31
|
+
(0, react_2.useEffect)(() => {
|
|
32
|
+
if (typeof closed === 'boolean') {
|
|
33
|
+
if (closed) {
|
|
34
|
+
closePane();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
openPane();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, [closePane, closed, openPane]);
|
|
28
41
|
const splitterRef = (0, react_2.useRef)(null);
|
|
29
42
|
const { onMouseDown } = (0, useSplitPaneSize_1.useSplitPaneSize)({
|
|
30
43
|
controlledSide,
|
|
@@ -67,7 +80,7 @@ function SplitPane(props) {
|
|
|
67
80
|
}
|
|
68
81
|
}
|
|
69
82
|
function getSplitSideStyle(side) {
|
|
70
|
-
return getItemStyle(isFinalClosed, controlledSide === side, direction,
|
|
83
|
+
return getItemStyle(isFinalClosed, controlledSide === side, direction, splitSize, sizeType);
|
|
71
84
|
}
|
|
72
85
|
return ((0, jsx_runtime_1.jsxs)("div", { ref: rootSize.ref, style: {
|
|
73
86
|
display: 'flex',
|
|
@@ -85,9 +98,11 @@ function SplitSide(props) {
|
|
|
85
98
|
const { style, children } = props;
|
|
86
99
|
return (0, jsx_runtime_1.jsx)("div", { style: style, children: children });
|
|
87
100
|
}
|
|
88
|
-
function parseSize(
|
|
89
|
-
const
|
|
90
|
-
|
|
101
|
+
function parseSize(size) {
|
|
102
|
+
const value = Number.parseFloat(size);
|
|
103
|
+
// remove numbers and dots from the string
|
|
104
|
+
const type = size.replace(/[\d .]/g, '');
|
|
105
|
+
return [value, type];
|
|
91
106
|
}
|
|
92
107
|
const flexBase = 100;
|
|
93
108
|
function percentToFlex(percent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-loading.d.ts","sourceRoot":"","sources":["../../../src/app/hooks/file-loading.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"file-loading.d.ts","sourceRoot":"","sources":["../../../src/app/hooks/file-loading.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAA+B,MAAM,gBAAgB,CAAC;AAG7E,OAAO,EAAE,WAAW,EAAkB,MAAM,sBAAsB,CAAC;AAGnE,KAAK,MAAM,GAAG,CACZ,KAAK,EAAE,IAAI,EAAE,GAAG,cAAc,EAC9B,QAAQ,EAAE,WAAW,KAClB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,wEAsB3D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,WAG/B,IAAI,EAAE,UAMjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { fileCollectionFromWebSource } from 'filelist-utils';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { useAppDispatch } from '../../app-data/index';
|
|
5
5
|
import { useHashSearchParams } from '../../components/index';
|
|
@@ -13,7 +13,13 @@ export function useLoadFileCollectionFromHash(onLoad) {
|
|
|
13
13
|
if (!filelistUrl) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
|
-
const
|
|
16
|
+
const request = await fetch(filelistUrl);
|
|
17
|
+
const data = await request.json();
|
|
18
|
+
let baseURL = filelistUrl.replace(/\/[^/]*$/, '/');
|
|
19
|
+
const fileCollection = await fileCollectionFromWebSource({
|
|
20
|
+
entries: data,
|
|
21
|
+
baseURL,
|
|
22
|
+
});
|
|
17
23
|
void onLoad(fileCollection, appDispatch);
|
|
18
24
|
return true;
|
|
19
25
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-loading.js","sourceRoot":"","sources":["../../../src/app/hooks/file-loading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAkB,
|
|
1
|
+
{"version":3,"file":"file-loading.js","sourceRoot":"","sources":["../../../src/app/hooks/file-loading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAA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Q,EAAE,MAAM,CAAC,CACnB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -65,7 +65,8 @@ function Item(props) {
|
|
|
65
65
|
if (isDivider) {
|
|
66
66
|
return _jsx(Divider, {});
|
|
67
67
|
}
|
|
68
|
-
return (_jsx(Menu.Item, { disabled: option.disabled, children: ({ active }) => (_jsxs(ItemDiv, { onClick: () => {
|
|
68
|
+
return (_jsx(Menu.Item, { disabled: option.disabled, children: ({ active }) => (_jsxs(ItemDiv, { onClick: (event) => {
|
|
69
|
+
event.stopPropagation();
|
|
69
70
|
onSelect(option);
|
|
70
71
|
}, active: active, disabled: option.disabled || false, children: [_jsx(IconDiv, { children: option.icon }), _jsx(LabelDiv, { children: option.label })] })) }));
|
|
71
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItems.js","sourceRoot":"","sources":["../../../src/components/dropdown-menu/MenuItems.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAiBzC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAGxB;;YAEU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;;WAEpD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC;;;;MAIlE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,uCAAuC;;;IAGpE,CAAC,KAAK,EAAE,EAAE,CACV,CAAC,KAAK,CAAC,QAAQ;IACf;;;;SAIK;CACR,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;;CAMxB,CAAC;AAEF,MAAM,QAA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/**
|
|
21
|
-
*
|
|
21
|
+
* size of the controlled side. Unit can be either '%' or 'px'.
|
|
22
22
|
* @default '50%'
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
size?: SplitPaneSize;
|
|
25
25
|
/**
|
|
26
26
|
* Defines whether the pane is initially closed.
|
|
27
27
|
* A value of `true` means the pane is always initially closed.
|
|
@@ -33,7 +33,7 @@ export interface SplitPaneProps {
|
|
|
33
33
|
* no longer open or close automatically.
|
|
34
34
|
* @default false
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
closed?: boolean | number;
|
|
37
37
|
/**
|
|
38
38
|
* Called whenever the user finishes resizing the pane.
|
|
39
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitPane.d.ts","sourceRoot":"","sources":["../../../src/components/split-pane/SplitPane.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,SAAS,
|
|
1
|
+
{"version":3,"file":"SplitPane.d.ts","sourceRoot":"","sources":["../../../src/components/split-pane/SplitPane.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,SAAS,EAOV,MAAM,OAAO,CAAC;AAOf,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,YAAY,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,CAAC;AAC5C,MAAM,MAAM,aAAa,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CAClC;AAID,wBAAgB,mBAAmB,YAElC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,oDAoH9C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { createContext, useContext, useRef, useState, useReducer, } from 'react';
|
|
4
|
+
import { createContext, useContext, useRef, useState, useReducer, useEffect, } from 'react';
|
|
5
5
|
import useResizeObserver from 'use-resize-observer';
|
|
6
6
|
import { useOnOff } from '../hooks/useOnOff';
|
|
7
7
|
import { useSplitPaneSize } from './useSplitPaneSize';
|
|
@@ -10,14 +10,27 @@ export function useSplitPaneContext() {
|
|
|
10
10
|
return useContext(splitPaneContext);
|
|
11
11
|
}
|
|
12
12
|
export function SplitPane(props) {
|
|
13
|
-
const { direction = 'horizontal', controlledSide = 'start',
|
|
14
|
-
const minimumSize = typeof
|
|
13
|
+
const { direction = 'horizontal', controlledSide = 'start', size = '50%', closed = false, onResize, onToggle, children, } = props;
|
|
14
|
+
const minimumSize = typeof closed === 'number' ? closed : null;
|
|
15
15
|
// Whether the pane is explicitly closed. If the value is `false`, the pane
|
|
16
16
|
// may still be currently closed because it is smaller than the minimum size.
|
|
17
|
-
const [isPaneClosed, closePane, openPane] = useOnOff(typeof
|
|
17
|
+
const [isPaneClosed, closePane, openPane] = useOnOff(typeof closed === 'boolean' ? closed : false);
|
|
18
18
|
// Whether the user has already interacted with the pane.
|
|
19
19
|
const [hasTouched, touch] = useReducer(() => true, false);
|
|
20
|
-
const [[
|
|
20
|
+
const [[splitSize, sizeType], setSize] = useState(() => parseSize(size));
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setSize(parseSize(size));
|
|
23
|
+
}, [size]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (typeof closed === 'boolean') {
|
|
26
|
+
if (closed) {
|
|
27
|
+
closePane();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
openPane();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [closePane, closed, openPane]);
|
|
21
34
|
const splitterRef = useRef(null);
|
|
22
35
|
const { onMouseDown } = useSplitPaneSize({
|
|
23
36
|
controlledSide,
|
|
@@ -60,7 +73,7 @@ export function SplitPane(props) {
|
|
|
60
73
|
}
|
|
61
74
|
}
|
|
62
75
|
function getSplitSideStyle(side) {
|
|
63
|
-
return getItemStyle(isFinalClosed, controlledSide === side, direction,
|
|
76
|
+
return getItemStyle(isFinalClosed, controlledSide === side, direction, splitSize, sizeType);
|
|
64
77
|
}
|
|
65
78
|
return (_jsxs("div", { ref: rootSize.ref, style: {
|
|
66
79
|
display: 'flex',
|
|
@@ -77,9 +90,11 @@ function SplitSide(props) {
|
|
|
77
90
|
const { style, children } = props;
|
|
78
91
|
return _jsx("div", { style: style, children: children });
|
|
79
92
|
}
|
|
80
|
-
function parseSize(
|
|
81
|
-
const
|
|
82
|
-
|
|
93
|
+
function parseSize(size) {
|
|
94
|
+
const value = Number.parseFloat(size);
|
|
95
|
+
// remove numbers and dots from the string
|
|
96
|
+
const type = size.replace(/[\d .]/g, '');
|
|
97
|
+
return [value, type];
|
|
83
98
|
}
|
|
84
99
|
const flexBase = 100;
|
|
85
100
|
function percentToFlex(percent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitPane.js","sourceRoot":"","sources":["../../../src/components/split-pane/SplitPane.tsx"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CA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|
|
1
1
|
{
|
|
2
2
|
"name": "react-science",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "React components to build analysis UI",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./app": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"test-only": "vitest run --coverage "
|
|
51
51
|
},
|
|
52
52
|
"volta": {
|
|
53
|
-
"node": "
|
|
53
|
+
"node": "18.14.2"
|
|
54
54
|
},
|
|
55
55
|
"overrides": {
|
|
56
56
|
"react": "^18.2.0",
|
|
@@ -61,66 +61,66 @@
|
|
|
61
61
|
"react-dom": ">=18.0.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@emotion/react": "^11.10.
|
|
65
|
-
"@emotion/styled": "^11.10.
|
|
66
|
-
"@headlessui/react": "^1.7.
|
|
64
|
+
"@emotion/react": "^11.10.6",
|
|
65
|
+
"@emotion/styled": "^11.10.6",
|
|
66
|
+
"@headlessui/react": "^1.7.13",
|
|
67
67
|
"@lukeed/uuid": "^2.0.0",
|
|
68
68
|
"@popperjs/core": "^2.11.6",
|
|
69
|
-
"@tanstack/react-query": "^4.
|
|
70
|
-
"@tanstack/react-table": "^8.7.
|
|
69
|
+
"@tanstack/react-query": "^4.24.10",
|
|
70
|
+
"@tanstack/react-table": "^8.7.9",
|
|
71
71
|
"biologic-converter": "^0.6.0",
|
|
72
72
|
"cheminfo-types": "^1.4.0",
|
|
73
73
|
"d3-scale-chromatic": "^3.0.0",
|
|
74
|
-
"filelist-utils": "^1.
|
|
75
|
-
"immer": "^9.0.
|
|
76
|
-
"jcampconverter": "^9.0.
|
|
74
|
+
"filelist-utils": "^1.8.0",
|
|
75
|
+
"immer": "^9.0.19",
|
|
76
|
+
"jcampconverter": "^9.0.7",
|
|
77
77
|
"lodash": "^4.17.21",
|
|
78
78
|
"ml-gsd": "^12.1.2",
|
|
79
79
|
"ml-peak-shape-generator": "^4.1.2",
|
|
80
80
|
"ml-signal-processing": "^1.0.2",
|
|
81
|
-
"ml-spectra-processing": "^
|
|
82
|
-
"ms-spectrum": "^2.
|
|
81
|
+
"ml-spectra-processing": "^12.0.0",
|
|
82
|
+
"ms-spectrum": "^2.2.0",
|
|
83
83
|
"netcdfjs": "^2.0.2",
|
|
84
84
|
"react-d3-utils": "^1.0.0",
|
|
85
85
|
"react-dropzone": "^14.2.3",
|
|
86
86
|
"react-error-boundary": "^3.1.4",
|
|
87
|
-
"react-icons": "^4.
|
|
87
|
+
"react-icons": "^4.8.0",
|
|
88
88
|
"react-inspector": "^6.0.1",
|
|
89
|
-
"react-kbs": "^2.1.
|
|
89
|
+
"react-kbs": "^2.1.1",
|
|
90
90
|
"react-plot": "^1.4.2",
|
|
91
91
|
"react-popper": "^2.3.0",
|
|
92
|
-
"react-shadow": "^
|
|
92
|
+
"react-shadow": "^20.0.0",
|
|
93
93
|
"spc-parser": "^0.7.1",
|
|
94
|
-
"tinycolor2": "^1.
|
|
94
|
+
"tinycolor2": "^1.6.0",
|
|
95
95
|
"use-resize-observer": "^9.1.0",
|
|
96
96
|
"wdf-parser": "^0.3.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@babel/core": "^7.
|
|
99
|
+
"@babel/core": "^7.21.0",
|
|
100
100
|
"@babel/eslint-parser": "^7.19.1",
|
|
101
|
-
"@ladle/react": "^2.
|
|
102
|
-
"@playwright/experimental-ct-react": "^1.
|
|
103
|
-
"@playwright/test": "^1.
|
|
104
|
-
"@types/babel__core": "^7.
|
|
101
|
+
"@ladle/react": "^2.9.0",
|
|
102
|
+
"@playwright/experimental-ct-react": "^1.31.2",
|
|
103
|
+
"@playwright/test": "^1.31.2",
|
|
104
|
+
"@types/babel__core": "^7.20.0",
|
|
105
105
|
"@types/d3-scale-chromatic": "^3.0.0",
|
|
106
106
|
"@types/lodash": "^4.14.191",
|
|
107
|
-
"@types/react": "^18.0.
|
|
108
|
-
"@types/react-dom": "^18.0.
|
|
107
|
+
"@types/react": "^18.0.28",
|
|
108
|
+
"@types/react-dom": "^18.0.11",
|
|
109
109
|
"@types/react-inspector": "^4.0.2",
|
|
110
|
-
"@vitejs/plugin-react": "^
|
|
111
|
-
"@vitest/coverage-c8": "^0.
|
|
110
|
+
"@vitejs/plugin-react": "^3.1.0",
|
|
111
|
+
"@vitest/coverage-c8": "^0.29.2",
|
|
112
112
|
"cheminfo-font": "^1.9.0",
|
|
113
113
|
"cross-env": "^7.0.3",
|
|
114
|
-
"eslint": "^8.
|
|
114
|
+
"eslint": "^8.35.0",
|
|
115
115
|
"eslint-config-zakodium": "^7.0.0",
|
|
116
|
-
"prettier": "^2.8.
|
|
116
|
+
"prettier": "^2.8.4",
|
|
117
117
|
"react": "^18.2.0",
|
|
118
118
|
"react-dom": "^18.2.0",
|
|
119
119
|
"react-ocl": "^5.0.0",
|
|
120
|
-
"rimraf": "^3.0
|
|
121
|
-
"typescript": "^4.9.
|
|
122
|
-
"vite": "^
|
|
123
|
-
"vitest": "^0.
|
|
120
|
+
"rimraf": "^4.3.0",
|
|
121
|
+
"typescript": "^4.9.5",
|
|
122
|
+
"vite": "^4.1.4",
|
|
123
|
+
"vitest": "^0.29.2"
|
|
124
124
|
},
|
|
125
125
|
"repository": {
|
|
126
126
|
"type": "git",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { FileCollection,
|
|
2
|
+
import { FileCollection, fileCollectionFromWebSource } from 'filelist-utils';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
|
|
5
5
|
import { AppDispatch, useAppDispatch } from '../../app-data/index';
|
|
@@ -20,7 +20,13 @@ export function useLoadFileCollectionFromHash(onLoad: LoadFn) {
|
|
|
20
20
|
if (!filelistUrl) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const request = await fetch(filelistUrl);
|
|
24
|
+
const data = await request.json();
|
|
25
|
+
let baseURL = filelistUrl.replace(/\/[^/]*$/, '/');
|
|
26
|
+
const fileCollection = await fileCollectionFromWebSource({
|
|
27
|
+
entries: data,
|
|
28
|
+
baseURL,
|
|
29
|
+
});
|
|
24
30
|
void onLoad(fileCollection, appDispatch);
|
|
25
31
|
return true;
|
|
26
32
|
},
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
useState,
|
|
11
11
|
RefObject,
|
|
12
12
|
useReducer,
|
|
13
|
+
useEffect,
|
|
13
14
|
} from 'react';
|
|
14
15
|
import useResizeObserver from 'use-resize-observer';
|
|
15
16
|
|
|
@@ -37,10 +38,10 @@ export interface SplitPaneProps {
|
|
|
37
38
|
*/
|
|
38
39
|
controlledSide?: SplitPaneSide;
|
|
39
40
|
/**
|
|
40
|
-
*
|
|
41
|
+
* size of the controlled side. Unit can be either '%' or 'px'.
|
|
41
42
|
* @default '50%'
|
|
42
43
|
*/
|
|
43
|
-
|
|
44
|
+
size?: SplitPaneSize;
|
|
44
45
|
/**
|
|
45
46
|
* Defines whether the pane is initially closed.
|
|
46
47
|
* A value of `true` means the pane is always initially closed.
|
|
@@ -52,7 +53,7 @@ export interface SplitPaneProps {
|
|
|
52
53
|
* no longer open or close automatically.
|
|
53
54
|
* @default false
|
|
54
55
|
*/
|
|
55
|
-
|
|
56
|
+
closed?: boolean | number;
|
|
56
57
|
/**
|
|
57
58
|
* Called whenever the user finishes resizing the pane.
|
|
58
59
|
*/
|
|
@@ -78,25 +79,39 @@ export function SplitPane(props: SplitPaneProps) {
|
|
|
78
79
|
const {
|
|
79
80
|
direction = 'horizontal',
|
|
80
81
|
controlledSide = 'start',
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
size = '50%',
|
|
83
|
+
closed = false,
|
|
83
84
|
onResize,
|
|
84
85
|
onToggle,
|
|
85
86
|
children,
|
|
86
87
|
} = props;
|
|
87
88
|
|
|
88
|
-
const minimumSize = typeof
|
|
89
|
+
const minimumSize = typeof closed === 'number' ? closed : null;
|
|
89
90
|
|
|
90
91
|
// Whether the pane is explicitly closed. If the value is `false`, the pane
|
|
91
92
|
// may still be currently closed because it is smaller than the minimum size.
|
|
92
93
|
const [isPaneClosed, closePane, openPane] = useOnOff(
|
|
93
|
-
typeof
|
|
94
|
+
typeof closed === 'boolean' ? closed : false,
|
|
94
95
|
);
|
|
95
96
|
|
|
96
97
|
// Whether the user has already interacted with the pane.
|
|
97
98
|
const [hasTouched, touch] = useReducer(() => true, false);
|
|
98
99
|
|
|
99
|
-
const [[
|
|
100
|
+
const [[splitSize, sizeType], setSize] = useState(() => parseSize(size));
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
setSize(parseSize(size));
|
|
104
|
+
}, [size]);
|
|
105
|
+
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (typeof closed === 'boolean') {
|
|
108
|
+
if (closed) {
|
|
109
|
+
closePane();
|
|
110
|
+
} else {
|
|
111
|
+
openPane();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, [closePane, closed, openPane]);
|
|
100
115
|
|
|
101
116
|
const splitterRef = useRef<HTMLDivElement>(null);
|
|
102
117
|
const { onMouseDown } = useSplitPaneSize({
|
|
@@ -148,7 +163,7 @@ export function SplitPane(props: SplitPaneProps) {
|
|
|
148
163
|
isFinalClosed,
|
|
149
164
|
controlledSide === side,
|
|
150
165
|
direction,
|
|
151
|
-
|
|
166
|
+
splitSize,
|
|
152
167
|
sizeType,
|
|
153
168
|
);
|
|
154
169
|
}
|
|
@@ -214,12 +229,12 @@ function SplitSide(props: SplitSideProps) {
|
|
|
214
229
|
return <div style={style}>{children}</div>;
|
|
215
230
|
}
|
|
216
231
|
|
|
217
|
-
function parseSize(
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
232
|
+
function parseSize(size: string): [number, SplitPaneType] {
|
|
233
|
+
const value = Number.parseFloat(size);
|
|
234
|
+
// remove numbers and dots from the string
|
|
235
|
+
const type = size.replace(/[\d .]/g, '') as SplitPaneType;
|
|
221
236
|
|
|
222
|
-
return [
|
|
237
|
+
return [value, type];
|
|
223
238
|
}
|
|
224
239
|
|
|
225
240
|
const flexBase = 100;
|