react-cheminfo 0.65.0 → 0.66.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 +11 -6
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/ir/core/analysisSpectra.d.ts +23 -6
- package/lib/ir/core/analysisSpectra.d.ts.map +1 -1
- package/lib/ir/core/analysisSpectra.js.map +1 -1
- package/lib/ir/core/bandLabelPlan.d.ts.map +1 -1
- package/lib/ir/core/bandLabelPlan.js +11 -6
- package/lib/ir/core/bandLabelPlan.js.map +1 -1
- package/lib/ir/core/index.d.ts +13 -9
- package/lib/ir/core/index.d.ts.map +1 -1
- package/lib/ir/core/index.js +9 -6
- package/lib/ir/core/index.js.map +1 -1
- package/lib/ir/core/irBand.d.ts +45 -14
- package/lib/ir/core/irBand.d.ts.map +1 -1
- package/lib/ir/core/irBand.js +28 -6
- package/lib/ir/core/irBand.js.map +1 -1
- package/lib/ir/core/irCommands.d.ts +11 -0
- package/lib/ir/core/irCommands.d.ts.map +1 -1
- package/lib/ir/core/irCommands.js +11 -1
- package/lib/ir/core/irCommands.js.map +1 -1
- package/lib/ir/core/irDomain.d.ts +4 -3
- package/lib/ir/core/irDomain.d.ts.map +1 -1
- package/lib/ir/core/irDomain.js +10 -7
- package/lib/ir/core/irDomain.js.map +1 -1
- package/lib/ir/core/irFormat.d.ts +14 -2
- package/lib/ir/core/irFormat.d.ts.map +1 -1
- package/lib/ir/core/irFormat.js +33 -4
- package/lib/ir/core/irFormat.js.map +1 -1
- package/lib/ir/core/irMode.d.ts +35 -8
- package/lib/ir/core/irMode.d.ts.map +1 -1
- package/lib/ir/core/irMode.js +38 -10
- package/lib/ir/core/irMode.js.map +1 -1
- package/lib/ir/core/irReducer.d.ts +0 -28
- package/lib/ir/core/irReducer.d.ts.map +1 -1
- package/lib/ir/core/irReducer.js +1 -24
- package/lib/ir/core/irReducer.js.map +1 -1
- package/lib/ir/core/irSpectrum.d.ts +52 -26
- package/lib/ir/core/irSpectrum.d.ts.map +1 -1
- package/lib/ir/core/irSpectrum.js +21 -15
- package/lib/ir/core/irSpectrum.js.map +1 -1
- package/lib/ir/core/irState.d.ts +40 -2
- package/lib/ir/core/irState.d.ts.map +1 -1
- package/lib/ir/core/irState.js +38 -1
- package/lib/ir/core/irState.js.map +1 -1
- package/lib/ir/core/irTechnique.d.ts +94 -0
- package/lib/ir/core/irTechnique.d.ts.map +1 -0
- package/lib/ir/core/irTechnique.js +87 -0
- package/lib/ir/core/irTechnique.js.map +1 -0
- package/lib/ir/core/irTechniqueCommands.d.ts +26 -0
- package/lib/ir/core/irTechniqueCommands.d.ts.map +1 -0
- package/lib/ir/core/irTechniqueCommands.js +68 -0
- package/lib/ir/core/irTechniqueCommands.js.map +1 -0
- package/lib/ir/core/pickBands.d.ts +6 -5
- package/lib/ir/core/pickBands.d.ts.map +1 -1
- package/lib/ir/core/pickBands.js +49 -26
- package/lib/ir/core/pickBands.js.map +1 -1
- package/lib/ir/core/ramanBands.d.ts +30 -0
- package/lib/ir/core/ramanBands.d.ts.map +1 -0
- package/lib/ir/core/ramanBands.js +83 -0
- package/lib/ir/core/ramanBands.js.map +1 -0
- package/lib/ir/core/spectrumJcamp.d.ts +10 -5
- package/lib/ir/core/spectrumJcamp.d.ts.map +1 -1
- package/lib/ir/core/spectrumJcamp.js +63 -15
- package/lib/ir/core/spectrumJcamp.js.map +1 -1
- package/lib/ir/core/toIrSpectrum.d.ts.map +1 -1
- package/lib/ir/core/toIrSpectrum.js +17 -2
- package/lib/ir/core/toIrSpectrum.js.map +1 -1
- package/lib/ir/ui/BandRow.d.ts +30 -0
- package/lib/ir/ui/BandRow.d.ts.map +1 -0
- package/lib/ir/ui/BandRow.js +42 -0
- package/lib/ir/ui/BandRow.js.map +1 -0
- package/lib/ir/ui/BandsPanel.d.ts +4 -0
- package/lib/ir/ui/BandsPanel.d.ts.map +1 -1
- package/lib/ir/ui/BandsPanel.js +14 -59
- package/lib/ir/ui/BandsPanel.js.map +1 -1
- package/lib/ir/ui/IrAboutDialog.d.ts +7 -0
- package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrAboutDialog.js +16 -3
- package/lib/ir/ui/IrAboutDialog.js.map +1 -1
- 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/IrChart.d.ts +2 -1
- package/lib/ir/ui/IrChart.d.ts.map +1 -1
- package/lib/ir/ui/IrChart.js +18 -21
- package/lib/ir/ui/IrChart.js.map +1 -1
- package/lib/ir/ui/IrCommandProvider.d.ts +7 -0
- package/lib/ir/ui/IrCommandProvider.d.ts.map +1 -1
- package/lib/ir/ui/IrCommandProvider.js +2 -2
- package/lib/ir/ui/IrCommandProvider.js.map +1 -1
- package/lib/ir/ui/IrCommandTooltip.d.ts +7 -0
- package/lib/ir/ui/IrCommandTooltip.d.ts.map +1 -1
- package/lib/ir/ui/IrCommandTooltip.js +3 -2
- package/lib/ir/ui/IrCommandTooltip.js.map +1 -1
- package/lib/ir/ui/IrDocumentationDialog.d.ts +8 -1
- package/lib/ir/ui/IrDocumentationDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrDocumentationDialog.js +30 -7
- package/lib/ir/ui/IrDocumentationDialog.js.map +1 -1
- package/lib/ir/ui/IrEditor.d.ts +3 -1
- package/lib/ir/ui/IrEditor.d.ts.map +1 -1
- package/lib/ir/ui/IrEditor.js +3 -20
- package/lib/ir/ui/IrEditor.js.map +1 -1
- package/lib/ir/ui/IrHeader.d.ts.map +1 -1
- package/lib/ir/ui/IrHeader.js +5 -1
- package/lib/ir/ui/IrHeader.js.map +1 -1
- package/lib/ir/ui/IrLogo.d.ts +11 -3
- package/lib/ir/ui/IrLogo.d.ts.map +1 -1
- package/lib/ir/ui/IrLogo.js +14 -5
- package/lib/ir/ui/IrLogo.js.map +1 -1
- package/lib/ir/ui/IrShell.d.ts.map +1 -1
- package/lib/ir/ui/IrShell.js +23 -56
- package/lib/ir/ui/IrShell.js.map +1 -1
- package/lib/ir/ui/IrStatusBar.d.ts +3 -2
- package/lib/ir/ui/IrStatusBar.d.ts.map +1 -1
- package/lib/ir/ui/IrStatusBar.js +14 -9
- package/lib/ir/ui/IrStatusBar.js.map +1 -1
- package/lib/ir/ui/IrToolbar.d.ts +3 -0
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
- package/lib/ir/ui/IrToolbar.js +10 -3
- package/lib/ir/ui/IrToolbar.js.map +1 -1
- package/lib/ir/ui/IrTraces.d.ts +4 -1
- package/lib/ir/ui/IrTraces.d.ts.map +1 -1
- package/lib/ir/ui/IrTraces.js +2 -0
- package/lib/ir/ui/IrTraces.js.map +1 -1
- package/lib/ir/ui/RamanEditor.d.ts +46 -0
- package/lib/ir/ui/RamanEditor.d.ts.map +1 -0
- package/lib/ir/ui/RamanEditor.js +17 -0
- package/lib/ir/ui/RamanEditor.js.map +1 -0
- package/lib/ir/ui/SpectraPanel.d.ts.map +1 -1
- package/lib/ir/ui/SpectraPanel.js +2 -2
- package/lib/ir/ui/SpectraPanel.js.map +1 -1
- package/lib/ir/ui/SpectrumRow.d.ts +7 -0
- package/lib/ir/ui/SpectrumRow.d.ts.map +1 -1
- package/lib/ir/ui/SpectrumRow.js +4 -5
- package/lib/ir/ui/SpectrumRow.js.map +1 -1
- package/lib/ir/ui/VibrationalEditor.d.ts +48 -0
- package/lib/ir/ui/VibrationalEditor.d.ts.map +1 -0
- package/lib/ir/ui/VibrationalEditor.js +31 -0
- package/lib/ir/ui/VibrationalEditor.js.map +1 -0
- package/lib/ir/ui/bandsTsv.d.ts +19 -0
- package/lib/ir/ui/bandsTsv.d.ts.map +1 -0
- package/lib/ir/ui/bandsTsv.js +38 -0
- package/lib/ir/ui/bandsTsv.js.map +1 -0
- package/lib/ir/ui/irChartProps.d.ts +14 -4
- package/lib/ir/ui/irChartProps.d.ts.map +1 -1
- package/lib/ir/ui/irChartProps.js +3 -2
- package/lib/ir/ui/irChartProps.js.map +1 -1
- package/lib/ir/ui/irCommandContext.d.ts +8 -0
- package/lib/ir/ui/irCommandContext.d.ts.map +1 -1
- package/lib/ir/ui/irCommandContext.js +14 -3
- package/lib/ir/ui/irCommandContext.js.map +1 -1
- package/lib/ir/ui/useIrEditor.d.ts +3 -3
- package/lib/ir/ui/useIrEditor.d.ts.map +1 -1
- package/lib/ir/ui/useIrEditor.js +13 -4
- package/lib/ir/ui/useIrEditor.js.map +1 -1
- package/lib/ir/ui/useIrHandle.d.ts +14 -0
- package/lib/ir/ui/useIrHandle.d.ts.map +1 -0
- package/lib/ir/ui/useIrHandle.js +39 -0
- package/lib/ir/ui/useIrHandle.js.map +1 -0
- package/lib/ir/ui/useIrText.d.ts +40 -0
- package/lib/ir/ui/useIrText.d.ts.map +1 -0
- package/lib/ir/ui/useIrText.js +118 -0
- package/lib/ir/ui/useIrText.js.map +1 -0
- package/lib/ir/ui/useIrZoom.d.ts +7 -0
- package/lib/ir/ui/useIrZoom.d.ts.map +1 -1
- package/lib/ir/ui/useIrZoom.js +5 -4
- package/lib/ir/ui/useIrZoom.js.map +1 -1
- package/lib/ir/ui/useValueAxisZoom.d.ts +20 -0
- package/lib/ir/ui/useValueAxisZoom.d.ts.map +1 -0
- package/lib/ir/ui/useValueAxisZoom.js +54 -0
- package/lib/ir/ui/useValueAxisZoom.js.map +1 -0
- package/lib/ir.d.ts +3 -0
- package/lib/ir.d.ts.map +1 -1
- package/lib/ir.js +3 -0
- package/lib/ir.js.map +1 -1
- package/lib/locales/de.json +20 -1
- package/lib/locales/en.json +20 -1
- package/lib/locales/es.json +20 -1
- package/lib/locales/fr.json +20 -1
- package/lib/locales/it.json +20 -1
- package/lib/raman.d.ts +16 -0
- package/lib/raman.d.ts.map +1 -0
- package/lib/raman.js +12 -0
- package/lib/raman.js.map +1 -0
- package/package.json +2 -1
- package/src/ir/core/analysisSpectra.ts +26 -10
- package/src/ir/core/bandLabelPlan.ts +21 -10
- package/src/ir/core/index.ts +25 -5
- package/src/ir/core/irBand.ts +52 -14
- package/src/ir/core/irCommands.ts +15 -1
- package/src/ir/core/irDomain.ts +9 -7
- package/src/ir/core/irFormat.ts +39 -6
- package/src/ir/core/irMode.ts +42 -10
- package/src/ir/core/irReducer.ts +1 -49
- package/src/ir/core/irSpectrum.ts +59 -30
- package/src/ir/core/irState.ts +67 -2
- package/src/ir/core/irTechnique.ts +115 -0
- package/src/ir/core/irTechniqueCommands.ts +82 -0
- package/src/ir/core/pickBands.ts +63 -28
- package/src/ir/core/ramanBands.ts +105 -0
- package/src/ir/core/spectrumJcamp.ts +65 -16
- package/src/ir/core/toIrSpectrum.ts +20 -2
- package/src/ir/ui/BandRow.tsx +107 -0
- package/src/ir/ui/BandsPanel.tsx +32 -125
- package/src/ir/ui/IrAboutDialog.tsx +69 -28
- package/src/ir/ui/IrCanvas.tsx +2 -1
- package/src/ir/ui/IrChart.tsx +20 -24
- package/src/ir/ui/IrCommandProvider.tsx +10 -3
- package/src/ir/ui/IrCommandTooltip.tsx +11 -2
- package/src/ir/ui/IrDocumentationDialog.tsx +99 -55
- package/src/ir/ui/IrEditor.tsx +5 -36
- package/src/ir/ui/IrHeader.tsx +10 -3
- package/src/ir/ui/IrLogo.tsx +28 -9
- package/src/ir/ui/IrShell.tsx +27 -75
- package/src/ir/ui/IrStatusBar.tsx +17 -12
- package/src/ir/ui/IrToolbar.tsx +26 -15
- package/src/ir/ui/IrTraces.tsx +5 -1
- package/src/ir/ui/RamanEditor.tsx +53 -0
- package/src/ir/ui/SpectraPanel.tsx +2 -1
- package/src/ir/ui/SpectrumRow.tsx +14 -5
- package/src/ir/ui/VibrationalEditor.tsx +94 -0
- package/src/ir/ui/bandsTsv.ts +46 -0
- package/src/ir/ui/irChartProps.ts +14 -4
- package/src/ir/ui/irCommandContext.tsx +18 -3
- package/src/ir/ui/useIrEditor.ts +20 -8
- package/src/ir/ui/useIrHandle.ts +51 -0
- package/src/ir/ui/useIrText.ts +170 -0
- package/src/ir/ui/useIrZoom.ts +12 -3
- package/src/ir/ui/useValueAxisZoom.ts +67 -0
- package/src/ir.ts +3 -0
- package/src/locales/de.json +20 -1
- package/src/locales/en.json +20 -1
- package/src/locales/es.json +20 -1
- package/src/locales/fr.json +20 -1
- package/src/locales/it.json +20 -1
- package/src/raman.ts +19 -0
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { Dialog, DialogBody } from '@blueprintjs/core';
|
|
2
2
|
|
|
3
|
+
import { Prose } from '../../i18n/ui/Prose.tsx';
|
|
4
|
+
import { useChromeT } from '../../i18n/ui/useT.ts';
|
|
5
|
+
import { irCommands } from '../core/irCommands.ts';
|
|
6
|
+
import type { IrTechnique } from '../core/irTechnique.ts';
|
|
7
|
+
|
|
3
8
|
import { IrLogo } from './IrLogo.tsx';
|
|
9
|
+
import { useIrText } from './useIrText.ts';
|
|
4
10
|
|
|
5
11
|
export interface IrAboutDialogProps {
|
|
6
12
|
/** Whether the dialog is open. */
|
|
7
13
|
isOpen: boolean;
|
|
8
14
|
/** Close it. */
|
|
9
15
|
onClose: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* What the spectra were measured with, which decides what the viewer says it
|
|
18
|
+
* does and whom it credits for it.
|
|
19
|
+
* @default 'infrared'
|
|
20
|
+
*/
|
|
21
|
+
technique?: IrTechnique;
|
|
10
22
|
}
|
|
11
23
|
|
|
12
24
|
/**
|
|
@@ -20,42 +32,63 @@ export interface IrAboutDialogProps {
|
|
|
20
32
|
* @returns The dialog.
|
|
21
33
|
*/
|
|
22
34
|
export function IrAboutDialog(props: IrAboutDialogProps) {
|
|
23
|
-
const { isOpen, onClose } = props;
|
|
35
|
+
const { isOpen, onClose, technique = 'infrared' } = props;
|
|
36
|
+
const t = useChromeT();
|
|
37
|
+
const title = (useIrText(technique).command('about') ?? irCommands.about)
|
|
38
|
+
.title;
|
|
39
|
+
const raman = technique === 'raman';
|
|
24
40
|
|
|
25
41
|
return (
|
|
26
42
|
<Dialog
|
|
27
43
|
isOpen={isOpen}
|
|
28
44
|
onClose={onClose}
|
|
29
|
-
title=
|
|
30
|
-
icon={<IrLogo size={20} />}
|
|
45
|
+
title={title}
|
|
46
|
+
icon={<IrLogo size={20} technique={technique} />}
|
|
31
47
|
style={dialogStyle}
|
|
32
48
|
>
|
|
33
49
|
<DialogBody>
|
|
34
50
|
<div style={brandStyle}>
|
|
35
|
-
<IrLogo size={64} />
|
|
51
|
+
<IrLogo size={64} technique={technique} />
|
|
36
52
|
<div>
|
|
37
|
-
<p style={leadStyle}>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
53
|
+
<p style={leadStyle}>{DOORS[technique]}</p>
|
|
54
|
+
{raman ? (
|
|
55
|
+
<p style={paragraphStyle}>{t('ir.raman.aboutLead')}</p>
|
|
56
|
+
) : (
|
|
57
|
+
<p style={paragraphStyle}>
|
|
58
|
+
Draws an infrared spectrum the way infrared is printed, reads it
|
|
59
|
+
as absorbance or as percent transmittance, picks its bands and
|
|
60
|
+
offers every functional group each band could be.
|
|
61
|
+
</p>
|
|
62
|
+
)}
|
|
43
63
|
</div>
|
|
44
64
|
</div>
|
|
45
65
|
|
|
46
66
|
<h4 style={headingStyle}>Credits</h4>
|
|
47
67
|
<ul style={listStyle}>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
{raman ? (
|
|
69
|
+
<>
|
|
70
|
+
<li>
|
|
71
|
+
<Prose text={t('ir.raman.credit.picking')} />
|
|
72
|
+
</li>
|
|
73
|
+
<li>
|
|
74
|
+
<Prose text={t('ir.raman.credit.jcamp')} />
|
|
75
|
+
</li>
|
|
76
|
+
</>
|
|
77
|
+
) : (
|
|
78
|
+
<>
|
|
79
|
+
<li>
|
|
80
|
+
<strong>ir-spectrum</strong> (cheminfo, MIT) reads the JCAMP-DX
|
|
81
|
+
and SPC files, derives the absorbance/transmittance pair, and
|
|
82
|
+
picks the bands. This package deliberately does none of that
|
|
83
|
+
arithmetic itself.
|
|
84
|
+
</li>
|
|
85
|
+
<li>
|
|
86
|
+
<strong>common-spectrum</strong>,{' '}
|
|
87
|
+
<strong>jcampconverter</strong> and <strong>spc-parser</strong>{' '}
|
|
88
|
+
(cheminfo, MIT) are what it reads through.
|
|
89
|
+
</li>
|
|
90
|
+
</>
|
|
91
|
+
)}
|
|
59
92
|
<li>
|
|
60
93
|
<strong>ml-spectra-processing</strong> (mljs, MIT) for the array
|
|
61
94
|
work.
|
|
@@ -69,13 +102,15 @@ export function IrAboutDialog(props: IrAboutDialogProps) {
|
|
|
69
102
|
<strong>react-science</strong> and <strong>BlueprintJS</strong>
|
|
70
103
|
(zakodium, Palantir) for the shell this viewer is shaped like.
|
|
71
104
|
</li>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
105
|
+
{raman ? null : (
|
|
106
|
+
<li>
|
|
107
|
+
The <strong>correlation table</strong> is the conventional
|
|
108
|
+
teaching set of group frequencies, as any introductory
|
|
109
|
+
spectroscopy text tabulates them. The ranges are deliberately the
|
|
110
|
+
rounded, generous ones: narrowing them to look precise would rule
|
|
111
|
+
out assignments that are genuinely possible.
|
|
112
|
+
</li>
|
|
113
|
+
)}
|
|
79
114
|
<li>
|
|
80
115
|
The <strong>colours</strong> are Okabe and Ito's
|
|
81
116
|
colour-universal palette, so two traces stay distinguishable for a
|
|
@@ -87,6 +122,12 @@ export function IrAboutDialog(props: IrAboutDialogProps) {
|
|
|
87
122
|
);
|
|
88
123
|
}
|
|
89
124
|
|
|
125
|
+
/** The entry point each technique's viewer is imported from. */
|
|
126
|
+
const DOORS: Record<IrTechnique, string> = {
|
|
127
|
+
infrared: 'react-cheminfo/ir',
|
|
128
|
+
raman: 'react-cheminfo/raman',
|
|
129
|
+
};
|
|
130
|
+
|
|
90
131
|
const dialogStyle = { width: 'min(680px, 92vw)' } as const;
|
|
91
132
|
|
|
92
133
|
const brandStyle = {
|
package/src/ir/ui/IrCanvas.tsx
CHANGED
|
@@ -54,7 +54,7 @@ export function IrCanvas(props: IrCanvasProps) {
|
|
|
54
54
|
const { state, visibleSpectra, assigned } = useIrEditorState();
|
|
55
55
|
const actions = useIrActions();
|
|
56
56
|
const { domain, tool, selectedId } = state.view;
|
|
57
|
-
const { mode, showAssignments, labelLimit } = state.settings;
|
|
57
|
+
const { technique, mode, showAssignments, labelLimit } = state.settings;
|
|
58
58
|
|
|
59
59
|
const onDomainChange = useCallback(
|
|
60
60
|
(next: IrDomain) => {
|
|
@@ -68,6 +68,7 @@ export function IrCanvas(props: IrCanvasProps) {
|
|
|
68
68
|
<div ref={attachChart} id={chartId} style={chartStyle}>
|
|
69
69
|
<IrChart
|
|
70
70
|
spectra={visibleSpectra}
|
|
71
|
+
technique={technique}
|
|
71
72
|
mode={mode}
|
|
72
73
|
assigned={assigned}
|
|
73
74
|
showAssignments={showAssignments}
|
package/src/ir/ui/IrChart.tsx
CHANGED
|
@@ -9,14 +9,14 @@ import { chartSurfaceStyle } from '../../chart/ui/chartSurface.ts';
|
|
|
9
9
|
import { useChartSize } from '../../chart/ui/useChartSize.ts';
|
|
10
10
|
import type { AssignedBand } from '../core/assignBands.ts';
|
|
11
11
|
import type { IrBand } from '../core/irBand.ts';
|
|
12
|
-
import {
|
|
13
|
-
import type { IrMode } from '../core/irSpectrum.ts';
|
|
12
|
+
import { irModeFor } from '../core/irTechnique.ts';
|
|
14
13
|
|
|
15
14
|
import { BandMarks } from './BandMarks.tsx';
|
|
16
15
|
import { IrPointerTracker } from './IrPointerTracker.tsx';
|
|
17
16
|
import { IrTraces } from './IrTraces.tsx';
|
|
18
17
|
import type { IrChartProps } from './irChartProps.ts';
|
|
19
18
|
import { useIrPointer } from './useIrPointer.ts';
|
|
19
|
+
import { useIrText } from './useIrText.ts';
|
|
20
20
|
import { useIrZoom } from './useIrZoom.ts';
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -28,7 +28,8 @@ import { useIrZoom } from './useIrZoom.ts';
|
|
|
28
28
|
* building the scale onto a reversed pixel range and nothing else: the data stays
|
|
29
29
|
* in ascending wavenumbers, every window stays low end first, and no other piece
|
|
30
30
|
* of arithmetic in either package has to know. That is the whole reason
|
|
31
|
-
* `createScale` takes its range rather than deriving it.
|
|
31
|
+
* `createScale` takes its range rather than deriving it. A Raman spectrum is
|
|
32
|
+
* drawn the other way, low shifts at the left, by the same means.
|
|
32
33
|
*
|
|
33
34
|
* The axes go under the data, so a grid line is never read as a band. Only the
|
|
34
35
|
* data band is clipped, so a zoomed trace stops at the plot edge while the
|
|
@@ -46,7 +47,8 @@ import { useIrZoom } from './useIrZoom.ts';
|
|
|
46
47
|
export function IrChart(props: IrChartProps): ReactElement {
|
|
47
48
|
const {
|
|
48
49
|
spectra,
|
|
49
|
-
|
|
50
|
+
technique = 'infrared',
|
|
51
|
+
mode: asked,
|
|
50
52
|
assigned = NO_BANDS,
|
|
51
53
|
showAssignments = false,
|
|
52
54
|
labelLimit,
|
|
@@ -61,6 +63,8 @@ export function IrChart(props: IrChartProps): ReactElement {
|
|
|
61
63
|
children,
|
|
62
64
|
} = props;
|
|
63
65
|
|
|
66
|
+
const mode = irModeFor(technique, asked);
|
|
67
|
+
const text = useIrText(technique);
|
|
64
68
|
const [containerRef, measured] = useChartSize<HTMLDivElement>();
|
|
65
69
|
const svgRef = useRef<SVGSVGElement | null>(null);
|
|
66
70
|
|
|
@@ -79,7 +83,15 @@ export function IrChart(props: IrChartProps): ReactElement {
|
|
|
79
83
|
|
|
80
84
|
// The host's window goes *into* the zoom rather than over it, so a drag is
|
|
81
85
|
// always measured against what is on screen.
|
|
82
|
-
const zoom = useIrZoom({
|
|
86
|
+
const zoom = useIrZoom({
|
|
87
|
+
spectra,
|
|
88
|
+
technique,
|
|
89
|
+
mode,
|
|
90
|
+
svgRef,
|
|
91
|
+
plot,
|
|
92
|
+
domain,
|
|
93
|
+
drag,
|
|
94
|
+
});
|
|
83
95
|
|
|
84
96
|
// The scales the zoom measured its gestures against — the x one running right
|
|
85
97
|
// to left. Taken from the hook rather than built here, because two scales over
|
|
@@ -128,7 +140,7 @@ export function IrChart(props: IrChartProps): ReactElement {
|
|
|
128
140
|
<svg
|
|
129
141
|
ref={svgRef}
|
|
130
142
|
role="img"
|
|
131
|
-
aria-label={
|
|
143
|
+
aria-label={text.chart(mode)}
|
|
132
144
|
width={frameWidth}
|
|
133
145
|
height={frameHeight}
|
|
134
146
|
viewBox={`0 0 ${frameWidth} ${frameHeight}`}
|
|
@@ -154,8 +166,8 @@ export function IrChart(props: IrChartProps): ReactElement {
|
|
|
154
166
|
yDomain={shown.y}
|
|
155
167
|
xScale={xScale}
|
|
156
168
|
yScale={yScale}
|
|
157
|
-
xTitle=
|
|
158
|
-
yTitle={
|
|
169
|
+
xTitle={text.xTitle}
|
|
170
|
+
yTitle={text.yTitle(mode)}
|
|
159
171
|
/>
|
|
160
172
|
|
|
161
173
|
<g clipPath={`url(#${clipId})`}>
|
|
@@ -192,22 +204,6 @@ export function IrChart(props: IrChartProps): ReactElement {
|
|
|
192
204
|
);
|
|
193
205
|
}
|
|
194
206
|
|
|
195
|
-
/**
|
|
196
|
-
* What the chart is, and what can be done to it, for whoever cannot see it.
|
|
197
|
-
*
|
|
198
|
-
* The gestures differ by mode, so the sentence does too — a label promising the
|
|
199
|
-
* wheel to a reader who cannot watch it fail to do anything is worse than no
|
|
200
|
-
* label at all.
|
|
201
|
-
* @param mode - Which value axis is being drawn.
|
|
202
|
-
* @returns The label.
|
|
203
|
-
*/
|
|
204
|
-
function chartLabel(mode: IrMode): string {
|
|
205
|
-
const axis = `Infrared spectrum read as ${yAxisTitle(mode)}, wavenumber running from high at the left to low at the right.`;
|
|
206
|
-
return boxZoomOnly(mode)
|
|
207
|
-
? `${axis} Drag a rectangle over it to zoom to that rectangle, and double click to fit everything again.`
|
|
208
|
-
: `${axis} Drag across it to zoom the wavenumber axis, drag past the baseline to take the value axis with it, turn the wheel to scale the value axis, and double click to fit everything again.`;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
207
|
/** What a chart nobody has picked any bands for marks. */
|
|
212
208
|
const NO_BANDS: readonly AssignedBand[] = Object.freeze([]);
|
|
213
209
|
|
|
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { IrCommandHandlers } from '../core/irCommands.ts';
|
|
5
|
+
import type { IrTechnique } from '../core/irTechnique.ts';
|
|
5
6
|
|
|
6
7
|
import type { IrCommandContextValue } from './irCommandContext.tsx';
|
|
7
8
|
import { commandContext } from './irCommandContext.tsx';
|
|
@@ -9,6 +10,12 @@ import { commandContext } from './irCommandContext.tsx';
|
|
|
9
10
|
export interface IrCommandProviderProps {
|
|
10
11
|
/** What each command does. */
|
|
11
12
|
handlers: IrCommandHandlers;
|
|
13
|
+
/**
|
|
14
|
+
* What the spectra were measured with, which decides how each command is
|
|
15
|
+
* worded in its tooltip and its label.
|
|
16
|
+
* @default 'infrared'
|
|
17
|
+
*/
|
|
18
|
+
technique?: IrTechnique;
|
|
12
19
|
/** The viewer. */
|
|
13
20
|
children: ReactNode;
|
|
14
21
|
}
|
|
@@ -19,11 +26,11 @@ export interface IrCommandProviderProps {
|
|
|
19
26
|
* @returns The provider.
|
|
20
27
|
*/
|
|
21
28
|
export function IrCommandProvider(props: IrCommandProviderProps) {
|
|
22
|
-
const { handlers, children } = props;
|
|
29
|
+
const { handlers, technique = 'infrared', children } = props;
|
|
23
30
|
|
|
24
31
|
const value = useMemo<IrCommandContextValue>(
|
|
25
|
-
() => ({ handlers, run: (id) => handlers[id]?.() }),
|
|
26
|
-
[handlers],
|
|
32
|
+
() => ({ handlers, technique, run: (id) => handlers[id]?.() }),
|
|
33
|
+
[handlers, technique],
|
|
27
34
|
);
|
|
28
35
|
|
|
29
36
|
return (
|
|
@@ -2,10 +2,19 @@ import { TooltipHelpContent } from 'react-science/ui';
|
|
|
2
2
|
|
|
3
3
|
import type { IrCommand, IrCommandId } from '../core/irCommands.ts';
|
|
4
4
|
import { irCommands } from '../core/irCommands.ts';
|
|
5
|
+
import type { IrTechnique } from '../core/irTechnique.ts';
|
|
6
|
+
|
|
7
|
+
import { useIrText } from './useIrText.ts';
|
|
5
8
|
|
|
6
9
|
export interface IrCommandTooltipProps {
|
|
7
10
|
/** Which command the tooltip is about. */
|
|
8
11
|
id: IrCommandId;
|
|
12
|
+
/**
|
|
13
|
+
* What the spectra were measured with, which decides how the command is
|
|
14
|
+
* worded.
|
|
15
|
+
* @default 'infrared'
|
|
16
|
+
*/
|
|
17
|
+
technique?: IrTechnique;
|
|
9
18
|
}
|
|
10
19
|
|
|
11
20
|
/**
|
|
@@ -18,8 +27,8 @@ export interface IrCommandTooltipProps {
|
|
|
18
27
|
* @returns The tooltip's content.
|
|
19
28
|
*/
|
|
20
29
|
export function IrCommandTooltip(props: IrCommandTooltipProps) {
|
|
21
|
-
const { id } = props;
|
|
22
|
-
const entry = irCommands[id]
|
|
30
|
+
const { id, technique = 'infrared' } = props;
|
|
31
|
+
const entry: IrCommand = useIrText(technique).command(id) ?? irCommands[id];
|
|
23
32
|
const shortcuts = entry.shortcut?.label ?? entry.shortcut?.keys;
|
|
24
33
|
|
|
25
34
|
return (
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import { Dialog, DialogBody } from '@blueprintjs/core';
|
|
2
2
|
|
|
3
|
+
import { Prose } from '../../i18n/ui/Prose.tsx';
|
|
4
|
+
import { useChromeT } from '../../i18n/ui/useT.ts';
|
|
3
5
|
import { TOKEN } from '../../tokens/core/familyTokens.ts';
|
|
4
6
|
import type { IrCommand, IrCommandId } from '../core/irCommands.ts';
|
|
5
|
-
import { irCommands } from '../core/irCommands.ts';
|
|
6
7
|
import { IR_MODE_RULES } from '../core/irMode.ts';
|
|
8
|
+
import type { IrTechnique } from '../core/irTechnique.ts';
|
|
9
|
+
import { irCommandsFor } from '../core/irTechniqueCommands.ts';
|
|
7
10
|
|
|
8
11
|
import { IrLogo } from './IrLogo.tsx';
|
|
12
|
+
import { useIrText } from './useIrText.ts';
|
|
9
13
|
|
|
10
14
|
export interface IrDocumentationDialogProps {
|
|
11
15
|
/** Whether the dialog is open. */
|
|
12
16
|
isOpen: boolean;
|
|
13
17
|
/** Close it. */
|
|
14
18
|
onClose: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* What the spectra were measured with, which decides what the guide says:
|
|
21
|
+
* only what is true of the technique, and only the commands it offers.
|
|
22
|
+
* @default 'infrared'
|
|
23
|
+
*/
|
|
24
|
+
technique?: IrTechnique;
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
/**
|
|
@@ -19,73 +29,36 @@ export interface IrDocumentationDialogProps {
|
|
|
19
29
|
*
|
|
20
30
|
* In the component rather than on a site, so there is nowhere to leave for and
|
|
21
31
|
* nothing to keep in step: every key in the table below is read out of the same
|
|
22
|
-
*
|
|
32
|
+
* command table the toolbar and the key handler read, so a shortcut cannot be
|
|
23
33
|
* documented as one thing and bound as another.
|
|
24
34
|
* @param props - Component props.
|
|
25
35
|
* @returns The dialog.
|
|
26
36
|
*/
|
|
27
37
|
export function IrDocumentationDialog(props: IrDocumentationDialogProps) {
|
|
28
|
-
const { isOpen, onClose } = props;
|
|
38
|
+
const { isOpen, onClose, technique = 'infrared' } = props;
|
|
39
|
+
const text = useIrText(technique);
|
|
40
|
+
const ids = Object.keys(irCommandsFor(technique)) as IrCommandId[];
|
|
29
41
|
|
|
30
42
|
return (
|
|
31
43
|
<Dialog
|
|
32
44
|
isOpen={isOpen}
|
|
33
45
|
onClose={onClose}
|
|
34
|
-
title=
|
|
35
|
-
icon={<IrLogo size={20} />}
|
|
46
|
+
title={text.documentation}
|
|
47
|
+
icon={<IrLogo size={20} technique={technique} />}
|
|
36
48
|
style={dialogStyle}
|
|
37
49
|
>
|
|
38
50
|
<DialogBody>
|
|
39
|
-
<
|
|
40
|
-
<p style={paragraphStyle}>
|
|
41
|
-
JCAMP-DX (<code>.jdx</code>, <code>.dx</code>) and Thermo Galactic SPC
|
|
42
|
-
(<code>.spc</code>) are read. A file holding several blocks — a sample
|
|
43
|
-
beside its background, or an infrared spectrum beside a Raman one —
|
|
44
|
-
gives one spectrum per infrared block; the others are left to their
|
|
45
|
-
own viewers. Two columns of numbers are not read yet.
|
|
46
|
-
</p>
|
|
47
|
-
|
|
48
|
-
<h4 style={headingStyle}>The axis runs backwards</h4>
|
|
49
|
-
<p style={paragraphStyle}>
|
|
50
|
-
Wavenumber decreases to the right, from 4000 cm⁻¹ down to 400, which
|
|
51
|
-
is how infrared spectra have been printed since the instruments
|
|
52
|
-
scanned that way. Every window is still stated low end first.
|
|
53
|
-
</p>
|
|
54
|
-
|
|
55
|
-
<h4 style={headingStyle}>Absorbance or transmittance</h4>
|
|
56
|
-
<p style={paragraphStyle}>
|
|
57
|
-
The same measurement, read the other way up — the file carries both,
|
|
58
|
-
whichever it was written in. In{' '}
|
|
59
|
-
<strong>{IR_MODE_RULES.transmittance.title}</strong> the bands hang
|
|
60
|
-
down from a baseline near 100; in{' '}
|
|
61
|
-
<strong>{IR_MODE_RULES.absorbance.title}</strong> they stand up out of
|
|
62
|
-
zero. The labels and the marks follow, so the pair reads the same way
|
|
63
|
-
up in either.
|
|
64
|
-
</p>
|
|
65
|
-
|
|
66
|
-
<h4 style={headingStyle}>Reading the bands</h4>
|
|
67
|
-
<p style={paragraphStyle}>
|
|
68
|
-
The bands of the <em>selected</em> spectrum are picked, marked on the
|
|
69
|
-
chart, and listed in the bands panel with{' '}
|
|
70
|
-
<strong>every vibration whose range contains them</strong> — narrowest
|
|
71
|
-
claim first. That is deliberate: a band at 1715 cm⁻¹ really is a
|
|
72
|
-
ketone, an aldehyde and a carboxylic acid until something else decides
|
|
73
|
-
between them, and the note on each candidate is what tells them apart.
|
|
74
|
-
Hovering a row marks the band on the chart, and hovering the chart
|
|
75
|
-
lights the row.
|
|
76
|
-
</p>
|
|
77
|
-
<p style={paragraphStyle}>
|
|
78
|
-
A band is reported at the sampled point it peaked on, so on a 4 cm⁻¹
|
|
79
|
-
grid a carbonyl centred at 1710 reads 1708 or 1712. Do not quote one
|
|
80
|
-
as though it were measured to the wavenumber.
|
|
81
|
-
</p>
|
|
51
|
+
{technique === 'raman' ? <RamanGuide /> : <InfraredGuide />}
|
|
82
52
|
|
|
83
53
|
<h4 style={headingStyle}>Gestures and keys</h4>
|
|
84
54
|
<table style={tableStyle}>
|
|
85
55
|
<tbody>
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
56
|
+
{ids.map((id) => {
|
|
57
|
+
const entry = text.command(id);
|
|
58
|
+
return entry === undefined ? null : (
|
|
59
|
+
<CommandRow key={id} entry={entry} />
|
|
60
|
+
);
|
|
61
|
+
})}
|
|
89
62
|
</tbody>
|
|
90
63
|
</table>
|
|
91
64
|
</DialogBody>
|
|
@@ -93,9 +66,81 @@ export function IrDocumentationDialog(props: IrDocumentationDialogProps) {
|
|
|
93
66
|
);
|
|
94
67
|
}
|
|
95
68
|
|
|
69
|
+
/**
|
|
70
|
+
* What is true of reading an infrared spectrum here.
|
|
71
|
+
* @returns The sections.
|
|
72
|
+
*/
|
|
73
|
+
function InfraredGuide() {
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<h4 style={headingStyle}>Opening a spectrum</h4>
|
|
77
|
+
<p style={paragraphStyle}>
|
|
78
|
+
JCAMP-DX (<code>.jdx</code>, <code>.dx</code>) and Thermo Galactic SPC (
|
|
79
|
+
<code>.spc</code>) are read. A file holding several blocks — a sample
|
|
80
|
+
beside its background, or an infrared spectrum beside a Raman one —
|
|
81
|
+
gives one spectrum per infrared block; the others are left to their own
|
|
82
|
+
viewers. Two columns of numbers are not read yet.
|
|
83
|
+
</p>
|
|
84
|
+
|
|
85
|
+
<h4 style={headingStyle}>The axis runs backwards</h4>
|
|
86
|
+
<p style={paragraphStyle}>
|
|
87
|
+
Wavenumber decreases to the right, from 4000 cm⁻¹ down to 400, which is
|
|
88
|
+
how infrared spectra have been printed since the instruments scanned
|
|
89
|
+
that way. Every window is still stated low end first.
|
|
90
|
+
</p>
|
|
91
|
+
|
|
92
|
+
<h4 style={headingStyle}>Absorbance or transmittance</h4>
|
|
93
|
+
<p style={paragraphStyle}>
|
|
94
|
+
The same measurement, read the other way up — the file carries both,
|
|
95
|
+
whichever it was written in. In{' '}
|
|
96
|
+
<strong>{IR_MODE_RULES.transmittance.title}</strong> the bands hang down
|
|
97
|
+
from a baseline near 100; in{' '}
|
|
98
|
+
<strong>{IR_MODE_RULES.absorbance.title}</strong> they stand up out of
|
|
99
|
+
zero. The labels and the marks follow, so the pair reads the same way up
|
|
100
|
+
in either.
|
|
101
|
+
</p>
|
|
102
|
+
|
|
103
|
+
<h4 style={headingStyle}>Reading the bands</h4>
|
|
104
|
+
<p style={paragraphStyle}>
|
|
105
|
+
The bands of the <em>selected</em> spectrum are picked, marked on the
|
|
106
|
+
chart, and listed in the bands panel with{' '}
|
|
107
|
+
<strong>every vibration whose range contains them</strong> — narrowest
|
|
108
|
+
claim first. That is deliberate: a band at 1715 cm⁻¹ really is a ketone,
|
|
109
|
+
an aldehyde and a carboxylic acid until something else decides between
|
|
110
|
+
them, and the note on each candidate is what tells them apart. Hovering
|
|
111
|
+
a row marks the band on the chart, and hovering the chart lights the
|
|
112
|
+
row.
|
|
113
|
+
</p>
|
|
114
|
+
<p style={paragraphStyle}>
|
|
115
|
+
A band is reported at the sampled point it peaked on, so on a 4 cm⁻¹
|
|
116
|
+
grid a carbonyl centred at 1710 reads 1708 or 1712. Do not quote one as
|
|
117
|
+
though it were measured to the wavenumber.
|
|
118
|
+
</p>
|
|
119
|
+
</>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* What is true of reading a Raman spectrum here: only the bands, since it has
|
|
125
|
+
* one value axis, runs the usual way, and is not assigned.
|
|
126
|
+
* @returns The section.
|
|
127
|
+
*/
|
|
128
|
+
function RamanGuide() {
|
|
129
|
+
const t = useChromeT();
|
|
130
|
+
return (
|
|
131
|
+
<>
|
|
132
|
+
<h4 style={headingStyle}>Reading the bands</h4>
|
|
133
|
+
<p style={paragraphStyle}>
|
|
134
|
+
<Prose text={t('ir.raman.doc.bands')} />
|
|
135
|
+
</p>
|
|
136
|
+
<p style={paragraphStyle}>{t('ir.raman.doc.sampled')}</p>
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
96
141
|
interface CommandRowProps {
|
|
97
|
-
/**
|
|
98
|
-
|
|
142
|
+
/** The command, as the viewer words it. */
|
|
143
|
+
entry: IrCommand;
|
|
99
144
|
}
|
|
100
145
|
|
|
101
146
|
/**
|
|
@@ -104,8 +149,7 @@ interface CommandRowProps {
|
|
|
104
149
|
* @returns The row.
|
|
105
150
|
*/
|
|
106
151
|
function CommandRow(props: CommandRowProps) {
|
|
107
|
-
const {
|
|
108
|
-
const entry = irCommands[id] as IrCommand;
|
|
152
|
+
const { entry } = props;
|
|
109
153
|
const keys = entry.shortcut?.label ?? entry.shortcut?.keys;
|
|
110
154
|
|
|
111
155
|
return (
|
package/src/ir/ui/IrEditor.tsx
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
|
-
import { RootLayout } from 'react-science/ui';
|
|
3
2
|
|
|
4
3
|
import type { IrEditorHandle } from '../core/irEditorApi.ts';
|
|
5
4
|
import type { IrSidePanelId } from '../core/irSidePanels.ts';
|
|
6
5
|
import type { IrMode, IrSpectrum } from '../core/irSpectrum.ts';
|
|
7
6
|
|
|
8
|
-
import {
|
|
9
|
-
import { IrStateProvider } from './IrStateProvider.tsx';
|
|
10
|
-
import { useIrEditor } from './useIrEditor.ts';
|
|
7
|
+
import { VibrationalEditor } from './VibrationalEditor.tsx';
|
|
11
8
|
|
|
12
9
|
export interface IrEditorProps {
|
|
13
10
|
/**
|
|
@@ -29,7 +26,8 @@ export interface IrEditorProps {
|
|
|
29
26
|
*/
|
|
30
27
|
onChange?: (spectra: IrSpectrum[]) => void;
|
|
31
28
|
/**
|
|
32
|
-
* Which value axis to open in.
|
|
29
|
+
* Which value axis to open in: transmittance or absorbance. Intensity, which
|
|
30
|
+
* infrared does not offer, opens transmittance instead.
|
|
33
31
|
* @default 'transmittance'
|
|
34
32
|
*/
|
|
35
33
|
mode?: IrMode;
|
|
@@ -49,6 +47,7 @@ export interface IrEditorProps {
|
|
|
49
47
|
/**
|
|
50
48
|
* An infrared spectrum viewer: a header across the top, the chart in the middle,
|
|
51
49
|
* the tools down the left, and the panels that interrogate it down the right.
|
|
50
|
+
* `RamanEditor`, from `react-cheminfo/raman`, is the same viewer for Raman.
|
|
52
51
|
*
|
|
53
52
|
* The same shape as the mass viewer, deliberately — a page may well hold both,
|
|
54
53
|
* and a chemist who has learned one should not have to learn the other. The chart
|
|
@@ -65,35 +64,5 @@ export interface IrEditorProps {
|
|
|
65
64
|
* @returns The viewer.
|
|
66
65
|
*/
|
|
67
66
|
export function IrEditor(props: IrEditorProps) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const editor = useIrEditor({
|
|
71
|
-
spectra: data,
|
|
72
|
-
settings: mode === undefined ? undefined : { mode },
|
|
73
|
-
panelIds: defaultPanelIds,
|
|
74
|
-
onChange,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<IrStateProvider editor={editor}>
|
|
79
|
-
{/* `react-science`'s own root: it holds the element the browser is asked
|
|
80
|
-
to show full screen, points Blueprint's portals at that element so
|
|
81
|
-
dialogs and tooltips are not left behind in `document.body`, and paints
|
|
82
|
-
the backdrop white. Above the shell rather than inside it, so the shell
|
|
83
|
-
can ask whether it is full screen and offer the way out. */}
|
|
84
|
-
<RootLayout style={rootLayoutStyle}>
|
|
85
|
-
<IrShell handle={ref} />
|
|
86
|
-
</RootLayout>
|
|
87
|
-
</IrStateProvider>
|
|
88
|
-
);
|
|
67
|
+
return <VibrationalEditor technique="infrared" {...props} />;
|
|
89
68
|
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The viewer fills what it is given, and its own children scroll rather than
|
|
93
|
-
* push: `react-science` lays its root out as a column of full width and height,
|
|
94
|
-
* and a flex column with no `minHeight` grows past its parent instead.
|
|
95
|
-
*/
|
|
96
|
-
const rootLayoutStyle = { minHeight: 0 } as const;
|
|
97
|
-
|
|
98
|
-
/** What a viewer opens on when it is handed nothing, kept stable for the memo. */
|
|
99
|
-
const NO_SPECTRA: IrSpectrum[] = [];
|
package/src/ir/ui/IrHeader.tsx
CHANGED
|
@@ -2,6 +2,8 @@ import { Header, Toolbar, useFullscreen } from 'react-science/ui';
|
|
|
2
2
|
|
|
3
3
|
import { IrLogo } from './IrLogo.tsx';
|
|
4
4
|
import { useIrCommandProps } from './irCommandContext.tsx';
|
|
5
|
+
import { useIrEditorState } from './irStateContext.ts';
|
|
6
|
+
import { useIrText } from './useIrText.ts';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* The bar across the top: the mark on the left, the viewer on the right.
|
|
@@ -17,13 +19,18 @@ import { useIrCommandProps } from './irCommandContext.tsx';
|
|
|
17
19
|
export function IrHeader() {
|
|
18
20
|
const command = useIrCommandProps();
|
|
19
21
|
const { isFullScreen } = useFullscreen();
|
|
22
|
+
const { technique } = useIrEditorState().state.settings;
|
|
23
|
+
const text = useIrText(technique);
|
|
20
24
|
|
|
21
25
|
return (
|
|
22
26
|
<Header>
|
|
23
|
-
<Toolbar aria-label=
|
|
24
|
-
<Toolbar.Item
|
|
27
|
+
<Toolbar aria-label={text.viewer}>
|
|
28
|
+
<Toolbar.Item
|
|
29
|
+
icon={<IrLogo size={16} technique={technique} />}
|
|
30
|
+
{...command('about')}
|
|
31
|
+
/>
|
|
25
32
|
</Toolbar>
|
|
26
|
-
<Toolbar aria-label=
|
|
33
|
+
<Toolbar aria-label={text.viewerHelp}>
|
|
27
34
|
<Toolbar.Item icon="help" {...command('documentation')} />
|
|
28
35
|
{/* Always the last thing in the bar, hard against the right edge: the
|
|
29
36
|
corner a window is made bigger from is the corner it is looked for
|