react-cheminfo 0.21.0 → 0.23.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 +14 -4
- package/lib/build/vite/gitHead.d.ts.map +1 -1
- package/lib/build/vite/gitHead.js +17 -2
- package/lib/build/vite/gitHead.js.map +1 -1
- package/lib/clipboard/ui/ClickToCopy.d.ts +69 -0
- package/lib/clipboard/ui/ClickToCopy.d.ts.map +1 -0
- package/lib/clipboard/ui/ClickToCopy.js +66 -0
- package/lib/clipboard/ui/ClickToCopy.js.map +1 -0
- package/lib/clipboard/ui/CopyButton.d.ts +1 -1
- package/lib/clipboard/ui/CopyButton.js +1 -1
- package/lib/clipboard/ui/CopyableValue.d.ts +3 -3
- package/lib/clipboard/ui/CopyableValue.d.ts.map +1 -1
- package/lib/clipboard/ui/CopyableValue.js +5 -5
- package/lib/clipboard/ui/CopyableValue.js.map +1 -1
- package/lib/clipboard/ui/index.d.ts +2 -0
- package/lib/clipboard/ui/index.d.ts.map +1 -1
- package/lib/clipboard/ui/index.js +1 -0
- package/lib/clipboard/ui/index.js.map +1 -1
- package/lib/ecosystem/core/groups.d.ts +4 -3
- package/lib/ecosystem/core/groups.d.ts.map +1 -1
- package/lib/ecosystem/core/groups.js +8 -2
- package/lib/ecosystem/core/groups.js.map +1 -1
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +39 -0
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +1 -1
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +9 -0
- package/lib/ecosystem/ui/glyphs.js.map +1 -1
- package/lib/error/ui/ErrorFallback.d.ts.map +1 -1
- package/lib/error/ui/ErrorFallback.js +1 -1
- package/lib/error/ui/ErrorFallback.js.map +1 -1
- package/lib/overlay/core/index.d.ts +2 -2
- package/lib/overlay/core/index.d.ts.map +1 -1
- package/lib/overlay/core/index.js +1 -1
- package/lib/overlay/core/index.js.map +1 -1
- package/lib/overlay/core/overlayMarks.d.ts +20 -5
- package/lib/overlay/core/overlayMarks.d.ts.map +1 -1
- package/lib/overlay/core/overlayMarks.js +31 -5
- package/lib/overlay/core/overlayMarks.js.map +1 -1
- package/lib/overlay/ui/OverlayLegendMark.js +5 -0
- package/lib/overlay/ui/OverlayLegendMark.js.map +1 -1
- package/lib/pedagogy/ui/ReferenceSectionBlock.d.ts.map +1 -1
- package/lib/pedagogy/ui/ReferenceSectionBlock.js +2 -1
- package/lib/pedagogy/ui/ReferenceSectionBlock.js.map +1 -1
- package/lib/projection/core/index.d.ts +4 -4
- package/lib/projection/core/index.d.ts.map +1 -1
- package/lib/projection/core/index.js +2 -2
- package/lib/projection/core/index.js.map +1 -1
- package/lib/projection/core/projectionCopy.d.ts +2 -0
- package/lib/projection/core/projectionCopy.d.ts.map +1 -1
- package/lib/projection/core/projectionCopy.js +1 -0
- package/lib/projection/core/projectionCopy.js.map +1 -1
- package/lib/projection/core/projectionGroupings.d.ts +44 -0
- package/lib/projection/core/projectionGroupings.d.ts.map +1 -0
- package/lib/projection/core/projectionGroupings.js +132 -0
- package/lib/projection/core/projectionGroupings.js.map +1 -0
- package/lib/projection/core/projectionOptions.d.ts +16 -6
- package/lib/projection/core/projectionOptions.d.ts.map +1 -1
- package/lib/projection/core/projectionOptions.js +7 -1
- package/lib/projection/core/projectionOptions.js.map +1 -1
- package/lib/projection/core/projectionPanelWords.d.ts +6 -0
- package/lib/projection/core/projectionPanelWords.d.ts.map +1 -1
- package/lib/projection/core/projectionPanelWords.js +4 -0
- package/lib/projection/core/projectionPanelWords.js.map +1 -1
- package/lib/projection/core/projectionSamples.d.ts +63 -32
- package/lib/projection/core/projectionSamples.d.ts.map +1 -1
- package/lib/projection/core/projectionSamples.js +1 -80
- package/lib/projection/core/projectionSamples.js.map +1 -1
- package/lib/projection/core/projectionStrings.d.ts +2 -0
- package/lib/projection/core/projectionStrings.d.ts.map +1 -1
- package/lib/projection/core/projectionStrings.js +10 -1
- package/lib/projection/core/projectionStrings.js.map +1 -1
- package/lib/projection/core/resolveProjectionOptions.d.ts +8 -3
- package/lib/projection/core/resolveProjectionOptions.d.ts.map +1 -1
- package/lib/projection/core/resolveProjectionOptions.js +58 -5
- package/lib/projection/core/resolveProjectionOptions.js.map +1 -1
- package/lib/projection/ui/ProjectionBar.d.ts +1 -1
- package/lib/projection/ui/ProjectionBar.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionBar.js +3 -1
- package/lib/projection/ui/ProjectionBar.js.map +1 -1
- package/lib/projection/ui/ProjectionGroupingPickers.d.ts +38 -0
- package/lib/projection/ui/ProjectionGroupingPickers.d.ts.map +1 -0
- package/lib/projection/ui/ProjectionGroupingPickers.js +33 -0
- package/lib/projection/ui/ProjectionGroupingPickers.js.map +1 -0
- package/lib/projection/ui/ProjectionMapControls.d.ts +6 -7
- package/lib/projection/ui/ProjectionMapControls.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionMapControls.js +11 -9
- package/lib/projection/ui/ProjectionMapControls.js.map +1 -1
- package/lib/projection/ui/ProjectionMapLegend.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionMapLegend.js +1 -1
- package/lib/projection/ui/ProjectionMapLegend.js.map +1 -1
- package/lib/projection/ui/ProjectionMapMore.d.ts +2 -2
- package/lib/projection/ui/ProjectionMapMore.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionMapMore.js +7 -5
- package/lib/projection/ui/ProjectionMapMore.js.map +1 -1
- package/lib/projection/ui/ProjectionMapTab.d.ts +15 -6
- package/lib/projection/ui/ProjectionMapTab.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionMapTab.js +11 -7
- package/lib/projection/ui/ProjectionMapTab.js.map +1 -1
- package/lib/projection/ui/ProjectionPairsMore.d.ts +3 -7
- package/lib/projection/ui/ProjectionPairsMore.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionPairsMore.js +4 -5
- package/lib/projection/ui/ProjectionPairsMore.js.map +1 -1
- package/lib/projection/ui/ProjectionPairsTab.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionPairsTab.js +2 -2
- package/lib/projection/ui/ProjectionPairsTab.js.map +1 -1
- package/lib/projection/ui/ProjectionPanel.d.ts +1 -1
- package/lib/projection/ui/ProjectionPanel.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionPanel.js +1 -1
- package/lib/projection/ui/ProjectionPanel.js.map +1 -1
- package/lib/projection/ui/ProjectionReadout.d.ts +7 -1
- package/lib/projection/ui/ProjectionReadout.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionReadout.js +19 -7
- package/lib/projection/ui/ProjectionReadout.js.map +1 -1
- package/lib/projection/ui/ProjectionSpaceControls.d.ts +3 -5
- package/lib/projection/ui/ProjectionSpaceControls.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionSpaceControls.js +9 -7
- package/lib/projection/ui/ProjectionSpaceControls.js.map +1 -1
- package/lib/projection/ui/ProjectionSpaceMore.d.ts +2 -2
- package/lib/projection/ui/ProjectionSpaceMore.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionSpaceMore.js +5 -4
- package/lib/projection/ui/ProjectionSpaceMore.js.map +1 -1
- package/lib/projection/ui/ProjectionSpaceTab.d.ts +11 -3
- package/lib/projection/ui/ProjectionSpaceTab.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionSpaceTab.js +7 -4
- package/lib/projection/ui/ProjectionSpaceTab.js.map +1 -1
- package/lib/projection/ui/ProjectionViewer.d.ts.map +1 -1
- package/lib/projection/ui/ProjectionViewer.js +1 -0
- package/lib/projection/ui/ProjectionViewer.js.map +1 -1
- package/lib/projection/ui/projectionBarReadings.d.ts +4 -1
- package/lib/projection/ui/projectionBarReadings.d.ts.map +1 -1
- package/lib/projection/ui/projectionBarReadings.js +14 -4
- package/lib/projection/ui/projectionBarReadings.js.map +1 -1
- package/lib/projection/ui/projectionBarSlots.d.ts +4 -2
- package/lib/projection/ui/projectionBarSlots.d.ts.map +1 -1
- package/lib/projection/ui/projectionBarSlots.js +3 -7
- package/lib/projection/ui/projectionBarSlots.js.map +1 -1
- package/lib/projection/ui/projectionMapChoices.d.ts +31 -6
- package/lib/projection/ui/projectionMapChoices.d.ts.map +1 -1
- package/lib/projection/ui/projectionMapChoices.js +58 -9
- package/lib/projection/ui/projectionMapChoices.js.map +1 -1
- package/lib/projection/ui/projectionMapChrome.d.ts +3 -9
- package/lib/projection/ui/projectionMapChrome.d.ts.map +1 -1
- package/lib/projection/ui/projectionMapChrome.js +41 -27
- package/lib/projection/ui/projectionMapChrome.js.map +1 -1
- package/lib/projection/ui/projectionMapCorner.d.ts +25 -0
- package/lib/projection/ui/projectionMapCorner.d.ts.map +1 -0
- package/lib/projection/ui/projectionMapCorner.js +46 -0
- package/lib/projection/ui/projectionMapCorner.js.map +1 -0
- package/lib/projection/ui/projectionMapModel.d.ts +9 -18
- package/lib/projection/ui/projectionMapModel.d.ts.map +1 -1
- package/lib/projection/ui/projectionMapModel.js +14 -39
- package/lib/projection/ui/projectionMapModel.js.map +1 -1
- package/lib/projection/ui/projectionMapView.d.ts +3 -1
- package/lib/projection/ui/projectionMapView.d.ts.map +1 -1
- package/lib/projection/ui/projectionMapView.js +9 -4
- package/lib/projection/ui/projectionMapView.js.map +1 -1
- package/lib/projection/ui/projectionSelectionSentence.d.ts +10 -0
- package/lib/projection/ui/projectionSelectionSentence.d.ts.map +1 -0
- package/lib/projection/ui/projectionSelectionSentence.js +18 -0
- package/lib/projection/ui/projectionSelectionSentence.js.map +1 -0
- package/lib/projection/ui/projectionStateApi.d.ts +47 -0
- package/lib/projection/ui/projectionStateApi.d.ts.map +1 -0
- package/lib/projection/ui/projectionStateApi.js +9 -0
- package/lib/projection/ui/projectionStateApi.js.map +1 -0
- package/lib/projection/ui/projectionTabModels.js +1 -1
- package/lib/projection/ui/projectionTabModels.js.map +1 -1
- package/lib/projection/ui/useProjectionState.d.ts +1 -29
- package/lib/projection/ui/useProjectionState.d.ts.map +1 -1
- package/lib/projection/ui/useProjectionState.js +13 -5
- package/lib/projection/ui/useProjectionState.js.map +1 -1
- package/lib/scatter/core/index.d.ts +1 -0
- package/lib/scatter/core/index.d.ts.map +1 -1
- package/lib/scatter/core/index.js +1 -0
- package/lib/scatter/core/index.js.map +1 -1
- package/lib/scatter/core/pointShape.d.ts +18 -0
- package/lib/scatter/core/pointShape.d.ts.map +1 -0
- package/lib/scatter/core/pointShape.js +70 -0
- package/lib/scatter/core/pointShape.js.map +1 -0
- package/lib/scatter/ui/ScatterPlot.d.ts.map +1 -1
- package/lib/scatter/ui/ScatterPlot.js +3 -2
- package/lib/scatter/ui/ScatterPlot.js.map +1 -1
- package/lib/scatter/ui/ScatterPointLayer.d.ts +14 -1
- package/lib/scatter/ui/ScatterPointLayer.d.ts.map +1 -1
- package/lib/scatter/ui/ScatterPointLayer.js +15 -3
- package/lib/scatter/ui/ScatterPointLayer.js.map +1 -1
- package/lib/scatter/ui/scatterFigureProps.d.ts +13 -0
- package/lib/scatter/ui/scatterFigureProps.d.ts.map +1 -1
- package/lib/scatter/ui/scatterMarkGlyph.d.ts +2 -1
- package/lib/scatter/ui/scatterMarkGlyph.d.ts.map +1 -1
- package/lib/scatter/ui/scatterMarkGlyph.js +7 -1
- package/lib/scatter/ui/scatterMarkGlyph.js.map +1 -1
- package/lib/scatter3d/ui/ScatterCloud.d.ts.map +1 -1
- package/lib/scatter3d/ui/ScatterCloud.js +2 -1
- package/lib/scatter3d/ui/ScatterCloud.js.map +1 -1
- package/package.json +1 -1
- package/src/build/vite/gitHead.ts +17 -2
- package/src/clipboard/ui/ClickToCopy.tsx +190 -0
- package/src/clipboard/ui/CopyButton.tsx +2 -2
- package/src/clipboard/ui/CopyableValue.tsx +11 -6
- package/src/clipboard/ui/index.ts +2 -0
- package/src/ecosystem/core/groups.ts +10 -3
- package/src/ecosystem/core/sites.ts +39 -0
- package/src/ecosystem/core/types.ts +4 -1
- package/src/ecosystem/ui/glyphs.tsx +51 -0
- package/src/error/ui/ErrorFallback.tsx +3 -1
- package/src/overlay/core/index.ts +6 -2
- package/src/overlay/core/overlayMarks.ts +51 -6
- package/src/overlay/ui/OverlayLegendMark.tsx +5 -0
- package/src/pedagogy/ui/ReferenceSectionBlock.tsx +10 -1
- package/src/projection/core/index.ts +11 -3
- package/src/projection/core/projectionCopy.ts +3 -0
- package/src/projection/core/projectionGroupings.ts +174 -0
- package/src/projection/core/projectionOptions.ts +18 -7
- package/src/projection/core/projectionPanelWords.ts +10 -0
- package/src/projection/core/projectionSamples.ts +62 -120
- package/src/projection/core/projectionStrings.ts +12 -1
- package/src/projection/core/resolveProjectionOptions.ts +66 -4
- package/src/projection/ui/ProjectionBar.tsx +4 -2
- package/src/projection/ui/ProjectionGroupingPickers.tsx +91 -0
- package/src/projection/ui/ProjectionMapControls.tsx +29 -32
- package/src/projection/ui/ProjectionMapLegend.tsx +1 -1
- package/src/projection/ui/ProjectionMapMore.tsx +14 -4
- package/src/projection/ui/ProjectionMapTab.tsx +27 -9
- package/src/projection/ui/ProjectionPairsMore.tsx +12 -21
- package/src/projection/ui/ProjectionPairsTab.tsx +5 -2
- package/src/projection/ui/ProjectionPanel.tsx +7 -3
- package/src/projection/ui/ProjectionReadout.tsx +28 -8
- package/src/projection/ui/ProjectionSpaceControls.tsx +20 -27
- package/src/projection/ui/ProjectionSpaceMore.tsx +12 -3
- package/src/projection/ui/ProjectionSpaceTab.tsx +23 -6
- package/src/projection/ui/ProjectionViewer.tsx +1 -0
- package/src/projection/ui/projectionBarReadings.ts +24 -8
- package/src/projection/ui/projectionBarSlots.tsx +10 -9
- package/src/projection/ui/projectionMapChoices.ts +71 -14
- package/src/projection/ui/projectionMapChrome.ts +55 -30
- package/src/projection/ui/projectionMapCorner.ts +67 -0
- package/src/projection/ui/projectionMapModel.ts +20 -59
- package/src/projection/ui/projectionMapView.ts +15 -8
- package/src/projection/ui/projectionSelectionSentence.ts +22 -0
- package/src/projection/ui/projectionStateApi.ts +57 -0
- package/src/projection/ui/projectionTabModels.ts +1 -1
- package/src/projection/ui/useProjectionState.ts +33 -37
- package/src/scatter/core/index.ts +1 -0
- package/src/scatter/core/pointShape.ts +80 -0
- package/src/scatter/ui/ScatterPlot.tsx +4 -1
- package/src/scatter/ui/ScatterPointLayer.tsx +39 -11
- package/src/scatter/ui/scatterFigureProps.ts +13 -0
- package/src/scatter/ui/scatterMarkGlyph.tsx +9 -1
- package/src/scatter3d/ui/ScatterCloud.tsx +3 -0
- package/styles/chrome.css +163 -0
|
@@ -409,4 +409,55 @@ export const GLYPHS: Record<SiteId, (alt: string) => ReactNode> = {
|
|
|
409
409
|
/>
|
|
410
410
|
</>
|
|
411
411
|
),
|
|
412
|
+
// A nucleus with one electron on its orbit. The electron carries the
|
|
413
|
+
// answering colour because the electron is what every tool here counts.
|
|
414
|
+
atoms: (alt) => (
|
|
415
|
+
<>
|
|
416
|
+
<circle
|
|
417
|
+
cx="16"
|
|
418
|
+
cy="16"
|
|
419
|
+
r="10.5"
|
|
420
|
+
fill="none"
|
|
421
|
+
stroke="#ffffff"
|
|
422
|
+
strokeWidth="2.2"
|
|
423
|
+
/>
|
|
424
|
+
<circle cx="16" cy="16" r="3.6" fill="#ffffff" />
|
|
425
|
+
<circle cx="23.42" cy="8.58" r="3.2" fill={alt} />
|
|
426
|
+
</>
|
|
427
|
+
),
|
|
428
|
+
// A balance still tipped, its two pans holding the two sides of the
|
|
429
|
+
// calculation. The pan that carries the answer carries the colour.
|
|
430
|
+
moles: (alt) => (
|
|
431
|
+
<>
|
|
432
|
+
<path
|
|
433
|
+
d="M6.5 11.5 25.5 15.5M16 13.5V24M10.5 24h11"
|
|
434
|
+
fill="none"
|
|
435
|
+
stroke="#ffffff"
|
|
436
|
+
strokeWidth="2.2"
|
|
437
|
+
strokeLinecap="round"
|
|
438
|
+
strokeLinejoin="round"
|
|
439
|
+
/>
|
|
440
|
+
<circle cx="6.5" cy="11.5" r="3.2" fill="#ffffff" />
|
|
441
|
+
<circle cx="25.5" cy="15.5" r="3.2" fill={alt} />
|
|
442
|
+
</>
|
|
443
|
+
),
|
|
444
|
+
// One cell of an ionic lattice, cations and anions alternating: the shape of
|
|
445
|
+
// the compounds this site names. The ion being named carries the colour.
|
|
446
|
+
inorganic: (alt) => (
|
|
447
|
+
<>
|
|
448
|
+
<path
|
|
449
|
+
d="M9.5 9.5h13v13h-13Z"
|
|
450
|
+
fill="none"
|
|
451
|
+
stroke="#ffffff"
|
|
452
|
+
strokeWidth="1.6"
|
|
453
|
+
opacity="0.55"
|
|
454
|
+
/>
|
|
455
|
+
<g fill="#ffffff">
|
|
456
|
+
<circle cx="9.5" cy="9.5" r="4.3" />
|
|
457
|
+
<circle cx="22.5" cy="9.5" r="2.7" />
|
|
458
|
+
<circle cx="9.5" cy="22.5" r="2.7" />
|
|
459
|
+
</g>
|
|
460
|
+
<circle cx="22.5" cy="22.5" r="4.3" fill={alt} />
|
|
461
|
+
</>
|
|
462
|
+
),
|
|
412
463
|
};
|
|
@@ -52,7 +52,9 @@ export function ErrorFallback(props: ErrorFallbackProps): ReactElement {
|
|
|
52
52
|
icon="error"
|
|
53
53
|
title={title}
|
|
54
54
|
description={
|
|
55
|
-
|
|
55
|
+
<span className="error-fallback__message">
|
|
56
|
+
{error.message === '' ? 'No message was given.' : error.message}
|
|
57
|
+
</span>
|
|
56
58
|
}
|
|
57
59
|
action={
|
|
58
60
|
onRetry === undefined ? undefined : (
|
|
@@ -11,8 +11,12 @@ export type { EmptiestCornerOptions } from './emptiestCorner.ts';
|
|
|
11
11
|
export { emptiestCorner } from './emptiestCorner.ts';
|
|
12
12
|
export type { OverlayBarFoldOptions } from './overlayCollapse.ts';
|
|
13
13
|
export { overlayBarFolded, shouldCollapseOverlay } from './overlayCollapse.ts';
|
|
14
|
-
export type { OverlayMarkShape } from './overlayMarks.ts';
|
|
15
|
-
export {
|
|
14
|
+
export type { OverlayMarkShape, OverlaySampleShape } from './overlayMarks.ts';
|
|
15
|
+
export {
|
|
16
|
+
OVERLAY_MARK_SHAPES,
|
|
17
|
+
OVERLAY_SAMPLE_SHAPES,
|
|
18
|
+
isFilledMark,
|
|
19
|
+
} from './overlayMarks.ts';
|
|
16
20
|
export type {
|
|
17
21
|
OverlayDensity,
|
|
18
22
|
OverlayMetrics,
|
|
@@ -10,25 +10,62 @@
|
|
|
10
10
|
|
|
11
11
|
/** Which mark a legend entry, a marker or a series stands for. */
|
|
12
12
|
export type OverlayMarkShape =
|
|
13
|
-
|
|
13
|
+
| 'dot'
|
|
14
|
+
| 'ring'
|
|
15
|
+
| 'square'
|
|
16
|
+
| 'triangle'
|
|
17
|
+
| 'diamond'
|
|
18
|
+
| 'triangle-down'
|
|
19
|
+
| 'line'
|
|
20
|
+
| 'dashed'
|
|
21
|
+
| 'cross';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The shapes a sample's own dot can take, which is how a second grouping of
|
|
25
|
+
* the same samples is drawn while colour keeps the first.
|
|
26
|
+
*/
|
|
27
|
+
export type OverlaySampleShape = Extract<
|
|
28
|
+
OverlayMarkShape,
|
|
29
|
+
'dot' | 'square' | 'triangle' | 'diamond' | 'triangle-down'
|
|
30
|
+
>;
|
|
14
31
|
|
|
15
32
|
/**
|
|
16
33
|
* Every mark, in the order a picker offers them.
|
|
17
34
|
*
|
|
18
|
-
* The first
|
|
19
|
-
* last three carry a second meaning on one figure — a
|
|
20
|
-
* beside dots for the samples — which is what keeps a
|
|
21
|
-
* colours run out or the reader does not separate two
|
|
35
|
+
* The filled ones come first and separate one thing from another by colour or
|
|
36
|
+
* by outline alone; the last three carry a second meaning on one figure — a
|
|
37
|
+
* line for a component beside dots for the samples — which is what keeps a
|
|
38
|
+
* figure readable when the colours run out or the reader does not separate two
|
|
39
|
+
* of them.
|
|
22
40
|
*/
|
|
23
41
|
export const OVERLAY_MARK_SHAPES: readonly OverlayMarkShape[] = [
|
|
24
42
|
'dot',
|
|
25
43
|
'ring',
|
|
26
44
|
'square',
|
|
45
|
+
'triangle',
|
|
46
|
+
'diamond',
|
|
47
|
+
'triangle-down',
|
|
27
48
|
'line',
|
|
28
49
|
'dashed',
|
|
29
50
|
'cross',
|
|
30
51
|
];
|
|
31
52
|
|
|
53
|
+
/**
|
|
54
|
+
* The shapes a second grouping is given, in the order its groups are listed.
|
|
55
|
+
*
|
|
56
|
+
* Five, because that is about where a reader stops telling small shapes apart
|
|
57
|
+
* at a glance. None of them is a ring or a cross: a ring is a sample placed
|
|
58
|
+
* into a finished model and a cross is a group's average, and a sample drawn
|
|
59
|
+
* as either would be read as one of those.
|
|
60
|
+
*/
|
|
61
|
+
export const OVERLAY_SAMPLE_SHAPES: readonly OverlaySampleShape[] = [
|
|
62
|
+
'dot',
|
|
63
|
+
'square',
|
|
64
|
+
'triangle',
|
|
65
|
+
'diamond',
|
|
66
|
+
'triangle-down',
|
|
67
|
+
];
|
|
68
|
+
|
|
32
69
|
/**
|
|
33
70
|
* Whether a mark is drawn as a solid area rather than as a stroke.
|
|
34
71
|
*
|
|
@@ -39,5 +76,13 @@ export const OVERLAY_MARK_SHAPES: readonly OverlayMarkShape[] = [
|
|
|
39
76
|
* @returns `true` for the filled marks, `false` for the drawn ones.
|
|
40
77
|
*/
|
|
41
78
|
export function isFilledMark(shape: OverlayMarkShape): boolean {
|
|
42
|
-
return shape
|
|
79
|
+
return FILLED_MARKS.has(shape);
|
|
43
80
|
}
|
|
81
|
+
|
|
82
|
+
const FILLED_MARKS: ReadonlySet<OverlayMarkShape> = new Set<OverlayMarkShape>([
|
|
83
|
+
'dot',
|
|
84
|
+
'square',
|
|
85
|
+
'triangle',
|
|
86
|
+
'diamond',
|
|
87
|
+
'triangle-down',
|
|
88
|
+
]);
|
|
@@ -73,6 +73,11 @@ const MARK_GEOMETRY: Record<OverlayMarkShape, ReactElement> = {
|
|
|
73
73
|
dot: <circle cx="6" cy="6" r="4.2" />,
|
|
74
74
|
ring: <circle cx="6" cy="6" r="3.4" strokeWidth="2.2" />,
|
|
75
75
|
square: <rect x="2" y="2" width="8" height="8" rx="1.5" />,
|
|
76
|
+
// Balanced on the centre of the box, as the dots they name are balanced on
|
|
77
|
+
// their samples.
|
|
78
|
+
triangle: <path d="M6 0.8L10.5 8.6L1.5 8.6Z" />,
|
|
79
|
+
diamond: <path d="M6 1L11 6L6 11L1 6Z" />,
|
|
80
|
+
'triangle-down': <path d="M1.5 3.4L10.5 3.4L6 11.2Z" />,
|
|
76
81
|
line: <line x1="0.5" y1="6" x2="11.5" y2="6" strokeWidth="2.8" />,
|
|
77
82
|
dashed: (
|
|
78
83
|
<line
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, ReactElement } from 'react';
|
|
2
2
|
|
|
3
|
+
import { ClickToCopy } from '../../clipboard/ui/ClickToCopy.tsx';
|
|
3
4
|
import { joinClassNames } from '../../shared/ui/joinClassNames.ts';
|
|
4
5
|
import { TOKEN } from '../../tokens/core/familyTokens.ts';
|
|
5
6
|
|
|
@@ -108,7 +109,15 @@ function ReferenceRowLine(props: {
|
|
|
108
109
|
const interactive = row.tooltip !== undefined;
|
|
109
110
|
const line = (
|
|
110
111
|
<span style={interactive ? INTERACTIVE_ROW_STYLE : ROW_STYLE}>
|
|
111
|
-
<span style={syntaxStyle(width, interactive)}>
|
|
112
|
+
<span style={syntaxStyle(width, interactive)}>
|
|
113
|
+
<ClickToCopy
|
|
114
|
+
value={row.syntax}
|
|
115
|
+
label="syntax"
|
|
116
|
+
title={interactive ? '' : undefined}
|
|
117
|
+
>
|
|
118
|
+
{row.syntax}
|
|
119
|
+
</ClickToCopy>
|
|
120
|
+
</span>
|
|
112
121
|
<span style={DESCRIPTION_STYLE}>{row.description}</span>
|
|
113
122
|
</span>
|
|
114
123
|
);
|
|
@@ -35,13 +35,15 @@ export type { ProjectionCopy } from './projectionCopy.ts';
|
|
|
35
35
|
export { PROJECTION_COPY } from './projectionCopy.ts';
|
|
36
36
|
export type { ProjectionCopyPatch } from './projectionCopyPatch.ts';
|
|
37
37
|
export type {
|
|
38
|
-
ProjectionColorBy,
|
|
39
38
|
ProjectionOptionId,
|
|
40
39
|
ProjectionOptions,
|
|
41
40
|
ProjectionVariablesView,
|
|
42
41
|
} from './projectionOptions.ts';
|
|
43
42
|
export { mergeProjectionCopy } from './mergeProjectionCopy.ts';
|
|
44
|
-
export {
|
|
43
|
+
export {
|
|
44
|
+
DEFAULT_PROJECTION_OPTIONS,
|
|
45
|
+
NO_GROUPING,
|
|
46
|
+
} from './projectionOptions.ts';
|
|
45
47
|
export type {
|
|
46
48
|
ProjectionChoiceWords,
|
|
47
49
|
ProjectionOutlineWords,
|
|
@@ -56,10 +58,16 @@ export type {
|
|
|
56
58
|
} from './projectionResult.ts';
|
|
57
59
|
export type {
|
|
58
60
|
ProjectionField,
|
|
61
|
+
ProjectionGrouping,
|
|
59
62
|
ProjectionSamples,
|
|
60
63
|
ResolvedProjectionGroups,
|
|
64
|
+
ResolvedProjectionShapes,
|
|
61
65
|
} from './projectionSamples.ts';
|
|
62
|
-
export {
|
|
66
|
+
export {
|
|
67
|
+
projectionGrouping,
|
|
68
|
+
resolveProjectionGroups,
|
|
69
|
+
resolveProjectionShapes,
|
|
70
|
+
} from './projectionGroupings.ts';
|
|
63
71
|
export type {
|
|
64
72
|
ProjectionBarWords,
|
|
65
73
|
ProjectionHelp,
|
|
@@ -86,6 +86,8 @@ export interface ProjectionCopy {
|
|
|
86
86
|
projected: string;
|
|
87
87
|
/** The title of a key whose colour stands for nothing, so only shape is left. */
|
|
88
88
|
shapes: string;
|
|
89
|
+
/** What the shape stands for, after what the colour does. Carries `{shapes}`. */
|
|
90
|
+
shapedBy: string;
|
|
89
91
|
};
|
|
90
92
|
/** The sentences the viewer builds from the data. */
|
|
91
93
|
sentence: {
|
|
@@ -208,6 +210,7 @@ export const PROJECTION_COPY: ProjectionCopy = {
|
|
|
208
210
|
notOutlined: 'Not outlined: too few samples.',
|
|
209
211
|
projected: 'Hollow = added after the map was built',
|
|
210
212
|
shapes: 'Shape = what each mark is.',
|
|
213
|
+
shapedBy: 'Shape = {shapes}.',
|
|
211
214
|
},
|
|
212
215
|
sentence: {
|
|
213
216
|
sharesFirst:
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the groupings a page hands in become what a figure draws: the one that
|
|
3
|
+
* colours the dots, painted from the shared palette, and the one that shapes
|
|
4
|
+
* them, given one shape per group.
|
|
5
|
+
*
|
|
6
|
+
* Both are cut the same way — the page's own order first, then every group in
|
|
7
|
+
* the order its first row names it — so a group keeps its colour and its shape
|
|
8
|
+
* however the rows are filtered.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
CHART_SERIES_COLORS,
|
|
13
|
+
chartSeriesColor,
|
|
14
|
+
} from '../../chart/core/chartPalette.ts';
|
|
15
|
+
import { OVERLAY_SAMPLE_SHAPES } from '../../overlay/core/overlayMarks.ts';
|
|
16
|
+
|
|
17
|
+
import type {
|
|
18
|
+
ProjectionGrouping,
|
|
19
|
+
ProjectionSamples,
|
|
20
|
+
ResolvedProjectionGroups,
|
|
21
|
+
ResolvedProjectionShapes,
|
|
22
|
+
} from './projectionSamples.ts';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The grouping a set of samples is coloured by, in a shape a legend and a plot
|
|
26
|
+
* can both read.
|
|
27
|
+
*
|
|
28
|
+
* A group named in `order` but held by no row is kept, so a legend does not
|
|
29
|
+
* reshuffle when a filter empties one; a row naming a group that is not in
|
|
30
|
+
* `order` is appended in the order it appears.
|
|
31
|
+
* @param grouping - The grouping, or nothing when the dots are not coloured.
|
|
32
|
+
* @param count - How many rows there are, which is the score matrix's height.
|
|
33
|
+
* @returns The resolved groups. No grouping gives no entries at all, and every
|
|
34
|
+
* row lands at `-1`.
|
|
35
|
+
*/
|
|
36
|
+
export function resolveProjectionGroups(
|
|
37
|
+
grouping: ProjectionGrouping | undefined,
|
|
38
|
+
count: number,
|
|
39
|
+
): ResolvedProjectionGroups {
|
|
40
|
+
const { label, entries, rowOf } = partition(grouping, count);
|
|
41
|
+
const colored = entries.map((entry) => ({ ...entry, color: '' }));
|
|
42
|
+
paintGroups(colored, grouping?.colors);
|
|
43
|
+
return { label, entries: colored, groupOf: rowOf };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The grouping a set of samples is shaped by, one shape per group.
|
|
48
|
+
*
|
|
49
|
+
* A grouping of more groups than there are shapes is refused as a whole rather
|
|
50
|
+
* than drawn with two groups sharing a shape, or with the last ones falling
|
|
51
|
+
* back to a disc: either would put two groups under one mark, which is the one
|
|
52
|
+
* thing a key cannot undo.
|
|
53
|
+
* @param grouping - The grouping, or nothing when the dots are not shaped.
|
|
54
|
+
* @param count - How many rows there are, which is the score matrix's height.
|
|
55
|
+
* @returns The resolved shapes, or `null` when there is no grouping or its
|
|
56
|
+
* groups outnumber the shapes.
|
|
57
|
+
*/
|
|
58
|
+
export function resolveProjectionShapes(
|
|
59
|
+
grouping: ProjectionGrouping | undefined,
|
|
60
|
+
count: number,
|
|
61
|
+
): ResolvedProjectionShapes | null {
|
|
62
|
+
if (grouping === undefined) return null;
|
|
63
|
+
const { label, entries, rowOf } = partition(grouping, count);
|
|
64
|
+
if (entries.length > OVERLAY_SAMPLE_SHAPES.length) return null;
|
|
65
|
+
const shaped = entries.map((entry, index) => ({
|
|
66
|
+
...entry,
|
|
67
|
+
shape: OVERLAY_SAMPLE_SHAPES[index] ?? 'dot',
|
|
68
|
+
}));
|
|
69
|
+
return { label, entries: shaped, shapeOf: rowOf };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The grouping carrying an id.
|
|
74
|
+
* @param samples - Who the rows are.
|
|
75
|
+
* @param id - The id asked for.
|
|
76
|
+
* @returns The grouping, or `undefined` when none carries it.
|
|
77
|
+
*/
|
|
78
|
+
export function projectionGrouping(
|
|
79
|
+
samples: ProjectionSamples,
|
|
80
|
+
id: string,
|
|
81
|
+
): ProjectionGrouping | undefined {
|
|
82
|
+
for (const grouping of samples.groupings ?? NO_GROUPINGS) {
|
|
83
|
+
if (grouping.id === id) return grouping;
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const NO_GROUP = -1;
|
|
89
|
+
const DEFAULT_GROUP_LABEL = 'Group';
|
|
90
|
+
const NO_GROUPINGS: readonly ProjectionGrouping[] = [];
|
|
91
|
+
|
|
92
|
+
interface GroupEntry {
|
|
93
|
+
id: string;
|
|
94
|
+
label: string;
|
|
95
|
+
count: number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface ColoredEntry extends GroupEntry {
|
|
99
|
+
color: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function partition(
|
|
103
|
+
grouping: ProjectionGrouping | undefined,
|
|
104
|
+
count: number,
|
|
105
|
+
): { label: string; entries: GroupEntry[]; rowOf: Int32Array } {
|
|
106
|
+
const rowCount = Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
|
|
107
|
+
const label = grouping?.label ?? DEFAULT_GROUP_LABEL;
|
|
108
|
+
const rowOf = new Int32Array(rowCount).fill(NO_GROUP);
|
|
109
|
+
const entries: GroupEntry[] = [];
|
|
110
|
+
if (grouping === undefined) return { label, entries, rowOf };
|
|
111
|
+
|
|
112
|
+
const indexOfGroup = new Map<string, number>();
|
|
113
|
+
for (const id of grouping.order ?? []) {
|
|
114
|
+
appendGroup(entries, indexOfGroup, id);
|
|
115
|
+
}
|
|
116
|
+
for (let row = 0; row < rowCount; row++) {
|
|
117
|
+
const id = grouping.groups[row];
|
|
118
|
+
if (id === undefined) continue;
|
|
119
|
+
const at = appendGroup(entries, indexOfGroup, id);
|
|
120
|
+
rowOf[row] = at;
|
|
121
|
+
const entry = entries[at];
|
|
122
|
+
if (entry !== undefined) entry.count++;
|
|
123
|
+
}
|
|
124
|
+
return { label, entries, rowOf };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function appendGroup(
|
|
128
|
+
entries: GroupEntry[],
|
|
129
|
+
indexOfGroup: Map<string, number>,
|
|
130
|
+
id: string,
|
|
131
|
+
): number {
|
|
132
|
+
const known = indexOfGroup.get(id);
|
|
133
|
+
if (known !== undefined) return known;
|
|
134
|
+
const at = entries.length;
|
|
135
|
+
indexOfGroup.set(id, at);
|
|
136
|
+
entries.push({ id, label: id, count: 0 });
|
|
137
|
+
return at;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function paintGroups(
|
|
141
|
+
entries: ColoredEntry[],
|
|
142
|
+
pinned: Readonly<Record<string, string>> | undefined,
|
|
143
|
+
): void {
|
|
144
|
+
// Every pinned colour is taken out of the palette before any group draws
|
|
145
|
+
// from it, so pinning the third group's hue onto the first does not leave
|
|
146
|
+
// two groups wearing it.
|
|
147
|
+
const taken = new Set<string>();
|
|
148
|
+
if (pinned !== undefined) {
|
|
149
|
+
for (const entry of entries) {
|
|
150
|
+
const color = pinned[entry.id];
|
|
151
|
+
if (color !== undefined) taken.add(color.toLowerCase());
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
let cursor = 0;
|
|
156
|
+
for (const entry of entries) {
|
|
157
|
+
const own = pinned?.[entry.id];
|
|
158
|
+
if (own !== undefined) {
|
|
159
|
+
entry.color = own;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
let color = chartSeriesColor(cursor, 'group');
|
|
163
|
+
while (
|
|
164
|
+
cursor < CHART_SERIES_COLORS.length &&
|
|
165
|
+
taken.has(color.toLowerCase())
|
|
166
|
+
) {
|
|
167
|
+
cursor++;
|
|
168
|
+
color = chartSeriesColor(cursor, 'group');
|
|
169
|
+
}
|
|
170
|
+
cursor++;
|
|
171
|
+
taken.add(color.toLowerCase());
|
|
172
|
+
entry.color = color;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -14,10 +14,10 @@ export type ProjectionVariablesView =
|
|
|
14
14
|
| 'sample';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* The word for "no grouping" wherever an option names one, which is why no
|
|
18
|
+
* grouping may be called it.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export const NO_GROUPING = 'none';
|
|
21
21
|
|
|
22
22
|
/** What the figure is currently showing. Every field is a control in the floating bar. */
|
|
23
23
|
export interface ProjectionOptions {
|
|
@@ -43,10 +43,20 @@ export interface ProjectionOptions {
|
|
|
43
43
|
*/
|
|
44
44
|
cloudGesture: CloudGesture;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* Which grouping colours the dots, by its id, or `'none'`. An id no grouping
|
|
47
|
+
* carries — the empty string, or one saved on other data — takes the first
|
|
48
|
+
* grouping.
|
|
49
|
+
* @default ''
|
|
48
50
|
*/
|
|
49
|
-
colorBy:
|
|
51
|
+
colorBy: string;
|
|
52
|
+
/**
|
|
53
|
+
* Which grouping gives the dots their shapes, by its id, or `'none'`. An id
|
|
54
|
+
* no grouping carries takes the second grouping — the first when the colour
|
|
55
|
+
* has taken the second — and a grouping of more groups than there are
|
|
56
|
+
* shapes is not drawn.
|
|
57
|
+
* @default ''
|
|
58
|
+
*/
|
|
59
|
+
shapeBy: string;
|
|
50
60
|
/**
|
|
51
61
|
* How large the group outlines are, or `null` for none.
|
|
52
62
|
* @default { kind: 'coverage', probability: 0.95 }
|
|
@@ -134,7 +144,8 @@ export const DEFAULT_PROJECTION_OPTIONS: ProjectionOptions = {
|
|
|
134
144
|
yAxis: 1,
|
|
135
145
|
zAxis: 2,
|
|
136
146
|
cloudGesture: 'turn',
|
|
137
|
-
colorBy: '
|
|
147
|
+
colorBy: '',
|
|
148
|
+
shapeBy: '',
|
|
138
149
|
ellipse: { kind: 'coverage', probability: 0.95 },
|
|
139
150
|
pointRadius: 3.5,
|
|
140
151
|
showGroupMeans: false,
|
|
@@ -44,6 +44,12 @@ export interface ProjectionPanelWords {
|
|
|
44
44
|
export interface ProjectionReasonWords {
|
|
45
45
|
/** Why the colour cannot be set: the samples carry no groups. */
|
|
46
46
|
noGroups: string;
|
|
47
|
+
/** Why the shape cannot be set: the samples carry no groups. */
|
|
48
|
+
noGroupsToShape: string;
|
|
49
|
+
/** Why a grouping is greyed in the shape picker: the colour already draws it. */
|
|
50
|
+
shapeIsColour: string;
|
|
51
|
+
/** Why a grouping is greyed in the shape picker: it has more groups than shapes. */
|
|
52
|
+
tooManyShapes: string;
|
|
47
53
|
/** Why the map's outlines cannot be set while nothing is coloured. */
|
|
48
54
|
uncolouredOutlines: string;
|
|
49
55
|
/** Why the cloud's shells cannot be set while nothing is coloured. */
|
|
@@ -97,6 +103,7 @@ export const PROJECTION_PANEL_WORDS: ProjectionPanelWords = {
|
|
|
97
103
|
zAxis: 'Into',
|
|
98
104
|
cloudGesture: 'Drag does',
|
|
99
105
|
colorBy: 'Colour by',
|
|
106
|
+
shapeBy: 'Shape by',
|
|
100
107
|
ellipse: 'Outlines',
|
|
101
108
|
pointRadius: 'Dot size',
|
|
102
109
|
showGroupMeans: 'Averages',
|
|
@@ -124,6 +131,9 @@ export const PROJECTION_PANEL_WORDS: ProjectionPanelWords = {
|
|
|
124
131
|
/** The reasons a greyed control gives when a site overrides nothing. */
|
|
125
132
|
export const PROJECTION_REASON_WORDS: ProjectionReasonWords = {
|
|
126
133
|
noGroups: 'These samples carry no groups to colour by.',
|
|
134
|
+
noGroupsToShape: 'These samples carry no groups to shape by.',
|
|
135
|
+
shapeIsColour: 'The colour already stands for these groups.',
|
|
136
|
+
tooManyShapes: 'More groups than there are shapes to tell apart.',
|
|
127
137
|
uncolouredOutlines:
|
|
128
138
|
'Outlines follow the groups, so colour the map by them first.',
|
|
129
139
|
uncolouredShells:
|