react-cheminfo 0.139.0 → 0.140.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/credits/core/credits.d.ts +12 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +16 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/crystal3d/ui/CrystalCanvas3D.d.ts +1 -1
- package/lib/crystal3d/ui/CrystalCanvas3D.d.ts.map +1 -1
- package/lib/crystal3d/ui/CrystalViewer3D.d.ts +1 -1
- package/lib/crystal3d/ui/CrystalViewer3D.d.ts.map +1 -1
- package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts +1 -1
- package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.d.ts +17 -3
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +1 -1
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/FigureQuickActions.d.ts +10 -4
- package/lib/download/ui/FigureQuickActions.d.ts.map +1 -1
- package/lib/download/ui/FigureQuickActions.js +12 -6
- package/lib/download/ui/FigureQuickActions.js.map +1 -1
- package/lib/ecosystem/core/home.d.ts +19 -0
- package/lib/ecosystem/core/home.d.ts.map +1 -0
- package/lib/ecosystem/core/home.js +23 -0
- package/lib/ecosystem/core/home.js.map +1 -0
- package/lib/ecosystem/core/index.d.ts +3 -0
- package/lib/ecosystem/core/index.d.ts.map +1 -1
- package/lib/ecosystem/core/index.js +2 -0
- package/lib/ecosystem/core/index.js.map +1 -1
- package/lib/ecosystem/core/searchSites.d.ts +39 -0
- package/lib/ecosystem/core/searchSites.d.ts.map +1 -0
- package/lib/ecosystem/core/searchSites.js +77 -0
- package/lib/ecosystem/core/searchSites.js.map +1 -0
- package/lib/ecosystem/core/types.d.ts +1 -1
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/ecosystem/core/unlistedSites.d.ts.map +1 -1
- package/lib/ecosystem/core/unlistedSites.js +14 -0
- package/lib/ecosystem/core/unlistedSites.js.map +1 -1
- package/lib/ecosystem/ui/EcosystemButton.d.ts +6 -0
- package/lib/ecosystem/ui/EcosystemButton.d.ts.map +1 -1
- package/lib/ecosystem/ui/EcosystemButton.js +2 -2
- package/lib/ecosystem/ui/EcosystemButton.js.map +1 -1
- package/lib/ecosystem/ui/EcosystemMenu.d.ts +13 -4
- package/lib/ecosystem/ui/EcosystemMenu.d.ts.map +1 -1
- package/lib/ecosystem/ui/EcosystemMenu.js +56 -6
- package/lib/ecosystem/ui/EcosystemMenu.js.map +1 -1
- package/lib/ecosystem/ui/SiteGroupGrid.d.ts +12 -0
- package/lib/ecosystem/ui/SiteGroupGrid.d.ts.map +1 -1
- package/lib/ecosystem/ui/SiteGroupGrid.js +15 -2
- package/lib/ecosystem/ui/SiteGroupGrid.js.map +1 -1
- package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +4 -0
- package/lib/ecosystem/ui/glyphs.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +10 -0
- package/lib/locales/en.json +10 -0
- package/lib/locales/es.json +10 -0
- package/lib/locales/fr.json +10 -0
- package/lib/locales/it.json +10 -0
- package/lib/molecule3d/core/bondNeighbours.d.ts +30 -0
- package/lib/molecule3d/core/bondNeighbours.d.ts.map +1 -0
- package/lib/molecule3d/core/bondNeighbours.js +108 -0
- package/lib/molecule3d/core/bondNeighbours.js.map +1 -0
- package/lib/molecule3d/core/file.d.ts +15 -4
- package/lib/molecule3d/core/file.d.ts.map +1 -1
- package/lib/molecule3d/core/file.js +10 -1
- package/lib/molecule3d/core/file.js.map +1 -1
- package/lib/molecule3d/core/index.d.ts +11 -2
- package/lib/molecule3d/core/index.d.ts.map +1 -1
- package/lib/molecule3d/core/index.js +6 -1
- package/lib/molecule3d/core/index.js.map +1 -1
- package/lib/molecule3d/core/partialBondMode.d.ts +34 -0
- package/lib/molecule3d/core/partialBondMode.d.ts.map +1 -0
- package/lib/molecule3d/core/partialBondMode.js +39 -0
- package/lib/molecule3d/core/partialBondMode.js.map +1 -0
- package/lib/molecule3d/core/partialBondRanges.d.ts +61 -0
- package/lib/molecule3d/core/partialBondRanges.d.ts.map +1 -0
- package/lib/molecule3d/core/partialBondRanges.js +89 -0
- package/lib/molecule3d/core/partialBondRanges.js.map +1 -0
- package/lib/molecule3d/core/partialBonds.d.ts +61 -0
- package/lib/molecule3d/core/partialBonds.d.ts.map +1 -0
- package/lib/molecule3d/core/partialBonds.js +115 -0
- package/lib/molecule3d/core/partialBonds.js.map +1 -0
- package/lib/molecule3d/core/settings.d.ts +13 -35
- package/lib/molecule3d/core/settings.d.ts.map +1 -1
- package/lib/molecule3d/core/settings.js +17 -25
- package/lib/molecule3d/core/settings.js.map +1 -1
- package/lib/molecule3d/core/tools.d.ts +36 -0
- package/lib/molecule3d/core/tools.d.ts.map +1 -0
- package/lib/molecule3d/core/tools.js +24 -0
- package/lib/molecule3d/core/tools.js.map +1 -0
- package/lib/molecule3d/ui/Molecule3DExport.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DExport.js +19 -2
- package/lib/molecule3d/ui/Molecule3DExport.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DOptions.d.ts +5 -2
- package/lib/molecule3d/ui/Molecule3DOptions.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DOptions.js +6 -4
- package/lib/molecule3d/ui/Molecule3DOptions.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DPartialBonds.d.ts +22 -0
- package/lib/molecule3d/ui/Molecule3DPartialBonds.d.ts.map +1 -0
- package/lib/molecule3d/ui/Molecule3DPartialBonds.js +53 -0
- package/lib/molecule3d/ui/Molecule3DPartialBonds.js.map +1 -0
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.js +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +3 -2
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molecule3d/ui/drawScene.d.ts +4 -3
- package/lib/molecule3d/ui/drawScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/drawScene.js +12 -2
- package/lib/molecule3d/ui/drawScene.js.map +1 -1
- package/lib/molecule3d/ui/moleculeFileFormats.d.ts +3 -2
- package/lib/molecule3d/ui/moleculeFileFormats.d.ts.map +1 -1
- package/lib/molecule3d/ui/moleculeFileFormats.js +5 -3
- package/lib/molecule3d/ui/moleculeFileFormats.js.map +1 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts +2 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts.map +1 -1
- package/lib/molecule3d/ui/partialBondShapes.d.ts +117 -0
- package/lib/molecule3d/ui/partialBondShapes.d.ts.map +1 -0
- package/lib/molecule3d/ui/partialBondShapes.js +164 -0
- package/lib/molecule3d/ui/partialBondShapes.js.map +1 -0
- package/lib/molecule3d/ui/renderMolecule.d.ts +9 -0
- package/lib/molecule3d/ui/renderMolecule.d.ts.map +1 -1
- package/lib/molecule3d/ui/renderMolecule.js +17 -0
- package/lib/molecule3d/ui/renderMolecule.js.map +1 -1
- package/lib/molecule3d/ui/renderPartialBonds.d.ts +19 -0
- package/lib/molecule3d/ui/renderPartialBonds.d.ts.map +1 -0
- package/lib/molecule3d/ui/renderPartialBonds.js +90 -0
- package/lib/molecule3d/ui/renderPartialBonds.js.map +1 -0
- package/lib/molecule3d/ui/structureGeometry.d.ts +22 -0
- package/lib/molecule3d/ui/structureGeometry.d.ts.map +1 -0
- package/lib/molecule3d/ui/structureGeometry.js +63 -0
- package/lib/molecule3d/ui/structureGeometry.js.map +1 -0
- package/lib/molecule3d/ui/usePolarSurfaceArea.d.ts +2 -2
- package/lib/molecule3d/ui/usePolarSurfaceArea.d.ts.map +1 -1
- package/lib/molecule3d/ui/usePolarSurfaceArea.js +5 -4
- package/lib/molecule3d/ui/usePolarSurfaceArea.js.map +1 -1
- package/lib/molecule3d/ui/viewer.d.ts +8 -1
- package/lib/molecule3d/ui/viewer.d.ts.map +1 -1
- package/lib/molecule3d/ui/viewer.js +10 -0
- package/lib/molecule3d/ui/viewer.js.map +1 -1
- package/lib/molecule3d/ui/viewerTypes.d.ts +18 -0
- package/lib/molecule3d/ui/viewerTypes.d.ts.map +1 -1
- package/lib/panel/ui/FilterInput.d.ts +11 -0
- package/lib/panel/ui/FilterInput.d.ts.map +1 -1
- package/lib/panel/ui/FilterInput.js +10 -1
- package/lib/panel/ui/FilterInput.js.map +1 -1
- package/lib/shell/ui/ShellFrame.d.ts.map +1 -1
- package/lib/shell/ui/ShellFrame.js +3 -2
- package/lib/shell/ui/ShellFrame.js.map +1 -1
- package/package.json +1 -1
- package/src/credits/core/credits.ts +16 -0
- package/src/crystal3d/ui/CrystalCanvas3D.tsx +1 -1
- package/src/crystal3d/ui/CrystalViewer3D.tsx +1 -1
- package/src/crystal3d/ui/crystalStructureViewerProps.ts +1 -1
- package/src/download/ui/FigureDownloadPanel.tsx +20 -4
- package/src/download/ui/FigureQuickActions.tsx +18 -6
- package/src/ecosystem/core/home.ts +27 -0
- package/src/ecosystem/core/index.ts +7 -0
- package/src/ecosystem/core/searchSites.ts +102 -0
- package/src/ecosystem/core/types.ts +1 -0
- package/src/ecosystem/core/unlistedSites.ts +15 -0
- package/src/ecosystem/ui/EcosystemButton.tsx +8 -2
- package/src/ecosystem/ui/EcosystemMenu.tsx +103 -7
- package/src/ecosystem/ui/SiteGroupGrid.tsx +28 -3
- package/src/ecosystem/ui/glyphs.tsx +14 -0
- package/src/locales/de.json +10 -0
- package/src/locales/en.json +10 -0
- package/src/locales/es.json +10 -0
- package/src/locales/fr.json +10 -0
- package/src/locales/it.json +10 -0
- package/src/molecule3d/core/bondNeighbours.ts +108 -0
- package/src/molecule3d/core/file.ts +18 -4
- package/src/molecule3d/core/index.ts +17 -3
- package/src/molecule3d/core/partialBondMode.ts +48 -0
- package/src/molecule3d/core/partialBondRanges.ts +120 -0
- package/src/molecule3d/core/partialBonds.ts +180 -0
- package/src/molecule3d/core/settings.ts +29 -52
- package/src/molecule3d/core/tools.ts +51 -0
- package/src/molecule3d/ui/Molecule3DExport.tsx +17 -2
- package/src/molecule3d/ui/Molecule3DOptions.tsx +16 -3
- package/src/molecule3d/ui/Molecule3DPartialBonds.tsx +100 -0
- package/src/molecule3d/ui/Molecule3DToolbar.tsx +2 -2
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +3 -4
- package/src/molecule3d/ui/drawScene.ts +15 -2
- package/src/molecule3d/ui/moleculeFileFormats.ts +5 -3
- package/src/molecule3d/ui/moleculeViewer3DProps.ts +2 -1
- package/src/molecule3d/ui/partialBondShapes.ts +246 -0
- package/src/molecule3d/ui/renderMolecule.ts +20 -0
- package/src/molecule3d/ui/renderPartialBonds.ts +122 -0
- package/src/molecule3d/ui/structureGeometry.ts +73 -0
- package/src/molecule3d/ui/usePolarSurfaceArea.ts +5 -4
- package/src/molecule3d/ui/viewer.ts +12 -0
- package/src/molecule3d/ui/viewerTypes.ts +19 -0
- package/src/panel/ui/FilterInput.tsx +24 -0
- package/src/shell/ui/ShellFrame.tsx +7 -1
- package/styles/chrome.css +30 -6
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The atoms of a molstar structure and the bonds molstar drew between them,
|
|
3
|
+
* as the plain arrays `findPartialBonds` reads.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
|
|
7
|
+
import type {
|
|
8
|
+
ElementIndex,
|
|
9
|
+
Structure,
|
|
10
|
+
} from 'molstar/lib/mol-model/structure.js';
|
|
11
|
+
import { Unit } from 'molstar/lib/mol-model/structure.js';
|
|
12
|
+
|
|
13
|
+
import type { PartialBondGeometry } from '../core/partialBonds.ts';
|
|
14
|
+
|
|
15
|
+
/** {@link PartialBondGeometry}, its arrays typed as they are built. */
|
|
16
|
+
export interface StructureGeometry extends PartialBondGeometry {
|
|
17
|
+
readonly elements: readonly string[];
|
|
18
|
+
readonly coordinates: Float64Array;
|
|
19
|
+
readonly bonds: Int32Array;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The atomic units of a structure, one after the other: their atoms in the
|
|
24
|
+
* order of each unit — the order of the file, for a molecule read from one —
|
|
25
|
+
* at the coordinates of the frame on screen, and every bond molstar drew,
|
|
26
|
+
* within a unit or between two.
|
|
27
|
+
* @param structure - The structure on screen.
|
|
28
|
+
* @returns Its atoms and bonds.
|
|
29
|
+
*/
|
|
30
|
+
export function structureGeometry(structure: Structure): StructureGeometry {
|
|
31
|
+
const units = structure.units;
|
|
32
|
+
const offsets = new Map<number, number>();
|
|
33
|
+
let count = 0;
|
|
34
|
+
for (let index = 0; index < units.length; index++) {
|
|
35
|
+
const unit = units[index];
|
|
36
|
+
if (unit === undefined || !Unit.isAtomic(unit)) continue;
|
|
37
|
+
offsets.set(unit.id, count);
|
|
38
|
+
count += unit.elements.length;
|
|
39
|
+
}
|
|
40
|
+
const elements: string[] = [];
|
|
41
|
+
const coordinates = new Float64Array(count * 3);
|
|
42
|
+
const bonds: number[] = [];
|
|
43
|
+
const point = Vec3.zero();
|
|
44
|
+
for (let index = 0; index < units.length; index++) {
|
|
45
|
+
const unit = units[index];
|
|
46
|
+
if (unit === undefined || !Unit.isAtomic(unit)) continue;
|
|
47
|
+
const offset = offsets.get(unit.id) ?? 0;
|
|
48
|
+
const symbols = unit.model.atomicHierarchy.atoms.type_symbol;
|
|
49
|
+
const atoms = unit.elements;
|
|
50
|
+
for (let local = 0; local < atoms.length; local++) {
|
|
51
|
+
const atom = atoms[local] as ElementIndex;
|
|
52
|
+
elements.push(symbols.value(atom));
|
|
53
|
+
unit.conformation.position(atom, point);
|
|
54
|
+
coordinates[(offset + local) * 3] = point[0] ?? 0;
|
|
55
|
+
coordinates[(offset + local) * 3 + 1] = point[1] ?? 0;
|
|
56
|
+
coordinates[(offset + local) * 3 + 2] = point[2] ?? 0;
|
|
57
|
+
}
|
|
58
|
+
// Every bond is listed from both ends; each is taken once.
|
|
59
|
+
const { a, b } = unit.bonds;
|
|
60
|
+
for (let edge = 0; edge < a.length; edge++) {
|
|
61
|
+
const from = a[edge] ?? 0;
|
|
62
|
+
const to = b[edge] ?? 0;
|
|
63
|
+
if (from < to) bonds.push(offset + from, offset + to);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
for (const edge of structure.interUnitBonds.edges) {
|
|
67
|
+
const first = offsets.get(edge.unitA);
|
|
68
|
+
const second = offsets.get(edge.unitB);
|
|
69
|
+
if (first === undefined || second === undefined) continue;
|
|
70
|
+
bonds.push(first + edge.indexA, second + edge.indexB);
|
|
71
|
+
}
|
|
72
|
+
return { elements, coordinates, bonds: Int32Array.from(bonds) };
|
|
73
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import type { Molecule3DFile } from '../core/file.ts';
|
|
4
|
+
import { isMolfileFormat } from '../core/file.ts';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Ertl's topological polar surface area of the molecule, from openchemlib,
|
|
7
8
|
* loaded only once a caller asks for it.
|
|
8
9
|
* @param molfile - The molecule, or `null`.
|
|
9
10
|
* @param enabled - Whether to compute it at all.
|
|
10
|
-
* @returns The area in Ų, or `null` while unknown, disabled, for
|
|
11
|
-
*
|
|
11
|
+
* @returns The area in Ų, or `null` while unknown, disabled, for a file that
|
|
12
|
+
* is not a molfile, or when openchemlib is not installed or cannot read it.
|
|
12
13
|
*/
|
|
13
14
|
export function usePolarSurfaceArea(
|
|
14
15
|
molfile: Molecule3DFile | null,
|
|
@@ -18,9 +19,9 @@ export function usePolarSurfaceArea(
|
|
|
18
19
|
data: string;
|
|
19
20
|
area: number | null;
|
|
20
21
|
} | null>(null);
|
|
21
|
-
//
|
|
22
|
+
// openchemlib finds the polar atoms by the bonds of a molfile.
|
|
22
23
|
const data =
|
|
23
|
-
enabled && molfile
|
|
24
|
+
enabled && molfile && isMolfileFormat(molfile.format) ? molfile.data : null;
|
|
24
25
|
|
|
25
26
|
useEffect(() => {
|
|
26
27
|
if (data === null) return;
|
|
@@ -33,11 +33,13 @@ import {
|
|
|
33
33
|
moleculeStructure,
|
|
34
34
|
renderMolecule,
|
|
35
35
|
} from './renderMolecule.ts';
|
|
36
|
+
import { renderPartialBonds } from './renderPartialBonds.ts';
|
|
36
37
|
import { clearSurface, renderSurface } from './renderSurface.ts';
|
|
37
38
|
import { SceneWatches } from './sceneWatches.ts';
|
|
38
39
|
import type {
|
|
39
40
|
Molecule3DViewerOptions,
|
|
40
41
|
MoleculeStyle,
|
|
42
|
+
PartialBondStyle,
|
|
41
43
|
SurfaceStyle,
|
|
42
44
|
} from './viewerTypes.ts';
|
|
43
45
|
|
|
@@ -117,6 +119,16 @@ export class Molecule3DViewer extends SceneWatches {
|
|
|
117
119
|
);
|
|
118
120
|
}
|
|
119
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Draw the partial bonds of the current molecule, dashed: pairs a little too
|
|
124
|
+
* far apart to be bonded. Another molecule takes them away with it.
|
|
125
|
+
* @param style - See {@link PartialBondStyle}.
|
|
126
|
+
* @returns Nothing; resolves once they are on screen.
|
|
127
|
+
*/
|
|
128
|
+
showPartialBonds(style?: PartialBondStyle): Promise<void> {
|
|
129
|
+
return this.#plugin.run((plugin) => renderPartialBonds(plugin, style));
|
|
130
|
+
}
|
|
131
|
+
|
|
120
132
|
/**
|
|
121
133
|
* Add or restyle the molecular surface over the current molecule.
|
|
122
134
|
* @param style - See {@link SurfaceStyle}.
|
|
@@ -41,6 +41,25 @@ export interface MoleculeStyle {
|
|
|
41
41
|
sizeFactor?: number;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/** How to draw the partial bonds, sized after the model they are drawn over. */
|
|
45
|
+
export interface PartialBondStyle {
|
|
46
|
+
/**
|
|
47
|
+
* The representation of the model.
|
|
48
|
+
* @default 'ball-and-stick'
|
|
49
|
+
*/
|
|
50
|
+
representation?: RepresentationId;
|
|
51
|
+
/**
|
|
52
|
+
* The model's radius multiplier.
|
|
53
|
+
* @default 1
|
|
54
|
+
*/
|
|
55
|
+
sizeFactor?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Whether each is labelled with its length.
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
lengths?: boolean;
|
|
61
|
+
}
|
|
62
|
+
|
|
44
63
|
/** How to draw the molecular surface. */
|
|
45
64
|
export interface SurfaceStyle {
|
|
46
65
|
/**
|
|
@@ -17,6 +17,17 @@ export interface FilterInputProps {
|
|
|
17
17
|
* @default false
|
|
18
18
|
*/
|
|
19
19
|
autoFocus?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* What a screen reader calls the box.
|
|
22
|
+
* @default undefined — the placeholder names it
|
|
23
|
+
*/
|
|
24
|
+
ariaLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Called when Enter is pressed in the box, to open the entry the filter
|
|
27
|
+
* leads to.
|
|
28
|
+
* @default undefined — Enter does nothing
|
|
29
|
+
*/
|
|
30
|
+
onEnter?: () => void;
|
|
20
31
|
}
|
|
21
32
|
|
|
22
33
|
/**
|
|
@@ -36,6 +47,7 @@ export interface FilterInputProps {
|
|
|
36
47
|
*/
|
|
37
48
|
export function FilterInput(props: FilterInputProps) {
|
|
38
49
|
const { value, onValueChange, placeholder, autoFocus = false } = props;
|
|
50
|
+
const { ariaLabel, onEnter } = props;
|
|
39
51
|
const t = useChromeT();
|
|
40
52
|
|
|
41
53
|
return (
|
|
@@ -45,6 +57,7 @@ export function FilterInput(props: FilterInputProps) {
|
|
|
45
57
|
size="small"
|
|
46
58
|
value={value}
|
|
47
59
|
placeholder={placeholder}
|
|
60
|
+
aria-label={ariaLabel}
|
|
48
61
|
spellCheck={false}
|
|
49
62
|
autoCapitalize="off"
|
|
50
63
|
autoCorrect="off"
|
|
@@ -58,6 +71,17 @@ export function FilterInput(props: FilterInputProps) {
|
|
|
58
71
|
) : undefined
|
|
59
72
|
}
|
|
60
73
|
onValueChange={onValueChange}
|
|
74
|
+
onKeyDown={
|
|
75
|
+
onEnter === undefined
|
|
76
|
+
? undefined
|
|
77
|
+
: (event) => {
|
|
78
|
+
if (event.key !== 'Enter' || event.nativeEvent.isComposing) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
onEnter();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
61
85
|
/>
|
|
62
86
|
);
|
|
63
87
|
}
|
|
@@ -12,6 +12,7 @@ import { SiteFooter } from '../../chrome/ui/SiteFooter.tsx';
|
|
|
12
12
|
import { SiteHeader } from '../../chrome/ui/SiteHeader.tsx';
|
|
13
13
|
import { useCompactHeader } from '../../chrome/ui/useCompactHeader.ts';
|
|
14
14
|
import { CiteButton } from '../../citation/ui/CiteButton.tsx';
|
|
15
|
+
import { isEcosystemHome } from '../../ecosystem/core/home.ts';
|
|
15
16
|
import { EcosystemButton } from '../../ecosystem/ui/EcosystemButton.tsx';
|
|
16
17
|
import { SiteTheme } from '../../ecosystem/ui/SiteTheme.tsx';
|
|
17
18
|
import type { ShareParamCodecs } from '../../share/core/index.ts';
|
|
@@ -131,6 +132,7 @@ function ShellActions<Codecs extends ShareParamCodecs, Tab extends string>(
|
|
|
131
132
|
): ReactNode {
|
|
132
133
|
const {
|
|
133
134
|
siteId,
|
|
135
|
+
site,
|
|
134
136
|
about = false,
|
|
135
137
|
cite,
|
|
136
138
|
ecosystem = true,
|
|
@@ -161,7 +163,11 @@ function ShellActions<Codecs extends ShareParamCodecs, Tab extends string>(
|
|
|
161
163
|
)}
|
|
162
164
|
{fill(actionsAfterCite, compact)}
|
|
163
165
|
{ecosystem ? (
|
|
164
|
-
<EcosystemButton
|
|
166
|
+
<EcosystemButton
|
|
167
|
+
currentSiteId={siteId}
|
|
168
|
+
atHome={isEcosystemHome(site?.host)}
|
|
169
|
+
compact={compact}
|
|
170
|
+
/>
|
|
165
171
|
) : null}
|
|
166
172
|
{fill(actions, compact)}
|
|
167
173
|
{fill(language, compact)}
|
package/styles/chrome.css
CHANGED
|
@@ -2333,10 +2333,16 @@ span.taxon-lineage__name {
|
|
|
2333
2333
|
chevron says which are folded, and the border under an open header closes it
|
|
2334
2334
|
against its body.
|
|
2335
2335
|
|
|
2336
|
+
Two markups are matched. Before react-science 24.1 the header is itself the
|
|
2337
|
+
`role="button"`; from 24.1 it is a plain element holding a real button, the
|
|
2338
|
+
title, which the browser would otherwise draw with its own border and
|
|
2339
|
+
background.
|
|
2340
|
+
|
|
2336
2341
|
The chevron leads the header, where a disclosure is looked for. react-science
|
|
2337
2342
|
draws every header button on the right, so the chevron is lifted out of that
|
|
2338
2343
|
run and set before the title. */
|
|
2339
|
-
[role='button']:has(.side-panel__fold)
|
|
2344
|
+
[role='button']:has(.side-panel__fold),
|
|
2345
|
+
:has(> button[aria-expanded]):has(.side-panel__fold) {
|
|
2340
2346
|
position: relative;
|
|
2341
2347
|
padding-left: 32px;
|
|
2342
2348
|
border-top: 1px solid var(--border);
|
|
@@ -2345,16 +2351,31 @@ span.taxon-lineage__name {
|
|
|
2345
2351
|
text-shadow: none;
|
|
2346
2352
|
}
|
|
2347
2353
|
|
|
2348
|
-
[role='button']:has(.side-panel__fold):hover
|
|
2354
|
+
[role='button']:has(.side-panel__fold):hover,
|
|
2355
|
+
:has(> button[aria-expanded]):has(.side-panel__fold):hover {
|
|
2349
2356
|
background: color-mix(in oklab, var(--text) 9%, var(--surface-sunken));
|
|
2350
2357
|
}
|
|
2351
2358
|
|
|
2352
|
-
[role='button']:has(.side-panel__fold[data-panel-open='true'])
|
|
2359
|
+
[role='button']:has(.side-panel__fold[data-panel-open='true']),
|
|
2360
|
+
:has(> button[aria-expanded]):has(.side-panel__fold[data-panel-open='true']) {
|
|
2353
2361
|
border-bottom: 1px solid var(--border);
|
|
2354
2362
|
}
|
|
2355
2363
|
|
|
2364
|
+
/* The title, from react-science 24.1: the header's text, not a button. */
|
|
2365
|
+
:has(> button[aria-expanded]):has(.side-panel__fold) > button[aria-expanded] {
|
|
2366
|
+
padding: 5px 0;
|
|
2367
|
+
border: 0;
|
|
2368
|
+
background: none;
|
|
2369
|
+
color: inherit;
|
|
2370
|
+
cursor: pointer;
|
|
2371
|
+
font: inherit;
|
|
2372
|
+
font-weight: bold;
|
|
2373
|
+
text-align: left;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2356
2376
|
/* Under the header, so it outweighs the button's own emotion class. */
|
|
2357
|
-
[role='button'] .side-panel__fold
|
|
2377
|
+
[role='button'] .side-panel__fold,
|
|
2378
|
+
:has(> button[aria-expanded]) .side-panel__fold {
|
|
2358
2379
|
position: absolute;
|
|
2359
2380
|
top: 50%;
|
|
2360
2381
|
left: 2px;
|
|
@@ -2364,12 +2385,15 @@ span.taxon-lineage__name {
|
|
|
2364
2385
|
/* The pin stays quiet: pale while the panel is only passing through, and the
|
|
2365
2386
|
ink of the header's other buttons once it is kept, so the two read apart at
|
|
2366
2387
|
a glance. Never the brand colour, which marks where the reader is. */
|
|
2367
|
-
[role='button'] .side-panel__pin .bp6-icon
|
|
2388
|
+
[role='button'] .side-panel__pin .bp6-icon,
|
|
2389
|
+
:has(> button[aria-expanded]) .side-panel__pin .bp6-icon {
|
|
2368
2390
|
color: color-mix(in oklab, var(--text-faint) 50%, var(--surface));
|
|
2369
2391
|
}
|
|
2370
2392
|
|
|
2371
2393
|
[role='button'] .side-panel__pin:hover .bp6-icon,
|
|
2372
|
-
[role='button'] .side-panel__pin--on .bp6-icon
|
|
2394
|
+
[role='button'] .side-panel__pin--on .bp6-icon,
|
|
2395
|
+
:has(> button[aria-expanded]) .side-panel__pin:hover .bp6-icon,
|
|
2396
|
+
:has(> button[aria-expanded]) .side-panel__pin--on .bp6-icon {
|
|
2373
2397
|
color: var(--text-muted);
|
|
2374
2398
|
}
|
|
2375
2399
|
|