react-cheminfo 0.132.0 → 0.134.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 +16 -0
- package/lib/drawing/captionEditor/CaptionEditor.d.ts +3 -3
- package/lib/drawing/captionEditor/CaptionEditor.d.ts.map +1 -1
- package/lib/drawing/captionEditor/CaptionEditor.js +8 -4
- package/lib/drawing/captionEditor/CaptionEditor.js.map +1 -1
- package/lib/drawing/captionEditor/CaptionToolbar.d.ts +4 -2
- package/lib/drawing/captionEditor/CaptionToolbar.d.ts.map +1 -1
- package/lib/drawing/captionEditor/CaptionToolbar.js +6 -4
- package/lib/drawing/captionEditor/CaptionToolbar.js.map +1 -1
- package/lib/drawing/captionEditor/index.d.ts +2 -0
- package/lib/drawing/captionEditor/index.d.ts.map +1 -1
- package/lib/drawing/captionEditor/index.js +1 -0
- package/lib/drawing/captionEditor/index.js.map +1 -1
- package/lib/drawing/captionEditor/toolbarInView.d.ts +40 -0
- package/lib/drawing/captionEditor/toolbarInView.d.ts.map +1 -0
- package/lib/drawing/captionEditor/toolbarInView.js +53 -0
- package/lib/drawing/captionEditor/toolbarInView.js.map +1 -0
- package/lib/drawing/core/camera.d.ts +2 -0
- package/lib/drawing/core/camera.d.ts.map +1 -1
- package/lib/drawing/core/camera.js +2 -0
- package/lib/drawing/core/camera.js.map +1 -1
- package/lib/drawing/core/index.d.ts +1 -1
- package/lib/drawing/core/index.d.ts.map +1 -1
- package/lib/drawing/core/index.js +1 -1
- package/lib/drawing/core/index.js.map +1 -1
- package/lib/drawing/render/index.d.ts +1 -1
- package/lib/drawing/render/index.d.ts.map +1 -1
- package/lib/drawing/render/index.js +1 -1
- package/lib/drawing/render/index.js.map +1 -1
- package/lib/drawing/render/pageGrid.d.ts +16 -0
- package/lib/drawing/render/pageGrid.d.ts.map +1 -1
- package/lib/drawing/render/pageGrid.js +28 -10
- package/lib/drawing/render/pageGrid.js.map +1 -1
- package/lib/drawing/ui/PageField.d.ts +29 -0
- package/lib/drawing/ui/PageField.d.ts.map +1 -0
- package/lib/drawing/ui/PageField.js +38 -0
- package/lib/drawing/ui/PageField.js.map +1 -0
- package/lib/drawing/ui/PageGrid.d.ts +20 -0
- package/lib/drawing/ui/PageGrid.d.ts.map +1 -0
- package/lib/drawing/ui/PageGrid.js +26 -0
- package/lib/drawing/ui/PageGrid.js.map +1 -0
- package/lib/drawing/ui/PageSideInput.d.ts +28 -0
- package/lib/drawing/ui/PageSideInput.d.ts.map +1 -0
- package/lib/drawing/ui/PageSideInput.js +47 -0
- package/lib/drawing/ui/PageSideInput.js.map +1 -0
- package/lib/drawing/ui/PageToolbar.d.ts +16 -0
- package/lib/drawing/ui/PageToolbar.d.ts.map +1 -0
- package/lib/drawing/ui/PageToolbar.js +16 -0
- package/lib/drawing/ui/PageToolbar.js.map +1 -0
- package/lib/drawing/ui/PrintSheets.d.ts +32 -0
- package/lib/drawing/ui/PrintSheets.d.ts.map +1 -0
- package/lib/drawing/ui/PrintSheets.js +17 -0
- package/lib/drawing/ui/PrintSheets.js.map +1 -0
- package/lib/drawing/ui/TextToolIcon.d.ts +19 -0
- package/lib/drawing/ui/TextToolIcon.d.ts.map +1 -0
- package/lib/drawing/ui/TextToolIcon.js +21 -0
- package/lib/drawing/ui/TextToolIcon.js.map +1 -0
- package/lib/drawing/ui/ZoomControl.d.ts +25 -0
- package/lib/drawing/ui/ZoomControl.d.ts.map +1 -0
- package/lib/drawing/ui/ZoomControl.js +27 -0
- package/lib/drawing/ui/ZoomControl.js.map +1 -0
- package/lib/drawing/ui/index.d.ts +10 -0
- package/lib/drawing/ui/index.d.ts.map +1 -1
- package/lib/drawing/ui/index.js +7 -0
- package/lib/drawing/ui/index.js.map +1 -1
- package/lib/guide/ui/EmptyGuide.d.ts +5 -2
- package/lib/guide/ui/EmptyGuide.d.ts.map +1 -1
- package/lib/guide/ui/EmptyGuide.js +8 -3
- package/lib/guide/ui/EmptyGuide.js.map +1 -1
- package/lib/guide/ui/GuideFigures.d.ts +6 -0
- package/lib/guide/ui/GuideFigures.d.ts.map +1 -1
- package/lib/guide/ui/GuideFigures.js +5 -5
- package/lib/guide/ui/GuideFigures.js.map +1 -1
- package/lib/host/core/index.d.ts +2 -0
- package/lib/host/core/index.d.ts.map +1 -1
- package/lib/host/core/index.js +1 -0
- package/lib/host/core/index.js.map +1 -1
- package/lib/host/core/kinds.d.ts +6 -1
- package/lib/host/core/kinds.d.ts.map +1 -1
- package/lib/host/core/kinds.js +4 -1
- package/lib/host/core/kinds.js.map +1 -1
- package/lib/host/core/recordKinds.d.ts +165 -0
- package/lib/host/core/recordKinds.d.ts.map +1 -0
- package/lib/host/core/recordKinds.js +68 -0
- package/lib/host/core/recordKinds.js.map +1 -0
- package/lib/mass/core/index.d.ts +1 -0
- package/lib/mass/core/index.d.ts.map +1 -1
- package/lib/mass/core/index.js +1 -0
- package/lib/mass/core/index.js.map +1 -1
- package/lib/mass/core/massDomain.d.ts.map +1 -1
- package/lib/mass/core/massDomain.js +9 -5
- package/lib/mass/core/massDomain.js.map +1 -1
- package/lib/mass/core/massSpectrum.d.ts +9 -0
- package/lib/mass/core/massSpectrum.d.ts.map +1 -1
- package/lib/mass/core/massSpectrum.js.map +1 -1
- package/lib/mass/core/verticalScale.d.ts +30 -0
- package/lib/mass/core/verticalScale.d.ts.map +1 -0
- package/lib/mass/core/verticalScale.js +40 -0
- package/lib/mass/core/verticalScale.js.map +1 -0
- package/lib/mass/ui/MassChart.d.ts.map +1 -1
- package/lib/mass/ui/MassChart.js +4 -38
- package/lib/mass/ui/MassChart.js.map +1 -1
- package/lib/mass/ui/massChartLayers.d.ts +31 -0
- package/lib/mass/ui/massChartLayers.d.ts.map +1 -0
- package/lib/mass/ui/massChartLayers.js +57 -0
- package/lib/mass/ui/massChartLayers.js.map +1 -0
- package/lib/structure/core/index.d.ts +1 -1
- package/lib/structure/core/index.d.ts.map +1 -1
- package/lib/structure/core/index.js.map +1 -1
- package/lib/structure/core/structurePicture.d.ts +32 -1
- package/lib/structure/core/structurePicture.d.ts.map +1 -1
- package/lib/structure/core/structurePicture.js +29 -2
- package/lib/structure/core/structurePicture.js.map +1 -1
- package/lib/structure/ui/StructureEditor.d.ts +2 -1
- package/lib/structure/ui/StructureEditor.d.ts.map +1 -1
- package/lib/structure/ui/StructureEditor.js +9 -3
- package/lib/structure/ui/StructureEditor.js.map +1 -1
- package/lib/structure/ui/StructureEditorGuide.d.ts +15 -0
- package/lib/structure/ui/StructureEditorGuide.d.ts.map +1 -0
- package/lib/structure/ui/StructureEditorGuide.js +26 -0
- package/lib/structure/ui/StructureEditorGuide.js.map +1 -0
- package/lib/structure/ui/structureEditorProps.d.ts +11 -1
- package/lib/structure/ui/structureEditorProps.d.ts.map +1 -1
- package/lib/structure/ui/useCanvasPress.d.ts +23 -0
- package/lib/structure/ui/useCanvasPress.d.ts.map +1 -0
- package/lib/structure/ui/useCanvasPress.js +53 -0
- package/lib/structure/ui/useCanvasPress.js.map +1 -0
- package/lib/xps/core/detectFormat.d.ts +6 -0
- package/lib/xps/core/detectFormat.d.ts.map +1 -1
- package/lib/xps/core/detectFormat.js +8 -0
- package/lib/xps/core/detectFormat.js.map +1 -1
- package/lib/xps/core/xpsEditorApi.d.ts +16 -0
- package/lib/xps/core/xpsEditorApi.d.ts.map +1 -1
- package/lib/xps/ui/XpsCanvas.d.ts +10 -1
- package/lib/xps/ui/XpsCanvas.d.ts.map +1 -1
- package/lib/xps/ui/XpsCanvas.js +14 -3
- package/lib/xps/ui/XpsCanvas.js.map +1 -1
- package/lib/xps/ui/XpsChart.d.ts.map +1 -1
- package/lib/xps/ui/XpsChart.js +12 -43
- package/lib/xps/ui/XpsChart.js.map +1 -1
- package/lib/xps/ui/XpsEditor.d.ts +8 -0
- package/lib/xps/ui/XpsEditor.d.ts.map +1 -1
- package/lib/xps/ui/XpsEditor.js +2 -2
- package/lib/xps/ui/XpsEditor.js.map +1 -1
- package/lib/xps/ui/XpsShell.d.ts +5 -0
- package/lib/xps/ui/XpsShell.d.ts.map +1 -1
- package/lib/xps/ui/XpsShell.js +18 -4
- package/lib/xps/ui/XpsShell.js.map +1 -1
- package/lib/xps/ui/dropEvents.d.ts +8 -1
- package/lib/xps/ui/dropEvents.d.ts.map +1 -1
- package/lib/xps/ui/dropEvents.js +15 -1
- package/lib/xps/ui/dropEvents.js.map +1 -1
- package/lib/xps/ui/useSpectrumDrop.d.ts +6 -0
- package/lib/xps/ui/useSpectrumDrop.d.ts.map +1 -1
- package/lib/xps/ui/useSpectrumDrop.js +1 -1
- package/lib/xps/ui/useSpectrumDrop.js.map +1 -1
- package/lib/xps/ui/useXpsEditorHandle.d.ts +4 -1
- package/lib/xps/ui/useXpsEditorHandle.d.ts.map +1 -1
- package/lib/xps/ui/useXpsEditorHandle.js +6 -2
- package/lib/xps/ui/useXpsEditorHandle.js.map +1 -1
- package/lib/xps/ui/useXpsReadout.d.ts +43 -0
- package/lib/xps/ui/useXpsReadout.d.ts.map +1 -0
- package/lib/xps/ui/useXpsReadout.js +59 -0
- package/lib/xps/ui/useXpsReadout.js.map +1 -0
- package/lib/xps/ui/xpsChartProps.d.ts +9 -0
- package/lib/xps/ui/xpsChartProps.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/drawing/captionEditor/CaptionEditor.tsx +8 -3
- package/src/drawing/captionEditor/CaptionToolbar.tsx +18 -2
- package/src/drawing/captionEditor/index.ts +2 -0
- package/src/drawing/captionEditor/toolbarInView.ts +73 -0
- package/src/drawing/core/camera.ts +3 -0
- package/src/drawing/core/index.ts +1 -0
- package/src/drawing/render/index.ts +2 -0
- package/src/drawing/render/pageGrid.ts +29 -11
- package/src/drawing/ui/PageField.tsx +104 -0
- package/src/drawing/ui/PageGrid.tsx +48 -0
- package/src/drawing/ui/PageSideInput.tsx +81 -0
- package/src/drawing/ui/PageToolbar.tsx +45 -0
- package/src/drawing/ui/PrintSheets.tsx +57 -0
- package/src/drawing/ui/TextToolIcon.tsx +48 -0
- package/src/drawing/ui/ZoomControl.tsx +112 -0
- package/src/drawing/ui/index.ts +10 -0
- package/src/guide/ui/EmptyGuide.tsx +20 -13
- package/src/guide/ui/GuideFigures.tsx +15 -4
- package/src/host/core/index.ts +7 -0
- package/src/host/core/kinds.ts +7 -2
- package/src/host/core/recordKinds.ts +144 -0
- package/src/mass/core/index.ts +1 -0
- package/src/mass/core/massDomain.ts +9 -3
- package/src/mass/core/massSpectrum.ts +9 -0
- package/src/mass/core/verticalScale.ts +48 -0
- package/src/mass/ui/MassChart.tsx +12 -43
- package/src/mass/ui/massChartLayers.ts +66 -0
- package/src/structure/core/index.ts +1 -0
- package/src/structure/core/structurePicture.ts +78 -4
- package/src/structure/ui/StructureEditor.tsx +13 -2
- package/src/structure/ui/StructureEditorGuide.tsx +35 -0
- package/src/structure/ui/structureEditorProps.ts +11 -1
- package/src/structure/ui/useCanvasPress.ts +69 -0
- package/src/xps/core/detectFormat.ts +9 -0
- package/src/xps/core/xpsEditorApi.ts +16 -0
- package/src/xps/ui/XpsCanvas.tsx +26 -3
- package/src/xps/ui/XpsChart.tsx +12 -56
- package/src/xps/ui/XpsEditor.tsx +10 -0
- package/src/xps/ui/XpsShell.tsx +37 -7
- package/src/xps/ui/dropEvents.ts +16 -1
- package/src/xps/ui/useSpectrumDrop.ts +7 -1
- package/src/xps/ui/useXpsEditorHandle.ts +12 -2
- package/src/xps/ui/useXpsReadout.ts +104 -0
- package/src/xps/ui/xpsChartProps.ts +9 -0
- package/styles/caption-editor.css +15 -1
- package/styles/chrome.css +130 -9
- package/styles/drawing.css +100 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { FormGroup, HTMLSelect, SegmentedControl } from '@blueprintjs/core';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { Orientation } from '../core/pages.ts';
|
|
5
|
+
import {
|
|
6
|
+
PAGE_SIZES,
|
|
7
|
+
orientationOf,
|
|
8
|
+
pickedPage,
|
|
9
|
+
samePaper,
|
|
10
|
+
turnedTo,
|
|
11
|
+
} from '../core/pages.ts';
|
|
12
|
+
import type { DrawPage } from '../core/types.ts';
|
|
13
|
+
|
|
14
|
+
import { PageSideInput } from './PageSideInput.tsx';
|
|
15
|
+
|
|
16
|
+
const CUSTOM = 'custom';
|
|
17
|
+
|
|
18
|
+
/** How a new size of page was asked for. */
|
|
19
|
+
export type PageChange = 'picked' | 'typed';
|
|
20
|
+
|
|
21
|
+
/** What {@link PageField} is given. */
|
|
22
|
+
export interface PageFieldProps {
|
|
23
|
+
/** The paper or the slide the drawing is laid out on. */
|
|
24
|
+
page: DrawPage;
|
|
25
|
+
/**
|
|
26
|
+
* Called with the page asked for, its place left to the editor: `picked`
|
|
27
|
+
* from the menu or turned, after which the whole page is usually framed, or
|
|
28
|
+
* `typed` side by side.
|
|
29
|
+
*/
|
|
30
|
+
onChange: (page: DrawPage, how: PageChange) => void;
|
|
31
|
+
/**
|
|
32
|
+
* What is said under the fields, such as `pagesLine`'s count of sheets.
|
|
33
|
+
* @default undefined — nothing
|
|
34
|
+
*/
|
|
35
|
+
helperText?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The page setup of an editor, the same in every one of the family: the paper
|
|
40
|
+
* or the slide the drawing is laid out on, portrait or landscape, and its two
|
|
41
|
+
* sides in centimetres. `react-cheminfo/styles/drawing.css` lays it out.
|
|
42
|
+
* @param props - See {@link PageFieldProps}.
|
|
43
|
+
* @returns A row of a form.
|
|
44
|
+
*/
|
|
45
|
+
export function PageField(props: PageFieldProps): ReactElement {
|
|
46
|
+
const { page, onChange, helperText } = props;
|
|
47
|
+
const matched = PAGE_SIZES.find((paper) => samePaper(paper.size, page));
|
|
48
|
+
return (
|
|
49
|
+
<FormGroup label="Page" helperText={helperText}>
|
|
50
|
+
<HTMLSelect
|
|
51
|
+
iconName="caret-down"
|
|
52
|
+
fill
|
|
53
|
+
value={matched?.id ?? CUSTOM}
|
|
54
|
+
aria-label="Page size"
|
|
55
|
+
options={[
|
|
56
|
+
...PAGE_SIZES.map((paper) => ({
|
|
57
|
+
value: paper.id,
|
|
58
|
+
label: paper.name,
|
|
59
|
+
})),
|
|
60
|
+
...(matched ? [] : [{ value: CUSTOM, label: 'Another size' }]),
|
|
61
|
+
]}
|
|
62
|
+
onChange={(event) => {
|
|
63
|
+
const { value } = event.currentTarget;
|
|
64
|
+
const chosen = PAGE_SIZES.find((paper) => paper.id === value);
|
|
65
|
+
if (chosen) onChange(pickedPage(chosen.size, page), 'picked');
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
{page.width === page.height ? null : (
|
|
69
|
+
<SegmentedControl
|
|
70
|
+
className="page-field__orientation"
|
|
71
|
+
aria-label="Page orientation"
|
|
72
|
+
size="small"
|
|
73
|
+
fill
|
|
74
|
+
value={orientationOf(page)}
|
|
75
|
+
options={[
|
|
76
|
+
{ label: 'Portrait', value: 'portrait' },
|
|
77
|
+
{ label: 'Landscape', value: 'landscape' },
|
|
78
|
+
]}
|
|
79
|
+
onValueChange={(orientation) => {
|
|
80
|
+
onChange(turnedTo(page, orientation as Orientation), 'picked');
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
84
|
+
<div className="page-field__size">
|
|
85
|
+
<PageSideInput
|
|
86
|
+
label="Page width"
|
|
87
|
+
value={page.width}
|
|
88
|
+
onChange={(width) => {
|
|
89
|
+
onChange({ ...page, width }, 'typed');
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
<span aria-hidden="true">×</span>
|
|
93
|
+
<PageSideInput
|
|
94
|
+
label="Page height"
|
|
95
|
+
value={page.height}
|
|
96
|
+
onChange={(height) => {
|
|
97
|
+
onChange({ ...page, height }, 'typed');
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
<span className="page-field__unit">cm</span>
|
|
101
|
+
</div>
|
|
102
|
+
</FormGroup>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Box } from '../core/types.ts';
|
|
4
|
+
import { sheetLines } from '../render/pageGrid.ts';
|
|
5
|
+
|
|
6
|
+
/** The size of a sheet's number on screen, in pixels. */
|
|
7
|
+
const NUMBER_SIZE = 11;
|
|
8
|
+
|
|
9
|
+
/** How far a sheet's number stands from its corner, in pixels. */
|
|
10
|
+
const NUMBER_INSET = 6;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The lines of a grid of sheets across an unlimited canvas, and the number each
|
|
14
|
+
* sheet that holds something prints under. They never print themselves, and
|
|
15
|
+
* the pointer goes through them to what is drawn.
|
|
16
|
+
* `react-cheminfo/styles/drawing.css` draws them.
|
|
17
|
+
* @param props - The sheets and the view.
|
|
18
|
+
* @param props.sheets - The sheets that hold something, in reading order, as
|
|
19
|
+
* `pageSheets` lists them; empty when the page lines are hidden.
|
|
20
|
+
* @param props.visible - The box the view shows, in points.
|
|
21
|
+
* @param props.pixel - A screen pixel, in points.
|
|
22
|
+
* @returns The grid, or nothing.
|
|
23
|
+
*/
|
|
24
|
+
export function PageGrid(props: {
|
|
25
|
+
sheets: readonly Box[];
|
|
26
|
+
visible: Box;
|
|
27
|
+
pixel: number;
|
|
28
|
+
}): ReactElement | null {
|
|
29
|
+
const { sheets, visible, pixel } = props;
|
|
30
|
+
const [first] = sheets;
|
|
31
|
+
if (!first) return null;
|
|
32
|
+
return (
|
|
33
|
+
<g data-testid="draw-page-grid" className="no-print" aria-hidden="true">
|
|
34
|
+
<path className="draw-sheet" d={sheetLines(first, visible)} />
|
|
35
|
+
{sheets.map((sheet, index) => (
|
|
36
|
+
<text
|
|
37
|
+
key={`${sheet.x} ${sheet.y}`}
|
|
38
|
+
className="draw-sheet__number"
|
|
39
|
+
x={sheet.x + NUMBER_INSET * pixel}
|
|
40
|
+
y={sheet.y + (NUMBER_INSET + NUMBER_SIZE) * pixel}
|
|
41
|
+
fontSize={NUMBER_SIZE * pixel}
|
|
42
|
+
>
|
|
43
|
+
{`Page ${index + 1}`}
|
|
44
|
+
</text>
|
|
45
|
+
))}
|
|
46
|
+
</g>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import { NumberInput } from '../../number/ui/NumberInput.tsx';
|
|
4
|
+
import { PAGE_LIMITS, POINTS_PER_CM } from '../core/pages.ts';
|
|
5
|
+
|
|
6
|
+
const MIN_SIDE = PAGE_LIMITS.min / POINTS_PER_CM;
|
|
7
|
+
const MAX_SIDE = PAGE_LIMITS.max / POINTS_PER_CM;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A side of a sheet of paper, in centimetres.
|
|
11
|
+
* @param props - The side.
|
|
12
|
+
* @param props.label - Its name.
|
|
13
|
+
* @param props.value - Its length in points.
|
|
14
|
+
* @param props.onChange - Called with the length in points.
|
|
15
|
+
* @returns The field.
|
|
16
|
+
*/
|
|
17
|
+
export function PageSideInput(props: {
|
|
18
|
+
label: string;
|
|
19
|
+
value: number;
|
|
20
|
+
onChange: (side: number) => void;
|
|
21
|
+
}): ReactElement {
|
|
22
|
+
const { label, value, onChange } = props;
|
|
23
|
+
return (
|
|
24
|
+
<NumberInput
|
|
25
|
+
size="small"
|
|
26
|
+
buttons={false}
|
|
27
|
+
ariaLabel={`${label}, in centimetres`}
|
|
28
|
+
value={round(value / POINTS_PER_CM)}
|
|
29
|
+
min={MIN_SIDE}
|
|
30
|
+
max={MAX_SIDE}
|
|
31
|
+
step={0.1}
|
|
32
|
+
onChange={(centimetres: number) => {
|
|
33
|
+
if (fits(centimetres)) onChange(centimetres * POINTS_PER_CM);
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A side of a figure in centimetres; emptied, it fits the drawing.
|
|
41
|
+
* @param props - The side.
|
|
42
|
+
* @param props.label - Its name.
|
|
43
|
+
* @param props.value - Its length in points, when it is set.
|
|
44
|
+
* @param props.onChange - Called with the length in points, or undefined.
|
|
45
|
+
* @returns The field.
|
|
46
|
+
*/
|
|
47
|
+
export function FigureSideInput(props: {
|
|
48
|
+
label: string;
|
|
49
|
+
value: number | undefined;
|
|
50
|
+
onChange: (side: number | undefined) => void;
|
|
51
|
+
}): ReactElement {
|
|
52
|
+
const { label, value, onChange } = props;
|
|
53
|
+
return (
|
|
54
|
+
<NumberInput
|
|
55
|
+
size="small"
|
|
56
|
+
buttons={false}
|
|
57
|
+
allowEmpty
|
|
58
|
+
ariaLabel={`${label}, in centimetres; empty fits the drawing`}
|
|
59
|
+
placeholder="fits"
|
|
60
|
+
value={value === undefined ? undefined : round(value / POINTS_PER_CM)}
|
|
61
|
+
min={MIN_SIDE}
|
|
62
|
+
max={MAX_SIDE}
|
|
63
|
+
step={0.1}
|
|
64
|
+
onChange={(centimetres: number | undefined) => {
|
|
65
|
+
if (centimetres === undefined) onChange(undefined);
|
|
66
|
+
else if (fits(centimetres)) onChange(centimetres * POINTS_PER_CM);
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// A side typed halfway (the 2 of 21) waits for the next digit rather than being
|
|
73
|
+
// raised to the smallest side under the caret.
|
|
74
|
+
function fits(centimetres: number): boolean {
|
|
75
|
+
return centimetres >= MIN_SIDE && centimetres <= MAX_SIDE;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// To the hundredth, so a side typed to the millimetre reads back as typed.
|
|
79
|
+
function round(value: number): number {
|
|
80
|
+
return Math.round(value * 100) / 100;
|
|
81
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { Toolbar, TooltipHelpContent } from 'react-science/ui';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The toolbar of an editor's page setup panel: the page grid shown or hidden,
|
|
6
|
+
* and the whole of the pages brought into view.
|
|
7
|
+
* @param props - Whether the lines are shown, and what the buttons do.
|
|
8
|
+
* @param props.shown - Whether the page lines are on the canvas.
|
|
9
|
+
* @param props.onToggle - Show the lines, or hide them.
|
|
10
|
+
* @param props.onFrame - Bring every page that holds something into view.
|
|
11
|
+
* @returns The toolbar.
|
|
12
|
+
*/
|
|
13
|
+
export function PageToolbar(props: {
|
|
14
|
+
shown: boolean;
|
|
15
|
+
onToggle: () => void;
|
|
16
|
+
onFrame: () => void;
|
|
17
|
+
}): ReactElement {
|
|
18
|
+
const { shown, onToggle, onFrame } = props;
|
|
19
|
+
return (
|
|
20
|
+
<div className="panel-toolbar">
|
|
21
|
+
<Toolbar aria-label="Page setup">
|
|
22
|
+
<Toolbar.Item
|
|
23
|
+
icon="grid"
|
|
24
|
+
active={shown}
|
|
25
|
+
tooltip={
|
|
26
|
+
<TooltipHelpContent
|
|
27
|
+
title="Page grid"
|
|
28
|
+
description="Shown, the lines mark the pages and printing follows them. Hidden, the whole drawing prints on one page."
|
|
29
|
+
/>
|
|
30
|
+
}
|
|
31
|
+
aria-label="Page grid"
|
|
32
|
+
onClick={onToggle}
|
|
33
|
+
/>
|
|
34
|
+
{shown ? (
|
|
35
|
+
<Toolbar.Item
|
|
36
|
+
icon="zoom-to-fit"
|
|
37
|
+
tooltip="Show the whole page"
|
|
38
|
+
aria-label="Show the whole page"
|
|
39
|
+
onClick={onFrame}
|
|
40
|
+
/>
|
|
41
|
+
) : null}
|
|
42
|
+
</Toolbar>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Box, DrawPage } from '../core/types.ts';
|
|
4
|
+
|
|
5
|
+
/** What {@link PrintSheets} is given. */
|
|
6
|
+
export interface PrintSheetsProps {
|
|
7
|
+
/** The paper the drawing is laid out on. */
|
|
8
|
+
page: DrawPage;
|
|
9
|
+
/**
|
|
10
|
+
* What goes on paper: the sheets of the page grid that hold something, or
|
|
11
|
+
* the one box of the whole figure when the grid is hidden.
|
|
12
|
+
*/
|
|
13
|
+
boxes: readonly Box[];
|
|
14
|
+
/** Whether the boxes are sheets of the paper, each filling one. */
|
|
15
|
+
paged: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The figure, drawn in points, for one box: the same drawing for each, the
|
|
18
|
+
* box being what the sheet shows of it.
|
|
19
|
+
*/
|
|
20
|
+
figure: (box: Box) => ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The drawing as it goes on paper, in place of the editor: the figure and
|
|
25
|
+
* nothing else, sized in points, so it prints at the size it was laid out at.
|
|
26
|
+
* With the page grid showing, one sheet of the paper goes to each sheet of the
|
|
27
|
+
* grid that holds something, edge to edge; with the grid hidden, the whole
|
|
28
|
+
* figure goes on one sheet of it, shrunk only when it would not fit. An editor
|
|
29
|
+
* mounts it while `usePrinting` says the page is printed;
|
|
30
|
+
* `react-cheminfo/styles/drawing.css` hides it on screen.
|
|
31
|
+
* @param props - See {@link PrintSheetsProps}.
|
|
32
|
+
* @returns The sheets.
|
|
33
|
+
*/
|
|
34
|
+
export function PrintSheets(props: PrintSheetsProps): ReactElement {
|
|
35
|
+
const { page, boxes, paged, figure } = props;
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={paged ? 'draw-print draw-print--sheets' : 'draw-print'}
|
|
39
|
+
data-testid="print-figure"
|
|
40
|
+
>
|
|
41
|
+
<style>
|
|
42
|
+
{`@page { size: ${page.width}pt ${page.height}pt;${paged ? ' margin: 0;' : ''} }`}
|
|
43
|
+
</style>
|
|
44
|
+
{boxes.map((box) => (
|
|
45
|
+
<svg
|
|
46
|
+
key={`${box.x} ${box.y}`}
|
|
47
|
+
className="draw-print__figure"
|
|
48
|
+
width={`${box.width}pt`}
|
|
49
|
+
height={`${box.height}pt`}
|
|
50
|
+
viewBox={`${box.x} ${box.y} ${box.width} ${box.height}`}
|
|
51
|
+
>
|
|
52
|
+
{figure(box)}
|
|
53
|
+
</svg>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The letter the text tool is drawn with, on a 16-unit square: a serif bold T,
|
|
5
|
+
* for an icon set that draws its own `<svg>` around each glyph.
|
|
6
|
+
* @returns The glyph.
|
|
7
|
+
*/
|
|
8
|
+
export function TextToolGlyph(): ReactElement {
|
|
9
|
+
return (
|
|
10
|
+
<text
|
|
11
|
+
x="8"
|
|
12
|
+
y="12.5"
|
|
13
|
+
textAnchor="middle"
|
|
14
|
+
fontSize="12"
|
|
15
|
+
fontWeight="700"
|
|
16
|
+
fontFamily="Georgia, serif"
|
|
17
|
+
fill="currentColor"
|
|
18
|
+
stroke="none"
|
|
19
|
+
>
|
|
20
|
+
T
|
|
21
|
+
</text>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The icon of the text tool, the same in every editor of the family, in the
|
|
27
|
+
* colour of the text around it.
|
|
28
|
+
* @param props - Its size.
|
|
29
|
+
* @param props.size - Its width and height, in pixels.
|
|
30
|
+
* @returns The icon.
|
|
31
|
+
*/
|
|
32
|
+
export function TextToolIcon(props: {
|
|
33
|
+
/** @default 16 */
|
|
34
|
+
size?: number;
|
|
35
|
+
}): ReactElement {
|
|
36
|
+
const { size = 16 } = props;
|
|
37
|
+
return (
|
|
38
|
+
<svg
|
|
39
|
+
className="tool-icon"
|
|
40
|
+
width={size}
|
|
41
|
+
height={size}
|
|
42
|
+
viewBox="0 0 16 16"
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
>
|
|
45
|
+
<TextToolGlyph />
|
|
46
|
+
</svg>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
Menu,
|
|
4
|
+
MenuItem,
|
|
5
|
+
PopoverNext,
|
|
6
|
+
Tooltip,
|
|
7
|
+
} from '@blueprintjs/core';
|
|
8
|
+
import type { ReactElement } from 'react';
|
|
9
|
+
import { TooltipHelpContent } from 'react-science/ui';
|
|
10
|
+
|
|
11
|
+
import { formatPercent } from '../../format/core/numbers.ts';
|
|
12
|
+
import { ZOOM_PRESETS, ZOOM_RANGE, zoomShare } from '../core/camera.ts';
|
|
13
|
+
|
|
14
|
+
import { MeasuredSlider } from './MeasuredSlider.tsx';
|
|
15
|
+
|
|
16
|
+
/** What {@link ZoomControl} is given. */
|
|
17
|
+
export interface ZoomControlProps {
|
|
18
|
+
/** How close the view is: the camera's screen pixels per point. */
|
|
19
|
+
zoom: number;
|
|
20
|
+
/** Called with the share of the printed size asked for: 1 at 100 %. */
|
|
21
|
+
onZoomShare: (share: number) => void;
|
|
22
|
+
/** Called to bring the whole drawing back into view. */
|
|
23
|
+
onFit: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* What fitting brings into view, said in the fit button's tooltip.
|
|
26
|
+
* @default 'Brings the whole drawing back into view.'
|
|
27
|
+
*/
|
|
28
|
+
fitDescription?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The zoom at the right of an editor's status bar, the same in every editor of
|
|
33
|
+
* the family: a slider from 25 % to 1600 % of the printed size, running on the
|
|
34
|
+
* logarithm so each step is the same factor; the value, which opens a menu of
|
|
35
|
+
* the usual zooms; and zoom to fit, on `f`.
|
|
36
|
+
* @param props - See {@link ZoomControlProps}.
|
|
37
|
+
* @returns The control.
|
|
38
|
+
*/
|
|
39
|
+
export function ZoomControl(props: ZoomControlProps): ReactElement {
|
|
40
|
+
const {
|
|
41
|
+
zoom,
|
|
42
|
+
onZoomShare,
|
|
43
|
+
onFit,
|
|
44
|
+
fitDescription = 'Brings the whole drawing back into view.',
|
|
45
|
+
} = props;
|
|
46
|
+
const share = zoomShare(zoom);
|
|
47
|
+
return (
|
|
48
|
+
<span className="zoom-control">
|
|
49
|
+
<MeasuredSlider
|
|
50
|
+
min={Math.log2(ZOOM_RANGE.min)}
|
|
51
|
+
max={Math.log2(ZOOM_RANGE.max)}
|
|
52
|
+
initialValue={Math.log2(ZOOM_RANGE.min)}
|
|
53
|
+
stepSize={0.01}
|
|
54
|
+
labelRenderer={false}
|
|
55
|
+
value={Math.log2(share)}
|
|
56
|
+
onChange={(value) => {
|
|
57
|
+
onZoomShare(2 ** value);
|
|
58
|
+
}}
|
|
59
|
+
handleHtmlProps={{ 'aria-label': 'Zoom' }}
|
|
60
|
+
/>
|
|
61
|
+
<PopoverNext
|
|
62
|
+
placement="top-end"
|
|
63
|
+
content={
|
|
64
|
+
<Menu aria-label="Zoom">
|
|
65
|
+
{ZOOM_PRESETS.map((preset) => (
|
|
66
|
+
<MenuItem
|
|
67
|
+
key={preset}
|
|
68
|
+
text={formatPercent(preset, 0)}
|
|
69
|
+
active={Math.abs(preset - share) < 0.005}
|
|
70
|
+
onClick={() => {
|
|
71
|
+
onZoomShare(preset);
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
))}
|
|
75
|
+
</Menu>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<Button
|
|
79
|
+
className="zoom-control__level"
|
|
80
|
+
variant="minimal"
|
|
81
|
+
size="small"
|
|
82
|
+
text={formatPercent(share, 0)}
|
|
83
|
+
endIcon="caret-up"
|
|
84
|
+
aria-label="Zoom level"
|
|
85
|
+
/>
|
|
86
|
+
</PopoverNext>
|
|
87
|
+
<Tooltip
|
|
88
|
+
placement="top"
|
|
89
|
+
hoverOpenDelay={400}
|
|
90
|
+
content={
|
|
91
|
+
<TooltipHelpContent
|
|
92
|
+
title="Zoom to fit"
|
|
93
|
+
description={fitDescription}
|
|
94
|
+
shortcuts={['f']}
|
|
95
|
+
subTitles={[
|
|
96
|
+
{ title: 'Zoom in and out', shortcuts: ['Wheel', '+', '-'] },
|
|
97
|
+
{ title: 'Move the view', shortcuts: ['Right-drag'] },
|
|
98
|
+
]}
|
|
99
|
+
/>
|
|
100
|
+
}
|
|
101
|
+
>
|
|
102
|
+
<Button
|
|
103
|
+
variant="minimal"
|
|
104
|
+
size="small"
|
|
105
|
+
icon="zoom-to-fit"
|
|
106
|
+
aria-label="Fit the drawing in view"
|
|
107
|
+
onClick={onFit}
|
|
108
|
+
/>
|
|
109
|
+
</Tooltip>
|
|
110
|
+
</span>
|
|
111
|
+
);
|
|
112
|
+
}
|
package/src/drawing/ui/index.ts
CHANGED
|
@@ -48,13 +48,23 @@ export {
|
|
|
48
48
|
useFigureMoves,
|
|
49
49
|
useMovingFigureSource,
|
|
50
50
|
} from './movingFigure.ts';
|
|
51
|
+
export type { PageChange, PageFieldProps } from './PageField.tsx';
|
|
52
|
+
export { PageField } from './PageField.tsx';
|
|
53
|
+
export { PageGrid } from './PageGrid.tsx';
|
|
51
54
|
export { PageMask } from './PageMask.tsx';
|
|
55
|
+
export { FigureSideInput, PageSideInput } from './PageSideInput.tsx';
|
|
56
|
+
export { PageToolbar } from './PageToolbar.tsx';
|
|
52
57
|
export type { LineWidthStyle } from './pathProps.ts';
|
|
53
58
|
export { fillProps, strokeProps } from './pathProps.ts';
|
|
54
59
|
export { PathView } from './PathView.tsx';
|
|
60
|
+
export type { PrintSheetsProps } from './PrintSheets.tsx';
|
|
61
|
+
export { PrintSheets } from './PrintSheets.tsx';
|
|
55
62
|
export { releaseFocusOnPress } from './releaseFocusOnPress.ts';
|
|
56
63
|
export { svgMarkup } from './svgMarkup.ts';
|
|
57
64
|
export type { CustomColorButtonProps, SwatchRowProps } from './SwatchRow.tsx';
|
|
58
65
|
export { CustomColorButton, SwatchRow } from './SwatchRow.tsx';
|
|
66
|
+
export { TextToolGlyph, TextToolIcon } from './TextToolIcon.tsx';
|
|
59
67
|
export { usePrinting } from './usePrinting.ts';
|
|
68
|
+
export type { ZoomControlProps } from './ZoomControl.tsx';
|
|
69
|
+
export { ZoomControl } from './ZoomControl.tsx';
|
|
60
70
|
export { useSeen } from '../../hooks/ui/useSeen.ts';
|
|
@@ -93,10 +93,13 @@ export interface EmptyGuideProps {
|
|
|
93
93
|
/**
|
|
94
94
|
* What a tool shows while it holds nothing: the space that is empty anyway says
|
|
95
95
|
* how to start. It comes in grey over the tool, lets the pointer through to it
|
|
96
|
-
* everywhere but on
|
|
97
|
-
*
|
|
96
|
+
* everywhere but on what can be clicked or typed in — a button, a link, a
|
|
97
|
+
* figure that can be clicked, a capsule, a field — and the site stops
|
|
98
|
+
* rendering it at the first stroke.
|
|
98
99
|
*
|
|
99
100
|
* Fill the absolute box of the tool's view with it: the parent is positioned.
|
|
101
|
+
* A small box keeps the figures and says each section's title and first line;
|
|
102
|
+
* a phone-sized one drops the figures.
|
|
100
103
|
* @param props - See {@link EmptyGuideProps}.
|
|
101
104
|
* @returns The guide.
|
|
102
105
|
*/
|
|
@@ -111,19 +114,23 @@ export function EmptyGuide(props: EmptyGuideProps): ReactElement {
|
|
|
111
114
|
figures = [],
|
|
112
115
|
figuresTitle,
|
|
113
116
|
} = props;
|
|
117
|
+
// The body is what the guide's size is asked about: an element cannot query
|
|
118
|
+
// its own container, so the outer box measures and the body is laid out.
|
|
114
119
|
return (
|
|
115
120
|
<div className="empty-guide no-print" data-testid="empty-guide">
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
<div className="empty-guide__body">
|
|
122
|
+
{help ? <div className="empty-guide__help">{help}</div> : null}
|
|
123
|
+
{links && links.length > 0 ? (
|
|
124
|
+
<GuideLinks links={links} title={linksTitle} />
|
|
125
|
+
) : null}
|
|
126
|
+
{actions.length > 0 || figuresTitle ? (
|
|
127
|
+
<GuideStart actions={actions} figuresTitle={figuresTitle} />
|
|
128
|
+
) : null}
|
|
129
|
+
<GuideFigures figures={figures} />
|
|
130
|
+
{hints.length > 0 ? (
|
|
131
|
+
<GuideHint hints={hints} interval={hintInterval} />
|
|
132
|
+
) : null}
|
|
133
|
+
</div>
|
|
127
134
|
</div>
|
|
128
135
|
);
|
|
129
136
|
}
|
|
@@ -21,6 +21,12 @@ export interface EmptyGuideFigure {
|
|
|
21
21
|
* @default undefined — no tooltip
|
|
22
22
|
*/
|
|
23
23
|
title?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Its name, a short line under it: a reader picks an example by what it is
|
|
26
|
+
* called as much as by how it looks.
|
|
27
|
+
* @default undefined — no line
|
|
28
|
+
*/
|
|
29
|
+
label?: string;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
/** Figures one above the other, taking one place in the row between them. */
|
|
@@ -72,12 +78,17 @@ function stackKey(entry: EmptyGuideFigureStack): string {
|
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
function GuideFigure(props: { figure: EmptyGuideFigure }): ReactElement {
|
|
75
|
-
const { src, alt, share = 1, onSelect, title } = props.figure;
|
|
76
|
-
const
|
|
81
|
+
const { src, alt, share = 1, onSelect, title, label } = props.figure;
|
|
82
|
+
const content = (
|
|
83
|
+
<>
|
|
84
|
+
<img src={src} alt={alt} draggable={false} />
|
|
85
|
+
{label ? <span className="empty-guide__label">{label}</span> : null}
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
77
88
|
if (!onSelect) {
|
|
78
89
|
return (
|
|
79
90
|
<figure className="empty-guide__figure" style={{ flexGrow: share }}>
|
|
80
|
-
{
|
|
91
|
+
{content}
|
|
81
92
|
</figure>
|
|
82
93
|
);
|
|
83
94
|
}
|
|
@@ -89,7 +100,7 @@ function GuideFigure(props: { figure: EmptyGuideFigure }): ReactElement {
|
|
|
89
100
|
title={title}
|
|
90
101
|
onClick={onSelect}
|
|
91
102
|
>
|
|
92
|
-
{
|
|
103
|
+
{content}
|
|
93
104
|
</button>
|
|
94
105
|
);
|
|
95
106
|
}
|
package/src/host/core/index.ts
CHANGED
|
@@ -110,6 +110,13 @@ export type { PeptideValue } from './peptideKinds.ts';
|
|
|
110
110
|
export { PEPTIDE_KINDS, PEPTIDE_SCHEMA } from './peptideKinds.ts';
|
|
111
111
|
export type { RxnValue } from './reactionKinds.ts';
|
|
112
112
|
export { REACTION_KINDS, RXN_SCHEMA } from './reactionKinds.ts';
|
|
113
|
+
export type {
|
|
114
|
+
ZenodoCreatorValue,
|
|
115
|
+
ZenodoFileValue,
|
|
116
|
+
ZenodoMetadataValue,
|
|
117
|
+
ZenodoRecordValue,
|
|
118
|
+
} from './recordKinds.ts';
|
|
119
|
+
export { ZENODO_RECORD_SCHEMA } from './recordKinds.ts';
|
|
113
120
|
export type {
|
|
114
121
|
NameValue,
|
|
115
122
|
SvgImageValue,
|
package/src/host/core/kinds.ts
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* ones of `./uvKinds.ts` and the mass
|
|
10
10
|
* spectrometry ones of `./msKinds.ts`, the reaction of `./reactionKinds.ts`,
|
|
11
11
|
* the peptide of `./peptideKinds.ts`, the set of spectra of
|
|
12
|
-
* `./datasetKinds.ts`,
|
|
12
|
+
* `./datasetKinds.ts`, the record about to be published on Zenodo of
|
|
13
|
+
* `./recordKinds.ts`, and
|
|
13
14
|
* the kinds a tool hands back, of `./resultKinds.ts`. A name with children is a category whose
|
|
14
15
|
* schema every child satisfies, so `chem.molfile` reads `chem.molfile.2d` and
|
|
15
16
|
* `chem.molfile.3d.h.energy` alike; the fields a tool does not read are
|
|
@@ -41,6 +42,8 @@ import type { RamanJdxValue, RamanPeaksValue } from './ramanKinds.ts';
|
|
|
41
42
|
import { RAMAN_JDX_SCHEMA, RAMAN_PEAKS_SCHEMA } from './ramanKinds.ts';
|
|
42
43
|
import type { RxnValue } from './reactionKinds.ts';
|
|
43
44
|
import { RXN_SCHEMA } from './reactionKinds.ts';
|
|
45
|
+
import type { ZenodoRecordValue } from './recordKinds.ts';
|
|
46
|
+
import { ZENODO_RECORD_SCHEMA } from './recordKinds.ts';
|
|
44
47
|
import type { NameValue, SvgImageValue, TableValue } from './resultKinds.ts';
|
|
45
48
|
import { NAME_SCHEMA, SVG_IMAGE_SCHEMA, TABLE_SCHEMA } from './resultKinds.ts';
|
|
46
49
|
import type { UvJdxValue, UvPeaksValue } from './uvKinds.ts';
|
|
@@ -81,7 +84,8 @@ export type CheckedValue =
|
|
|
81
84
|
| { kind: 'image.svg'; value: SvgImageValue }
|
|
82
85
|
| { kind: 'chem.name'; value: NameValue }
|
|
83
86
|
| { kind: 'data.table'; value: TableValue }
|
|
84
|
-
| { kind: 'data.spectra'; value: SpectraDatasetValue }
|
|
87
|
+
| { kind: 'data.spectra'; value: SpectraDatasetValue }
|
|
88
|
+
| { kind: 'data.zenodo.record'; value: ZenodoRecordValue };
|
|
85
89
|
|
|
86
90
|
export { kindAccepts } from './kindAccepts.ts';
|
|
87
91
|
|
|
@@ -213,4 +217,5 @@ const VALIDATORS: { [K in KnownKind]: ValidateFunction<ValueOf<K>> } = {
|
|
|
213
217
|
'chem.name': ajv.compile<NameValue>(NAME_SCHEMA),
|
|
214
218
|
'data.table': ajv.compile<TableValue>(TABLE_SCHEMA),
|
|
215
219
|
'data.spectra': ajv.compile<SpectraDatasetValue>(SPECTRA_DATASET_SCHEMA),
|
|
220
|
+
'data.zenodo.record': ajv.compile<ZenodoRecordValue>(ZENODO_RECORD_SCHEMA),
|
|
216
221
|
};
|