react-cheminfo 0.33.0 → 0.35.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/README.md +28 -28
- package/lib/about/core/about.d.ts +1 -30
- package/lib/about/core/about.d.ts.map +1 -1
- package/lib/about/core/about.js +0 -16
- package/lib/about/core/about.js.map +1 -1
- package/lib/about/core/index.d.ts +0 -1
- package/lib/about/core/index.d.ts.map +1 -1
- package/lib/about/core/index.js +0 -1
- package/lib/about/core/index.js.map +1 -1
- package/lib/about/ui/AboutBuild.d.ts +2 -5
- package/lib/about/ui/AboutBuild.d.ts.map +1 -1
- package/lib/about/ui/AboutBuild.js +7 -19
- package/lib/about/ui/AboutBuild.js.map +1 -1
- package/lib/about/ui/AboutPage.d.ts +2 -2
- package/lib/about/ui/AboutPage.d.ts.map +1 -1
- package/lib/about/ui/AboutPage.js +3 -14
- package/lib/about/ui/AboutPage.js.map +1 -1
- package/lib/about/ui/AboutVersion.d.ts +0 -4
- package/lib/about/ui/AboutVersion.d.ts.map +1 -1
- package/lib/about/ui/AboutVersion.js +3 -31
- package/lib/about/ui/AboutVersion.js.map +1 -1
- package/lib/axis/core/axisMarks.d.ts +54 -0
- package/lib/axis/core/axisMarks.d.ts.map +1 -0
- package/lib/axis/core/axisMarks.js +69 -0
- package/lib/axis/core/axisMarks.js.map +1 -0
- package/lib/axis/core/axisScale.d.ts +31 -0
- package/lib/axis/core/axisScale.d.ts.map +1 -0
- package/lib/axis/core/axisScale.js +31 -0
- package/lib/axis/core/axisScale.js.map +1 -0
- package/lib/axis/core/index.d.ts +16 -0
- package/lib/axis/core/index.d.ts.map +1 -0
- package/lib/axis/core/index.js +13 -0
- package/lib/axis/core/index.js.map +1 -0
- package/lib/axis/core/logAxisBounds.d.ts +78 -0
- package/lib/axis/core/logAxisBounds.d.ts.map +1 -0
- package/lib/axis/core/logAxisBounds.js +129 -0
- package/lib/axis/core/logAxisBounds.js.map +1 -0
- package/lib/axis/ui/AxisScaleControl.d.ts +66 -0
- package/lib/axis/ui/AxisScaleControl.d.ts.map +1 -0
- package/lib/axis/ui/AxisScaleControl.js +26 -0
- package/lib/axis/ui/AxisScaleControl.js.map +1 -0
- package/lib/axis/ui/index.d.ts +6 -0
- package/lib/axis/ui/index.d.ts.map +1 -0
- package/lib/axis/ui/index.js +5 -0
- package/lib/axis/ui/index.js.map +1 -0
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/delimited/core/index.d.ts +2 -0
- package/lib/delimited/core/index.d.ts.map +1 -1
- package/lib/delimited/core/index.js +1 -0
- package/lib/delimited/core/index.js.map +1 -1
- package/lib/delimited/core/tableRows.d.ts +49 -0
- package/lib/delimited/core/tableRows.d.ts.map +1 -0
- package/lib/delimited/core/tableRows.js +63 -0
- package/lib/delimited/core/tableRows.js.map +1 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts +9 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts.map +1 -1
- package/lib/delimited/ui/DelimitedTextPanel.js +3 -2
- package/lib/delimited/ui/DelimitedTextPanel.js.map +1 -1
- package/lib/delimited/ui/TableDataButton.d.ts +96 -0
- package/lib/delimited/ui/TableDataButton.d.ts.map +1 -0
- package/lib/delimited/ui/TableDataButton.js +39 -0
- package/lib/delimited/ui/TableDataButton.js.map +1 -0
- package/lib/delimited/ui/index.d.ts +2 -0
- package/lib/delimited/ui/index.d.ts.map +1 -1
- package/lib/delimited/ui/index.js +1 -0
- package/lib/delimited/ui/index.js.map +1 -1
- package/lib/download/core/index.d.ts +0 -5
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +0 -3
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/ui/FigureDownload.d.ts +4 -55
- package/lib/download/ui/FigureDownload.d.ts.map +1 -1
- package/lib/download/ui/FigureDownload.js +6 -66
- package/lib/download/ui/FigureDownload.js.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.d.ts +16 -2
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +11 -30
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts +30 -0
- package/lib/download/ui/figureDownloadHint.d.ts.map +1 -0
- package/lib/download/ui/figureDownloadHint.js +33 -0
- package/lib/download/ui/figureDownloadHint.js.map +1 -0
- package/lib/download/ui/index.d.ts +3 -10
- package/lib/download/ui/index.d.ts.map +1 -1
- package/lib/download/ui/index.js +1 -5
- package/lib/download/ui/index.js.map +1 -1
- package/lib/download/ui/useFigureActions.d.ts +50 -0
- package/lib/download/ui/useFigureActions.d.ts.map +1 -0
- package/lib/download/ui/useFigureActions.js +58 -0
- package/lib/download/ui/useFigureActions.js.map +1 -0
- package/lib/download/ui/useFigureDownload.d.ts +85 -0
- package/lib/download/ui/useFigureDownload.d.ts.map +1 -0
- package/lib/download/ui/useFigureDownload.js +75 -0
- package/lib/download/ui/useFigureDownload.js.map +1 -0
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +0 -40
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +0 -10
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/ir/core/irCommands.d.ts +2 -2
- package/lib/ir/core/irCommands.js +2 -2
- package/lib/ir/core/irCommands.js.map +1 -1
- package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrAboutDialog.js +1 -1
- package/lib/ir/ui/IrAboutDialog.js.map +1 -1
- package/lib/ir/ui/IrCanvas.d.ts +6 -0
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -1
- package/lib/ir/ui/IrCanvas.js +2 -2
- package/lib/ir/ui/IrCanvas.js.map +1 -1
- package/lib/ir/ui/IrShell.d.ts.map +1 -1
- package/lib/ir/ui/IrShell.js +16 -11
- package/lib/ir/ui/IrShell.js.map +1 -1
- package/lib/ir/ui/IrToolbar.d.ts +11 -1
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
- package/lib/ir/ui/IrToolbar.js +12 -2
- package/lib/ir/ui/IrToolbar.js.map +1 -1
- package/lib/ir/ui/index.d.ts +1 -0
- package/lib/ir/ui/index.d.ts.map +1 -1
- package/lib/ir/ui/index.js.map +1 -1
- package/lib/locales/de.json +8 -4
- package/lib/locales/en.json +8 -4
- package/lib/locales/es.json +8 -4
- package/lib/locales/fr.json +8 -4
- package/lib/locales/it.json +8 -4
- package/lib/overlay/ui/OverlayPanel.d.ts +6 -0
- package/lib/overlay/ui/OverlayPanel.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayPanel.js +2 -2
- package/lib/overlay/ui/OverlayPanel.js.map +1 -1
- package/lib/overlay/ui/overlayPanelStyles.d.ts +2 -1
- package/lib/overlay/ui/overlayPanelStyles.d.ts.map +1 -1
- package/lib/overlay/ui/overlayPanelStyles.js +3 -1
- package/lib/overlay/ui/overlayPanelStyles.js.map +1 -1
- package/lib/periodic/core/index.d.ts +1 -1
- package/lib/periodic/core/index.d.ts.map +1 -1
- package/lib/periodic/core/index.js +1 -1
- package/lib/periodic/core/index.js.map +1 -1
- package/lib/periodic/core/layout.d.ts +18 -0
- package/lib/periodic/core/layout.d.ts.map +1 -1
- package/lib/periodic/core/layout.js +9 -0
- package/lib/periodic/core/layout.js.map +1 -1
- package/lib/periodic/ui/ElementCell.d.ts +0 -6
- package/lib/periodic/ui/ElementCell.d.ts.map +1 -1
- package/lib/periodic/ui/ElementCell.js +35 -19
- package/lib/periodic/ui/ElementCell.js.map +1 -1
- package/lib/periodic/ui/PeriodicTable.d.ts +12 -1
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +34 -15
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/package.json +1 -1
- package/src/about/core/about.ts +1 -51
- package/src/about/core/index.ts +0 -1
- package/src/about/ui/AboutBuild.tsx +8 -37
- package/src/about/ui/AboutPage.tsx +8 -64
- package/src/about/ui/AboutVersion.tsx +5 -45
- package/src/axis/core/axisMarks.ts +114 -0
- package/src/axis/core/axisScale.ts +41 -0
- package/src/axis/core/index.ts +20 -0
- package/src/axis/core/logAxisBounds.ts +198 -0
- package/src/axis/ui/AxisScaleControl.tsx +103 -0
- package/src/axis/ui/index.ts +9 -0
- package/src/core.ts +1 -0
- package/src/delimited/core/index.ts +2 -0
- package/src/delimited/core/tableRows.ts +93 -0
- package/src/delimited/ui/DelimitedTextPanel.tsx +25 -9
- package/src/delimited/ui/TableDataButton.tsx +162 -0
- package/src/delimited/ui/index.ts +2 -0
- package/src/download/core/index.ts +0 -25
- package/src/download/ui/FigureDownload.tsx +11 -148
- package/src/download/ui/FigureDownloadPanel.tsx +46 -45
- package/src/download/ui/figureDownloadHint.ts +52 -0
- package/src/download/ui/index.ts +6 -10
- package/src/download/ui/useFigureActions.ts +113 -0
- package/src/download/ui/useFigureDownload.tsx +191 -0
- package/src/ecosystem/core/sites.ts +0 -40
- package/src/ecosystem/core/types.ts +0 -10
- package/src/ir/core/irCommands.ts +2 -2
- package/src/ir/ui/IrAboutDialog.tsx +0 -13
- package/src/ir/ui/IrCanvas.tsx +8 -2
- package/src/ir/ui/IrShell.tsx +23 -25
- package/src/ir/ui/IrToolbar.tsx +36 -6
- package/src/ir/ui/index.ts +1 -0
- package/src/locales/de.json +8 -4
- package/src/locales/en.json +8 -4
- package/src/locales/es.json +8 -4
- package/src/locales/fr.json +8 -4
- package/src/locales/it.json +8 -4
- package/src/overlay/ui/OverlayPanel.tsx +8 -2
- package/src/overlay/ui/overlayPanelStyles.ts +3 -0
- package/src/periodic/core/index.ts +1 -0
- package/src/periodic/core/layout.ts +19 -0
- package/src/periodic/ui/ElementCell.tsx +35 -26
- package/src/periodic/ui/PeriodicTable.tsx +55 -16
- package/src/ui.ts +1 -0
- package/styles/chrome.css +71 -0
- package/lib/about/core/repository.d.ts +0 -14
- package/lib/about/core/repository.d.ts.map +0 -1
- package/lib/about/core/repository.js +0 -21
- package/lib/about/core/repository.js.map +0 -1
- package/lib/download/core/exportStyles.d.ts +0 -22
- package/lib/download/core/exportStyles.d.ts.map +0 -1
- package/lib/download/core/exportStyles.js +0 -19
- package/lib/download/core/exportStyles.js.map +0 -1
- package/lib/download/core/imageResolution.d.ts +0 -88
- package/lib/download/core/imageResolution.d.ts.map +0 -1
- package/lib/download/core/imageResolution.js +0 -77
- package/lib/download/core/imageResolution.js.map +0 -1
- package/lib/download/core/pictureExport.d.ts +0 -93
- package/lib/download/core/pictureExport.d.ts.map +0 -1
- package/lib/download/core/pictureExport.js +0 -116
- package/lib/download/core/pictureExport.js.map +0 -1
- package/lib/download/ui/ExportDialogFrame.d.ts +0 -46
- package/lib/download/ui/ExportDialogFrame.d.ts.map +0 -1
- package/lib/download/ui/ExportDialogFrame.js +0 -24
- package/lib/download/ui/ExportDialogFrame.js.map +0 -1
- package/lib/download/ui/ExportImageDialog.d.ts +0 -47
- package/lib/download/ui/ExportImageDialog.d.ts.map +0 -1
- package/lib/download/ui/ExportImageDialog.js +0 -25
- package/lib/download/ui/ExportImageDialog.js.map +0 -1
- package/lib/download/ui/ExportNameField.d.ts +0 -29
- package/lib/download/ui/ExportNameField.d.ts.map +0 -1
- package/lib/download/ui/ExportNameField.js +0 -99
- package/lib/download/ui/ExportNameField.js.map +0 -1
- package/lib/download/ui/ExportPictureSection.d.ts +0 -38
- package/lib/download/ui/ExportPictureSection.d.ts.map +0 -1
- package/lib/download/ui/ExportPictureSection.js +0 -48
- package/lib/download/ui/ExportPictureSection.js.map +0 -1
- package/lib/download/ui/useDrawingBox.d.ts +0 -23
- package/lib/download/ui/useDrawingBox.d.ts.map +0 -1
- package/lib/download/ui/useDrawingBox.js +0 -21
- package/lib/download/ui/useDrawingBox.js.map +0 -1
- package/src/about/core/repository.ts +0 -22
- package/src/download/core/exportStyles.ts +0 -20
- package/src/download/core/imageResolution.ts +0 -118
- package/src/download/core/pictureExport.ts +0 -207
- package/src/download/ui/ExportDialogFrame.tsx +0 -86
- package/src/download/ui/ExportImageDialog.tsx +0 -91
- package/src/download/ui/ExportNameField.tsx +0 -148
- package/src/download/ui/ExportPictureSection.tsx +0 -142
- package/src/download/ui/useDrawingBox.ts +0 -37
package/src/ir/ui/IrShell.tsx
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
useCallback,
|
|
4
|
+
useId,
|
|
5
|
+
useImperativeHandle,
|
|
6
|
+
useMemo,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
3
9
|
import { SplitPane, useFullscreen } from 'react-science/ui';
|
|
4
10
|
|
|
5
11
|
import { sanitizeFileName } from '../../download/core/sanitizeFileName.ts';
|
|
6
|
-
import {
|
|
7
|
-
import { useDrawingBox } from '../../download/ui/useDrawingBox.ts';
|
|
12
|
+
import { useFigureDownload } from '../../download/ui/useFigureDownload.tsx';
|
|
8
13
|
import { PanelRail } from '../../panel/ui/PanelRail.tsx';
|
|
9
14
|
import type { IrBand } from '../core/irBand.ts';
|
|
10
15
|
import type { IrCommandHandlers } from '../core/irCommands.ts';
|
|
@@ -58,12 +63,16 @@ export function IrShell(props: IrShellProps) {
|
|
|
58
63
|
|
|
59
64
|
const [isAboutOpen, setIsAboutOpen] = useState(false);
|
|
60
65
|
const [isDocumentationOpen, setIsDocumentationOpen] = useState(false);
|
|
61
|
-
const [isExportImageOpen, setIsExportImageOpen] = useState(false);
|
|
62
66
|
|
|
63
|
-
// The chart is the picture, so the box it is drawn in is what the
|
|
64
|
-
//
|
|
65
|
-
// every toolbar is one
|
|
66
|
-
const
|
|
67
|
+
// The chart is the picture, so the box it is drawn in is what the figure
|
|
68
|
+
// panel is pointed at: the viewer around it is full of SVG — every icon in
|
|
69
|
+
// every toolbar is one.
|
|
70
|
+
const chartId = useId();
|
|
71
|
+
const figure = useFigureDownload({
|
|
72
|
+
targetId: chartId,
|
|
73
|
+
fileName: pictureName(visibleSpectra, selectedSpectrum),
|
|
74
|
+
});
|
|
75
|
+
const { isOpen: isFigureOpen, setOpen: setFigureOpen } = figure;
|
|
67
76
|
// The highlight is held here rather than in the reducer: what the pointer is
|
|
68
77
|
// resting on is not part of the document and changes on every move across the
|
|
69
78
|
// chart, so putting it through the reducer would run every panel's memo sixty
|
|
@@ -106,7 +115,7 @@ export function IrShell(props: IrShellProps) {
|
|
|
106
115
|
togglePicking: () => actions.setSettings({ pickBands: !pickBands }),
|
|
107
116
|
toggleAssignments: () =>
|
|
108
117
|
actions.setSettings({ showAssignments: !showAssignments }),
|
|
109
|
-
exportImage: () =>
|
|
118
|
+
exportImage: () => setFigureOpen(!isFigureOpen),
|
|
110
119
|
clear: () => actions.clear(),
|
|
111
120
|
}),
|
|
112
121
|
[
|
|
@@ -117,6 +126,8 @@ export function IrShell(props: IrShellProps) {
|
|
|
117
126
|
showAssignments,
|
|
118
127
|
scaleValueAxis,
|
|
119
128
|
toggleFullScreen,
|
|
129
|
+
isFigureOpen,
|
|
130
|
+
setFigureOpen,
|
|
120
131
|
],
|
|
121
132
|
);
|
|
122
133
|
|
|
@@ -176,7 +187,7 @@ export function IrShell(props: IrShellProps) {
|
|
|
176
187
|
default: in a narrow viewer the row would take the width it is
|
|
177
188
|
short of out of them, and half an icon is what that looks like. */}
|
|
178
189
|
<div style={railStyle}>
|
|
179
|
-
<IrToolbar />
|
|
190
|
+
<IrToolbar figure={figure} />
|
|
180
191
|
</div>
|
|
181
192
|
|
|
182
193
|
<SplitPane
|
|
@@ -189,7 +200,7 @@ export function IrShell(props: IrShellProps) {
|
|
|
189
200
|
<IrCanvas
|
|
190
201
|
highlight={highlight}
|
|
191
202
|
onHighlight={setHighlight}
|
|
192
|
-
|
|
203
|
+
chartId={chartId}
|
|
193
204
|
/>
|
|
194
205
|
|
|
195
206
|
<IrSidePanel highlight={highlight} onHighlight={setHighlight} />
|
|
@@ -215,19 +226,6 @@ export function IrShell(props: IrShellProps) {
|
|
|
215
226
|
isOpen={isDocumentationOpen}
|
|
216
227
|
onClose={() => setIsDocumentationOpen(false)}
|
|
217
228
|
/>
|
|
218
|
-
|
|
219
|
-
{/* `element`, not `content`: the chart is drawn to the box it was given,
|
|
220
|
-
so the box is the picture — measuring the marks inside it would crop
|
|
221
|
-
the frame to wherever the trace happens to reach and leave the axes
|
|
222
|
-
hanging. */}
|
|
223
|
-
<ExportImageDialog
|
|
224
|
-
isOpen={isExportImageOpen}
|
|
225
|
-
getDrawing={chart.getDrawing}
|
|
226
|
-
frame="element"
|
|
227
|
-
filename={pictureName(visibleSpectra, selectedSpectrum)}
|
|
228
|
-
label="Infrared spectrum"
|
|
229
|
-
onClose={() => setIsExportImageOpen(false)}
|
|
230
|
-
/>
|
|
231
229
|
</IrCommandProvider>
|
|
232
230
|
);
|
|
233
231
|
}
|
|
@@ -245,7 +243,7 @@ const ZOOM_STEP = 1.2;
|
|
|
245
243
|
const DEFAULT_FRAME_WIDTH = 200;
|
|
246
244
|
|
|
247
245
|
/**
|
|
248
|
-
* What a picture of the chart is called
|
|
246
|
+
* What a picture of the chart is called.
|
|
249
247
|
*
|
|
250
248
|
* The spectrum being looked at, since a figure of the chart is a figure of that
|
|
251
249
|
* spectrum, and a chemist who has one run open should not have to work out
|
package/src/ir/ui/IrToolbar.tsx
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { Toolbar } from 'react-science/ui';
|
|
2
2
|
|
|
3
|
+
import type { FigureDownloadState } from '../../download/ui/useFigureDownload.tsx';
|
|
3
4
|
import { boxZoomOnly } from '../core/irMode.ts';
|
|
4
5
|
|
|
5
6
|
import { useIrCommandProps } from './irCommandContext.tsx';
|
|
6
7
|
import { useIrEditorState } from './irStateContext.ts';
|
|
7
8
|
|
|
9
|
+
/** What {@link IrToolbar} needs. */
|
|
10
|
+
export interface IrToolbarProps {
|
|
11
|
+
/**
|
|
12
|
+
* The "Save figure" panel the picture button opens.
|
|
13
|
+
* @default undefined — the button only runs the `exportImage` command
|
|
14
|
+
*/
|
|
15
|
+
figure?: FigureDownloadState;
|
|
16
|
+
}
|
|
17
|
+
|
|
8
18
|
/**
|
|
9
19
|
* The tools, down the left of the chart.
|
|
10
20
|
*
|
|
@@ -19,9 +29,11 @@ import { useIrEditorState } from './irStateContext.ts';
|
|
|
19
29
|
* drag on that axis is a rectangle, so both buttons go dead with the square zoom
|
|
20
30
|
* lit. Showing `read` as available there would offer a gesture the chart does not
|
|
21
31
|
* make, and showing it as *active* would name the wrong one.
|
|
32
|
+
* @param props - Component props.
|
|
22
33
|
* @returns The toolbar.
|
|
23
34
|
*/
|
|
24
|
-
export function IrToolbar() {
|
|
35
|
+
export function IrToolbar(props: IrToolbarProps) {
|
|
36
|
+
const { figure } = props;
|
|
25
37
|
const { state, selectedSpectrum } = useIrEditorState();
|
|
26
38
|
const command = useIrCommandProps();
|
|
27
39
|
const { spectra } = state.data;
|
|
@@ -29,6 +41,8 @@ export function IrToolbar() {
|
|
|
29
41
|
const { mode, pickBands, showAssignments } = state.settings;
|
|
30
42
|
|
|
31
43
|
const isEmpty = spectra.length === 0;
|
|
44
|
+
// The popover opens the panel itself, so the command's own click is left out.
|
|
45
|
+
const exportCommand = command('exportImage');
|
|
32
46
|
const settled = boxZoomOnly(mode);
|
|
33
47
|
|
|
34
48
|
return (
|
|
@@ -92,11 +106,27 @@ export function IrToolbar() {
|
|
|
92
106
|
window it was dragged to, the way up it is being read, the
|
|
93
107
|
assignments written under the bands — so the picture is taken here
|
|
94
108
|
rather than rebuilt from the spectra in a panel. */}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
109
|
+
{figure === undefined ? (
|
|
110
|
+
<Toolbar.Item
|
|
111
|
+
icon="media"
|
|
112
|
+
{...command('exportImage')}
|
|
113
|
+
disabled={isEmpty}
|
|
114
|
+
/>
|
|
115
|
+
) : (
|
|
116
|
+
<Toolbar.PopoverItem
|
|
117
|
+
isOpen={figure.isOpen}
|
|
118
|
+
onInteraction={figure.setOpen}
|
|
119
|
+
content={figure.panel}
|
|
120
|
+
disabled={isEmpty}
|
|
121
|
+
itemProps={{
|
|
122
|
+
icon: 'media',
|
|
123
|
+
tooltip: exportCommand.tooltip,
|
|
124
|
+
'aria-label': exportCommand['aria-label'],
|
|
125
|
+
active: figure.isOpen,
|
|
126
|
+
disabled: isEmpty,
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
)}
|
|
100
130
|
</Toolbar>
|
|
101
131
|
);
|
|
102
132
|
}
|
package/src/ir/ui/index.ts
CHANGED
|
@@ -34,6 +34,7 @@ export { IrSidePanel } from './IrSidePanel.tsx';
|
|
|
34
34
|
export type { IrStateProviderProps } from './IrStateProvider.tsx';
|
|
35
35
|
export { IrStateProvider } from './IrStateProvider.tsx';
|
|
36
36
|
export { IrStatusBar } from './IrStatusBar.tsx';
|
|
37
|
+
export type { IrToolbarProps } from './IrToolbar.tsx';
|
|
37
38
|
export { IrToolbar } from './IrToolbar.tsx';
|
|
38
39
|
export type { IrTracesProps } from './IrTraces.tsx';
|
|
39
40
|
export { IrTraces } from './IrTraces.tsx';
|
package/src/locales/de.json
CHANGED
|
@@ -86,10 +86,6 @@
|
|
|
86
86
|
"about.whatYouCanDo": "Was Sie hier tun können",
|
|
87
87
|
"about.builtOn": "Aufgebaut auf",
|
|
88
88
|
"about.howToCite": "Wie zu zitieren",
|
|
89
|
-
"about.licenceAndSource": "Lizenz und Quelltext",
|
|
90
|
-
"about.licence": "{license}, © cheminfo. Nutzen Sie es in einem Kurs, forken Sie es, oder übernehmen Sie einen Teil davon anderswo. Der Quelltext liegt auf {sources}.",
|
|
91
|
-
"about.foundAProblem": "Ein Problem gefunden?",
|
|
92
|
-
"about.reportIt": "Sagen Sie es uns: ein Bericht, der nennt, was Sie eingegeben haben und was zurückkam, ist die schnellste Korrektur, die es gibt. {tracker}.",
|
|
93
89
|
"about.citeWork": "{what} zitieren",
|
|
94
90
|
"about.built": "Erstellt {builtAt}.",
|
|
95
91
|
"about.builtFromCommit": "Erstellt {builtAt} aus Commit {commit}.",
|
|
@@ -189,6 +185,8 @@
|
|
|
189
185
|
"download.hintRasterSvg": "Ein SVG, das ein Bild von {pixels} enthält: eine 3D-Szene hat keine Vektorform.",
|
|
190
186
|
"download.hintSvg": "Öffnet sich mit {pixels} und bleibt in jeder Größe scharf.",
|
|
191
187
|
"download.hintPng": "Gespeichert {pixels}.",
|
|
188
|
+
"download.hintCopied": "In die Zwischenablage kopiert: PNG mit {pixels}.",
|
|
189
|
+
"download.copyUnsupported": "Dieser Browser kann kein Bild in die Zwischenablage legen. Speichern Sie es stattdessen.",
|
|
192
190
|
"download.size": "Größe",
|
|
193
191
|
"download.sizeHelp": "Die Form, in der die Abbildung für die Datei gezeichnet wird. Sie wird neu gesetzt, sodass Achsen und Beschriftungen in diese Form passen, statt hineingedehnt zu werden. Eine Zeitschriftenspalte ist 8,5 cm breit, und ihr Text wird in der Größe gedruckt, in der er auf dem Bildschirm steht.",
|
|
194
192
|
"download.sizeScreen": "Wie angezeigt",
|
|
@@ -232,6 +230,12 @@
|
|
|
232
230
|
"overlay.reset": "Zurücksetzen",
|
|
233
231
|
"overlay.hoverAName": "Fahren Sie über einen Namen, um zu sehen, was er bewirkt.",
|
|
234
232
|
"overlay.dismiss": "Schließen",
|
|
233
|
+
"axis.scale": "Skala",
|
|
234
|
+
"axis.xScale": "X-Skala",
|
|
235
|
+
"axis.yScale": "Y-Skala",
|
|
236
|
+
"axis.linear": "Linear",
|
|
237
|
+
"axis.logarithmic": "Log",
|
|
238
|
+
"axis.scaleHelp": "Wie die Achse geteilt ist. Linear bekommt jede Einheit gleich viel Platz, so werden die größten Werte miteinander verglichen; logarithmisch bekommt jeder Faktor zehn gleich viel Platz, so sind die kleinen überhaupt sichtbar.",
|
|
235
239
|
"delimited.copyTable": "Tabelle kopieren",
|
|
236
240
|
"delimited.copyOrDownload": "Daten kopieren oder herunterladen",
|
|
237
241
|
"delimited.close": "Schließen",
|
package/src/locales/en.json
CHANGED
|
@@ -86,10 +86,6 @@
|
|
|
86
86
|
"about.whatYouCanDo": "What you can do here",
|
|
87
87
|
"about.builtOn": "Built on",
|
|
88
88
|
"about.howToCite": "How to cite",
|
|
89
|
-
"about.licenceAndSource": "Licence and source",
|
|
90
|
-
"about.licence": "{license}, © cheminfo. Use it in a course, fork it, or lift a piece of it into something else. The sources are at {sources}.",
|
|
91
|
-
"about.foundAProblem": "Found a problem?",
|
|
92
|
-
"about.reportIt": "Tell us: a report naming what you typed and what came back is the fastest fix there is. {tracker}.",
|
|
93
89
|
"about.citeWork": "Cite {what}",
|
|
94
90
|
"about.built": "Built {builtAt}.",
|
|
95
91
|
"about.builtFromCommit": "Built {builtAt} from commit {commit}.",
|
|
@@ -189,6 +185,8 @@
|
|
|
189
185
|
"download.hintRasterSvg": "An SVG holding a picture of {pixels}: a 3D scene has no vector form.",
|
|
190
186
|
"download.hintSvg": "Opens at {pixels}, and stays sharp at any size.",
|
|
191
187
|
"download.hintPng": "Saved {pixels}.",
|
|
188
|
+
"download.hintCopied": "Copied {pixels} to the clipboard, as a PNG.",
|
|
189
|
+
"download.copyUnsupported": "This browser cannot put a picture on the clipboard. Save it instead.",
|
|
192
190
|
"download.size": "Size",
|
|
193
191
|
"download.sizeHelp": "The shape the figure is drawn at for the file. It is laid out again, so the axes and labels fit that shape instead of being stretched into it. A journal column is 8.5 cm wide, and its text prints at the size it reads on screen.",
|
|
194
192
|
"download.sizeScreen": "As shown",
|
|
@@ -232,6 +230,12 @@
|
|
|
232
230
|
"overlay.reset": "Reset",
|
|
233
231
|
"overlay.hoverAName": "Hover a name for what it does.",
|
|
234
232
|
"overlay.dismiss": "Dismiss",
|
|
233
|
+
"axis.scale": "Scale",
|
|
234
|
+
"axis.xScale": "X scale",
|
|
235
|
+
"axis.yScale": "Y scale",
|
|
236
|
+
"axis.linear": "Linear",
|
|
237
|
+
"axis.logarithmic": "Log",
|
|
238
|
+
"axis.scaleHelp": "How the axis is spaced. Linear gives every unit the same room, so the largest values are read against each other; logarithmic gives every factor of ten the same room, so the small ones are visible at all.",
|
|
235
239
|
"delimited.copyTable": "Copy the table",
|
|
236
240
|
"delimited.copyOrDownload": "Copy or download data",
|
|
237
241
|
"delimited.close": "Close",
|
package/src/locales/es.json
CHANGED
|
@@ -86,10 +86,6 @@
|
|
|
86
86
|
"about.whatYouCanDo": "Lo que puede hacer aquí",
|
|
87
87
|
"about.builtOn": "Construido sobre",
|
|
88
88
|
"about.howToCite": "Cómo citar",
|
|
89
|
-
"about.licenceAndSource": "Licencia y código fuente",
|
|
90
|
-
"about.licence": "{license}, © cheminfo. Úselo en un curso, bifúrquelo, o llévese un trozo a otra parte. El código está en {sources}.",
|
|
91
|
-
"about.foundAProblem": "¿Ha encontrado un problema?",
|
|
92
|
-
"about.reportIt": "Díganoslo: un informe que indique lo que escribió y lo que obtuvo es la corrección más rápida que existe. {tracker}.",
|
|
93
89
|
"about.citeWork": "Citar {what}",
|
|
94
90
|
"about.built": "Compilado {builtAt}.",
|
|
95
91
|
"about.builtFromCommit": "Compilado {builtAt} desde el commit {commit}.",
|
|
@@ -189,6 +185,8 @@
|
|
|
189
185
|
"download.hintRasterSvg": "Un SVG que contiene una imagen de {pixels}: una escena 3D no tiene forma vectorial.",
|
|
190
186
|
"download.hintSvg": "Se abre a {pixels}, y se mantiene nítido a cualquier tamaño.",
|
|
191
187
|
"download.hintPng": "Guardado {pixels}.",
|
|
188
|
+
"download.hintCopied": "Copiado al portapapeles: PNG de {pixels}.",
|
|
189
|
+
"download.copyUnsupported": "Este navegador no puede poner una imagen en el portapapeles. Guárdala en su lugar.",
|
|
192
190
|
"download.size": "Tamaño",
|
|
193
191
|
"download.sizeHelp": "La forma con la que se dibuja la figura para el archivo. Se vuelve a maquetar, de modo que los ejes y las etiquetas se ajustan a esa forma en lugar de estirarse. Una columna de revista mide 8,5 cm, y su texto se imprime al tamaño con que se lee en pantalla.",
|
|
194
192
|
"download.sizeScreen": "Como se muestra",
|
|
@@ -232,6 +230,12 @@
|
|
|
232
230
|
"overlay.reset": "Reiniciar",
|
|
233
231
|
"overlay.hoverAName": "Pase el puntero sobre un nombre para ver qué hace.",
|
|
234
232
|
"overlay.dismiss": "Cerrar",
|
|
233
|
+
"axis.scale": "Escala",
|
|
234
|
+
"axis.xScale": "Escala X",
|
|
235
|
+
"axis.yScale": "Escala Y",
|
|
236
|
+
"axis.linear": "Lineal",
|
|
237
|
+
"axis.logarithmic": "Log",
|
|
238
|
+
"axis.scaleHelp": "Cómo se gradúa el eje. En lineal cada unidad ocupa el mismo espacio, de modo que se comparan los valores mayores entre sí; en logarítmica cada factor diez ocupa el mismo espacio, de modo que los pequeños llegan a verse.",
|
|
235
239
|
"delimited.copyTable": "Copiar la tabla",
|
|
236
240
|
"delimited.copyOrDownload": "Copiar o descargar los datos",
|
|
237
241
|
"delimited.close": "Cerrar",
|
package/src/locales/fr.json
CHANGED
|
@@ -86,10 +86,6 @@
|
|
|
86
86
|
"about.whatYouCanDo": "Ce que vous pouvez faire ici",
|
|
87
87
|
"about.builtOn": "Construit sur",
|
|
88
88
|
"about.howToCite": "Comment citer",
|
|
89
|
-
"about.licenceAndSource": "Licence et sources",
|
|
90
|
-
"about.licence": "{license}, © cheminfo. Utilisez-le dans un cours, forkez-le, ou reprenez-en un morceau ailleurs. Les sources sont sur {sources}.",
|
|
91
|
-
"about.foundAProblem": "Un problème ?",
|
|
92
|
-
"about.reportIt": "Dites-le-nous : un rapport indiquant ce que vous avez saisi et ce qui est revenu est la correction la plus rapide qui soit. {tracker}.",
|
|
93
89
|
"about.citeWork": "Citer {what}",
|
|
94
90
|
"about.built": "Compilé {builtAt}.",
|
|
95
91
|
"about.builtFromCommit": "Compilé {builtAt} depuis le commit {commit}.",
|
|
@@ -189,6 +185,8 @@
|
|
|
189
185
|
"download.hintRasterSvg": "Un SVG contenant une image de {pixels} : une scène 3D n'a pas de forme vectorielle.",
|
|
190
186
|
"download.hintSvg": "S'ouvre à {pixels}, et reste net à toute taille.",
|
|
191
187
|
"download.hintPng": "Enregistré {pixels}.",
|
|
188
|
+
"download.hintCopied": "Copié dans le presse-papiers : PNG de {pixels}.",
|
|
189
|
+
"download.copyUnsupported": "Ce navigateur ne peut pas copier une image dans le presse-papiers. Enregistrez-la plutôt.",
|
|
192
190
|
"download.size": "Taille",
|
|
193
191
|
"download.sizeHelp": "La forme à laquelle la figure est dessinée pour le fichier. Elle est remise en page, si bien que les axes et les étiquettes s'ajustent à cette forme au lieu d'y être étirés. Une colonne de revue mesure 8,5 cm, et son texte s'imprime à la taille où il se lit à l'écran.",
|
|
194
192
|
"download.sizeScreen": "Comme affichée",
|
|
@@ -232,6 +230,12 @@
|
|
|
232
230
|
"overlay.reset": "Réinitialiser",
|
|
233
231
|
"overlay.hoverAName": "Survolez un nom pour savoir ce qu'il fait.",
|
|
234
232
|
"overlay.dismiss": "Fermer",
|
|
233
|
+
"axis.scale": "Échelle",
|
|
234
|
+
"axis.xScale": "Échelle X",
|
|
235
|
+
"axis.yScale": "Échelle Y",
|
|
236
|
+
"axis.linear": "Linéaire",
|
|
237
|
+
"axis.logarithmic": "Log",
|
|
238
|
+
"axis.scaleHelp": "Comment l'axe est gradué. En linéaire, chaque unité occupe la même place, ce qui compare les grandes valeurs entre elles ; en logarithmique, chaque facteur dix occupe la même place, ce qui rend les petites visibles.",
|
|
235
239
|
"delimited.copyTable": "Copier le tableau",
|
|
236
240
|
"delimited.copyOrDownload": "Copier ou télécharger les données",
|
|
237
241
|
"delimited.close": "Fermer",
|
package/src/locales/it.json
CHANGED
|
@@ -86,10 +86,6 @@
|
|
|
86
86
|
"about.whatYouCanDo": "Cosa si può fare qui",
|
|
87
87
|
"about.builtOn": "Costruito su",
|
|
88
88
|
"about.howToCite": "Come citare",
|
|
89
|
-
"about.licenceAndSource": "Licenza e codice sorgente",
|
|
90
|
-
"about.licence": "{license}, © cheminfo. Si può usare in un corso, farne un fork, o riprenderne un pezzo per altro. Il codice è su {sources}.",
|
|
91
|
-
"about.foundAProblem": "Ha trovato un problema?",
|
|
92
|
-
"about.reportIt": "Ce lo dica: una segnalazione che indichi cosa ha scritto e cosa ha ottenuto è la correzione più rapida che esista. {tracker}.",
|
|
93
89
|
"about.citeWork": "Citare {what}",
|
|
94
90
|
"about.built": "Compilato {builtAt}.",
|
|
95
91
|
"about.builtFromCommit": "Compilato {builtAt} dal commit {commit}.",
|
|
@@ -189,6 +185,8 @@
|
|
|
189
185
|
"download.hintRasterSvg": "Un SVG che contiene un'immagine di {pixels}: una scena 3D non ha forma vettoriale.",
|
|
190
186
|
"download.hintSvg": "Si apre a {pixels}, e resta nitido a qualsiasi dimensione.",
|
|
191
187
|
"download.hintPng": "Salvato {pixels}.",
|
|
188
|
+
"download.hintCopied": "Copiato negli appunti: PNG di {pixels}.",
|
|
189
|
+
"download.copyUnsupported": "Questo browser non può mettere un'immagine negli appunti. Salvala invece.",
|
|
192
190
|
"download.size": "Dimensione",
|
|
193
191
|
"download.sizeHelp": "La forma con cui la figura viene disegnata per il file. Viene ricomposta, così gli assi e le etichette si adattano a quella forma invece di essere stirati. Una colonna di rivista è larga 8,5 cm, e il suo testo si stampa alla dimensione con cui si legge sullo schermo.",
|
|
194
192
|
"download.sizeScreen": "Come mostrata",
|
|
@@ -232,6 +230,12 @@
|
|
|
232
230
|
"overlay.reset": "Ricomincia",
|
|
233
231
|
"overlay.hoverAName": "Passare il puntatore su un nome per vedere cosa fa.",
|
|
234
232
|
"overlay.dismiss": "Chiudi",
|
|
233
|
+
"axis.scale": "Scala",
|
|
234
|
+
"axis.xScale": "Scala X",
|
|
235
|
+
"axis.yScale": "Scala Y",
|
|
236
|
+
"axis.linear": "Lineare",
|
|
237
|
+
"axis.logarithmic": "Log",
|
|
238
|
+
"axis.scaleHelp": "Come è graduato l'asse. In lineare ogni unità occupa lo stesso spazio, così si confrontano fra loro i valori più grandi; in logaritmica ogni fattore dieci occupa lo stesso spazio, così i piccoli si vedono.",
|
|
235
239
|
"delimited.copyTable": "Copia la tabella",
|
|
236
240
|
"delimited.copyOrDownload": "Copiare o scaricare i dati",
|
|
237
241
|
"delimited.close": "Chiudi",
|
|
@@ -78,6 +78,12 @@ export interface OverlayPanelProps {
|
|
|
78
78
|
* @default derived from the type size — 88 at the compact size
|
|
79
79
|
*/
|
|
80
80
|
nameWidth?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Fixed width of the panel, for one whose hint changes with its choices:
|
|
83
|
+
* left to its content, it would resize under the pointer at every pick.
|
|
84
|
+
* @default undefined — as wide as its content
|
|
85
|
+
*/
|
|
86
|
+
width?: number | string;
|
|
81
87
|
/**
|
|
82
88
|
* Value of the `data-testid` attribute of the panel.
|
|
83
89
|
* @default undefined
|
|
@@ -104,7 +110,7 @@ export interface OverlayPanelProps {
|
|
|
104
110
|
export function OverlayPanel(props: OverlayPanelProps): ReactElement {
|
|
105
111
|
const { title, children, onReset, resetLabel, help } = props;
|
|
106
112
|
const t = useChromeT();
|
|
107
|
-
const { actions, hint, nameWidth, testId } = props;
|
|
113
|
+
const { actions, hint, nameWidth, width: panelWidth, testId } = props;
|
|
108
114
|
const { metrics } = useOverlaySurface();
|
|
109
115
|
const titleId = useId();
|
|
110
116
|
const reset = useOverlayInteraction();
|
|
@@ -120,7 +126,7 @@ export function OverlayPanel(props: OverlayPanelProps): ReactElement {
|
|
|
120
126
|
role="group"
|
|
121
127
|
aria-labelledby={titleId}
|
|
122
128
|
data-testid={testId}
|
|
123
|
-
style={overlayPanelSurfaceStyle(metrics)}
|
|
129
|
+
style={overlayPanelSurfaceStyle(metrics, panelWidth)}
|
|
124
130
|
>
|
|
125
131
|
<div style={overlayPanelHeaderStyle(metrics)}>
|
|
126
132
|
<span style={overlayPanelTitleStyle(metrics)}>
|
|
@@ -26,14 +26,17 @@ import { overlayFocusRing } from './overlayValueStyles.ts';
|
|
|
26
26
|
* The panel itself: a header, a body, and whatever the figure can be told to
|
|
27
27
|
* do at the foot.
|
|
28
28
|
* @param metrics - The measurements the card is drawn from.
|
|
29
|
+
* @param width - A fixed width, or `undefined` for as wide as its content.
|
|
29
30
|
* @returns The panel's rules.
|
|
30
31
|
*/
|
|
31
32
|
export function overlayPanelSurfaceStyle(
|
|
32
33
|
metrics: OverlayMetrics,
|
|
34
|
+
width?: number | string,
|
|
33
35
|
): CSSProperties {
|
|
34
36
|
return {
|
|
35
37
|
display: 'flex',
|
|
36
38
|
flexDirection: 'column',
|
|
39
|
+
width,
|
|
37
40
|
minWidth: OVERLAY_PANEL_MIN_WIDTH,
|
|
38
41
|
color: 'var(--text)',
|
|
39
42
|
fontSize: metrics.fontSize,
|
|
@@ -84,6 +84,25 @@ let placedCache: ReadonlyArray<{
|
|
|
84
84
|
cell: Cell;
|
|
85
85
|
}> | null = null;
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* The block of cells the table leaves empty, where no element belongs: logical
|
|
89
|
+
* columns 3 to 12 of the first three periods.
|
|
90
|
+
*
|
|
91
|
+
* It is a tenth of the drawing, in the middle of the top edge, and the one
|
|
92
|
+
* place a tool can write without covering an element — which is why a table
|
|
93
|
+
* printed on a wall puts its title or its key there.
|
|
94
|
+
*/
|
|
95
|
+
export const EMPTY_BLOCK: {
|
|
96
|
+
/** Leftmost column of the block, one-based. */
|
|
97
|
+
column: number;
|
|
98
|
+
/** Topmost row of the block, one-based. */
|
|
99
|
+
row: number;
|
|
100
|
+
/** How many columns it spans. */
|
|
101
|
+
columnSpan: number;
|
|
102
|
+
/** How many rows it spans. */
|
|
103
|
+
rowSpan: number;
|
|
104
|
+
} = { column: 3, row: 1, columnSpan: 10, rowSpan: 3 };
|
|
105
|
+
|
|
87
106
|
/**
|
|
88
107
|
* The two cells the lanthanoids and the actinoids were lifted out of.
|
|
89
108
|
*
|
|
@@ -37,12 +37,6 @@ export interface ElementCellProps {
|
|
|
37
37
|
* @default '' — nothing is written
|
|
38
38
|
*/
|
|
39
39
|
detail?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Whether the table this cell belongs to writes a third line at all. A table
|
|
42
|
-
* that writes none gives the room to the symbol, and its rows are shorter.
|
|
43
|
-
* @default whether this cell has one
|
|
44
|
-
*/
|
|
45
|
-
writesDetail?: boolean;
|
|
46
40
|
/**
|
|
47
41
|
* Whether the cell is the one the tools are pointed at.
|
|
48
42
|
* @default false
|
|
@@ -82,7 +76,6 @@ export function ElementCell(props: ElementCellProps): ReactElement {
|
|
|
82
76
|
row,
|
|
83
77
|
onSelect,
|
|
84
78
|
detail = '',
|
|
85
|
-
writesDetail = detail !== '',
|
|
86
79
|
isSelected = false,
|
|
87
80
|
isIncluded = true,
|
|
88
81
|
onHover,
|
|
@@ -137,7 +130,7 @@ export function ElementCell(props: ElementCellProps): ReactElement {
|
|
|
137
130
|
<span
|
|
138
131
|
style={{
|
|
139
132
|
...symbolStyle,
|
|
140
|
-
fontSize: symbolFontSize(symbol
|
|
133
|
+
fontSize: symbolFontSize(symbol),
|
|
141
134
|
}}
|
|
142
135
|
>
|
|
143
136
|
{symbol}
|
|
@@ -158,12 +151,10 @@ export function ElementCell(props: ElementCellProps): ReactElement {
|
|
|
158
151
|
* ones whose second letter is an `m` — which are written a tenth smaller
|
|
159
152
|
* rather than run into the edges of their cell.
|
|
160
153
|
* @param symbol - The chemical symbol.
|
|
161
|
-
* @param writesDetail - Whether the table writes a third line under it.
|
|
162
154
|
* @returns A CSS length.
|
|
163
155
|
*/
|
|
164
|
-
function symbolFontSize(symbol: string
|
|
165
|
-
|
|
166
|
-
return fitted(symbolWidthInEm(symbol), cap, '0.5rem');
|
|
156
|
+
function symbolFontSize(symbol: string): string {
|
|
157
|
+
return fitted(symbolWidthInEm(symbol), SYMBOL_CQW, '0.5rem');
|
|
167
158
|
}
|
|
168
159
|
|
|
169
160
|
/**
|
|
@@ -233,17 +224,24 @@ const TABULAR_EM = 0.6;
|
|
|
233
224
|
/** The size the symbol is written at wherever it fits, as a share of the table. */
|
|
234
225
|
const SYMBOL_CQW = '2.4cqw';
|
|
235
226
|
|
|
236
|
-
/** The same, in a table that writes nothing under the symbol. */
|
|
237
|
-
const SYMBOL_ALONE_CQW = '2.8cqw';
|
|
238
|
-
|
|
239
227
|
/**
|
|
240
228
|
* The tallest the third line is ever written, as a share of the table.
|
|
241
229
|
*
|
|
242
|
-
* Close to
|
|
243
|
-
*
|
|
244
|
-
*
|
|
230
|
+
* Close to two thirds of the symbol: the symbol is how a cell is found, but
|
|
231
|
+
* the value is what the table is being read for, and a value half the size of
|
|
232
|
+
* the symbol is the one thing on the cell a class cannot make out.
|
|
233
|
+
*/
|
|
234
|
+
const DETAIL_CQW = '1.6cqw';
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The band at each end of a cell: the atomic number at the top, whatever the
|
|
238
|
+
* tool writes at the bottom.
|
|
239
|
+
*
|
|
240
|
+
* They are one length, not two, and that is what makes the symbol between them
|
|
241
|
+
* sit at the centre of the cell rather than near it — a bottom band wider than
|
|
242
|
+
* the top one by a third lifted every symbol in the table two pixels.
|
|
245
243
|
*/
|
|
246
|
-
const
|
|
244
|
+
const EDGE_BAND = '1.8cqw';
|
|
247
245
|
|
|
248
246
|
/** How wide one column is, as a share of the table's width. */
|
|
249
247
|
const CELL_CQW = '4.85cqw';
|
|
@@ -251,15 +249,24 @@ const CELL_CQW = '4.85cqw';
|
|
|
251
249
|
/** What the border and the padding of a cell take off that width. */
|
|
252
250
|
const CELL_CHROME = '4px';
|
|
253
251
|
|
|
252
|
+
/**
|
|
253
|
+
* A cell is three bands of its own, and every cell has all three.
|
|
254
|
+
*
|
|
255
|
+
* The atomic number is in the top band, against its left edge; the symbol is
|
|
256
|
+
* centred in the middle one; whatever the tool writes is centred in the
|
|
257
|
+
* bottom one. The bands keep their height whether or not anything is written
|
|
258
|
+
* in the last of them, so a number sits at one height across the whole table
|
|
259
|
+
* and a symbol at one other — before this, both rode on a stack the cell
|
|
260
|
+
* centred and moved whenever a neighbour's value was written smaller.
|
|
261
|
+
*/
|
|
254
262
|
const cellStyle = {
|
|
255
|
-
alignItems: 'center',
|
|
256
263
|
border: '1px solid rgb(255 255 255 / 0.55)',
|
|
257
264
|
borderRadius: 3,
|
|
258
265
|
cursor: 'pointer',
|
|
259
|
-
display: '
|
|
260
|
-
flexDirection: 'column',
|
|
266
|
+
display: 'grid',
|
|
261
267
|
font: 'inherit',
|
|
262
|
-
|
|
268
|
+
gridTemplateRows: `${EDGE_BAND} 1fr ${EDGE_BAND}`,
|
|
269
|
+
justifyItems: 'center',
|
|
263
270
|
minWidth: 0,
|
|
264
271
|
overflow: 'hidden',
|
|
265
272
|
padding: '1px',
|
|
@@ -267,21 +274,23 @@ const cellStyle = {
|
|
|
267
274
|
} as const satisfies CSSProperties;
|
|
268
275
|
|
|
269
276
|
const numberStyle = {
|
|
270
|
-
alignSelf: '
|
|
271
|
-
fontSize: 'max(0.33rem, 1.
|
|
277
|
+
alignSelf: 'start',
|
|
278
|
+
fontSize: 'max(0.33rem, 1.1cqw)',
|
|
272
279
|
fontVariantNumeric: 'tabular-nums',
|
|
280
|
+
justifySelf: 'start',
|
|
273
281
|
lineHeight: 1,
|
|
274
282
|
opacity: 0.8,
|
|
275
|
-
paddingLeft: '0.15cqw',
|
|
276
283
|
} as const satisfies CSSProperties;
|
|
277
284
|
|
|
278
285
|
const symbolStyle = {
|
|
286
|
+
alignSelf: 'center',
|
|
279
287
|
fontWeight: 700,
|
|
280
288
|
letterSpacing: '-0.02em',
|
|
281
289
|
lineHeight: 1.02,
|
|
282
290
|
} as const satisfies CSSProperties;
|
|
283
291
|
|
|
284
292
|
const detailStyle = {
|
|
293
|
+
alignSelf: 'center',
|
|
285
294
|
fontVariantNumeric: 'tabular-nums',
|
|
286
295
|
lineHeight: 1,
|
|
287
296
|
maxWidth: '100%',
|