react-cheminfo 0.31.0 → 0.33.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 +1 -0
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +2 -2
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/i18n/core/chromeCatalog.js +10 -4
- package/lib/i18n/core/chromeCatalog.js.map +1 -1
- package/lib/i18n/core/index.d.ts +2 -0
- package/lib/i18n/core/index.d.ts.map +1 -1
- package/lib/i18n/core/index.js +1 -0
- package/lib/i18n/core/index.js.map +1 -1
- package/lib/i18n/core/languages.d.ts +4 -4
- package/lib/i18n/core/languages.d.ts.map +1 -1
- package/lib/i18n/core/languages.js +5 -4
- package/lib/i18n/core/languages.js.map +1 -1
- package/lib/i18n/core/prose.d.ts +32 -0
- package/lib/i18n/core/prose.d.ts.map +1 -0
- package/lib/i18n/core/prose.js +45 -0
- package/lib/i18n/core/prose.js.map +1 -0
- package/lib/i18n/ui/Prose.d.ts +28 -0
- package/lib/i18n/ui/Prose.d.ts.map +1 -0
- package/lib/i18n/ui/Prose.js +14 -0
- package/lib/i18n/ui/Prose.js.map +1 -0
- package/lib/i18n/ui/index.d.ts +2 -0
- package/lib/i18n/ui/index.d.ts.map +1 -1
- package/lib/i18n/ui/index.js +1 -0
- package/lib/i18n/ui/index.js.map +1 -1
- package/lib/locales/de.json +7 -1
- package/lib/locales/en.json +7 -1
- package/lib/locales/es.json +7 -1
- package/lib/locales/fr.json +7 -1
- package/lib/locales/it.json +459 -0
- package/lib/number/core/index.d.ts +2 -0
- package/lib/number/core/index.d.ts.map +1 -0
- package/lib/number/core/index.js +2 -0
- package/lib/number/core/index.js.map +1 -0
- package/lib/number/core/numberText.d.ts +46 -0
- package/lib/number/core/numberText.d.ts.map +1 -0
- package/lib/number/core/numberText.js +88 -0
- package/lib/number/core/numberText.js.map +1 -0
- package/lib/number/ui/NumberInput.d.ts +113 -0
- package/lib/number/ui/NumberInput.d.ts.map +1 -0
- package/lib/number/ui/NumberInput.js +100 -0
- package/lib/number/ui/NumberInput.js.map +1 -0
- package/lib/number/ui/index.d.ts +3 -0
- package/lib/number/ui/index.d.ts.map +1 -0
- package/lib/number/ui/index.js +2 -0
- package/lib/number/ui/index.js.map +1 -0
- package/lib/orbital/ui/AtomicOrbitalCanvas.d.ts +12 -2
- package/lib/orbital/ui/AtomicOrbitalCanvas.d.ts.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalCanvas.js +17 -3
- package/lib/orbital/ui/AtomicOrbitalCanvas.js.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalControls.d.ts +10 -5
- package/lib/orbital/ui/AtomicOrbitalControls.d.ts.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalControls.js +12 -7
- package/lib/orbital/ui/AtomicOrbitalControls.js.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalViewer.d.ts +8 -1
- package/lib/orbital/ui/AtomicOrbitalViewer.d.ts.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalViewer.js.map +1 -1
- package/lib/periodic/ui/ElementCell.d.ts +10 -0
- package/lib/periodic/ui/ElementCell.d.ts.map +1 -1
- package/lib/periodic/ui/ElementCell.js +124 -14
- package/lib/periodic/ui/ElementCell.js.map +1 -1
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +46 -19
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/periodic/ui/PeriodicTableChrome.js +2 -2
- package/lib/periodic/ui/PeriodicTableChrome.js.map +1 -1
- package/lib/spectra/ui/NumberField.d.ts +2 -5
- package/lib/spectra/ui/NumberField.d.ts.map +1 -1
- package/lib/spectra/ui/NumberField.js +4 -54
- package/lib/spectra/ui/NumberField.js.map +1 -1
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/package.json +1 -1
- package/src/core.ts +1 -0
- package/src/i18n/core/chromeCatalog.ts +10 -4
- package/src/i18n/core/index.ts +2 -0
- package/src/i18n/core/languages.ts +5 -4
- package/src/i18n/core/prose.ts +53 -0
- package/src/i18n/ui/Prose.tsx +47 -0
- package/src/i18n/ui/index.ts +2 -0
- package/src/locales/de.json +7 -1
- package/src/locales/en.json +7 -1
- package/src/locales/es.json +7 -1
- package/src/locales/fr.json +7 -1
- package/src/locales/it.json +459 -0
- package/src/number/core/index.ts +6 -0
- package/src/number/core/numberText.ts +91 -0
- package/src/number/ui/NumberInput.tsx +300 -0
- package/src/number/ui/index.ts +7 -0
- package/src/orbital/ui/AtomicOrbitalCanvas.tsx +32 -5
- package/src/orbital/ui/AtomicOrbitalControls.tsx +26 -6
- package/src/orbital/ui/AtomicOrbitalViewer.tsx +8 -1
- package/src/periodic/ui/ElementCell.tsx +153 -14
- package/src/periodic/ui/PeriodicTable.tsx +51 -22
- package/src/periodic/ui/PeriodicTableChrome.tsx +2 -2
- package/src/spectra/ui/NumberField.tsx +11 -58
- package/src/ui.ts +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cutting a paragraph at the placeholders that stand for something drawn.
|
|
3
|
+
*
|
|
4
|
+
* Pure, and its own module: where a link falls in a sentence is the
|
|
5
|
+
* translator's decision — German puts the verb last, French rewrites the
|
|
6
|
+
* possessive around it — so the paragraph is one message with a `{name}` in it
|
|
7
|
+
* rather than fragments glued around a fixed anchor. What the pieces are drawn
|
|
8
|
+
* as is `Prose` in `react-cheminfo/ui`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** One piece of a paragraph: authored prose, or something the page draws. */
|
|
12
|
+
export type ProsePiece =
|
|
13
|
+
| { kind: 'text'; at: number; text: string }
|
|
14
|
+
| { kind: 'node'; at: number; name: string };
|
|
15
|
+
|
|
16
|
+
const PLACEHOLDER = /\{(?<name>\w+)\}/g;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Split a paragraph at the placeholders the page has something to draw for.
|
|
20
|
+
*
|
|
21
|
+
* A placeholder nobody named is left inside its text piece: it is either a
|
|
22
|
+
* value the message already had filled in, or a key a translation has got
|
|
23
|
+
* wrong, and neither is worth throwing the paragraph away for.
|
|
24
|
+
* @param text - The message, already written in the language of the page.
|
|
25
|
+
* @param names - The placeholders that stand for something drawn.
|
|
26
|
+
* @returns The pieces, in order, with no empty text piece between two nodes.
|
|
27
|
+
* `at` is the offset in the message, which makes it a stable React key.
|
|
28
|
+
*/
|
|
29
|
+
export function splitProse(
|
|
30
|
+
text: string,
|
|
31
|
+
names: readonly string[],
|
|
32
|
+
): ProsePiece[] {
|
|
33
|
+
const wanted = new Set(names);
|
|
34
|
+
const pieces: ProsePiece[] = [];
|
|
35
|
+
let cursor = 0;
|
|
36
|
+
for (const match of text.matchAll(PLACEHOLDER)) {
|
|
37
|
+
const name = match.groups?.name ?? '';
|
|
38
|
+
if (!wanted.has(name)) continue;
|
|
39
|
+
if (match.index > cursor) {
|
|
40
|
+
pieces.push({
|
|
41
|
+
kind: 'text',
|
|
42
|
+
at: cursor,
|
|
43
|
+
text: text.slice(cursor, match.index),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
pieces.push({ kind: 'node', at: match.index, name });
|
|
47
|
+
cursor = match.index + match[0].length;
|
|
48
|
+
}
|
|
49
|
+
if (cursor < text.length) {
|
|
50
|
+
pieces.push({ kind: 'text', at: cursor, text: text.slice(cursor) });
|
|
51
|
+
}
|
|
52
|
+
return pieces;
|
|
53
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A paragraph of authored prose, with its inline marks drawn and its links put
|
|
3
|
+
* back where the sentence wants them.
|
|
4
|
+
*
|
|
5
|
+
* An explanation page is prose, not labels: it carries bold lead-ins, italics
|
|
6
|
+
* and a handful of links into the tool. `**strong**`, `*emphasis*` and
|
|
7
|
+
* `` `code` `` are the inline marks `InlineText` reads. A link is a `{name}`
|
|
8
|
+
* placeholder instead, cut out by `splitProse`, so a translation decides where
|
|
9
|
+
* in the sentence it falls.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
13
|
+
import { Fragment } from 'react';
|
|
14
|
+
|
|
15
|
+
import { InlineText } from '../../pedagogy/ui/InlineText.tsx';
|
|
16
|
+
import { splitProse } from '../core/prose.ts';
|
|
17
|
+
|
|
18
|
+
/** Props of {@link Prose}. */
|
|
19
|
+
export interface ProseProps {
|
|
20
|
+
/** The message, already written in the language of the page. */
|
|
21
|
+
text: string;
|
|
22
|
+
/**
|
|
23
|
+
* What each `{name}` placeholder of the message stands for.
|
|
24
|
+
* @default {}
|
|
25
|
+
*/
|
|
26
|
+
nodes?: Readonly<Record<string, ReactNode>>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Draw one piece of prose.
|
|
31
|
+
* @param props - See {@link ProseProps}.
|
|
32
|
+
* @returns The prose, marks drawn and placeholders replaced.
|
|
33
|
+
*/
|
|
34
|
+
export function Prose(props: ProseProps): ReactElement {
|
|
35
|
+
const { text, nodes = {} } = props;
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
{splitProse(text, Object.keys(nodes)).map((piece) =>
|
|
39
|
+
piece.kind === 'text' ? (
|
|
40
|
+
<InlineText key={piece.at} text={piece.text} />
|
|
41
|
+
) : (
|
|
42
|
+
<Fragment key={piece.at}>{nodes[piece.name]}</Fragment>
|
|
43
|
+
),
|
|
44
|
+
)}
|
|
45
|
+
</>
|
|
46
|
+
);
|
|
47
|
+
}
|
package/src/i18n/ui/index.ts
CHANGED
package/src/locales/de.json
CHANGED
|
@@ -233,6 +233,7 @@
|
|
|
233
233
|
"overlay.hoverAName": "Fahren Sie über einen Namen, um zu sehen, was er bewirkt.",
|
|
234
234
|
"overlay.dismiss": "Schließen",
|
|
235
235
|
"delimited.copyTable": "Tabelle kopieren",
|
|
236
|
+
"delimited.copyOrDownload": "Daten kopieren oder herunterladen",
|
|
236
237
|
"delimited.close": "Schließen",
|
|
237
238
|
"delimited.separator": "Trennzeichen",
|
|
238
239
|
"delimited.save": "Speichern",
|
|
@@ -262,6 +263,9 @@
|
|
|
262
263
|
"orbital.axesTitle": "Kartesische Achsen",
|
|
263
264
|
"orbital.axesBody": "x, y und z durch den Kern zeichnen. Die Bezeichnung benennt ein Orbital danach, wo seine Keulen gegenüber ihnen liegen.",
|
|
264
265
|
"orbital.axesExample": "vier Keulen zwischen der y- und der z-Achse, keine auf einer von beiden.",
|
|
266
|
+
"orbital.spin": "Das Orbital drehen",
|
|
267
|
+
"orbital.spinTitle": "Drehung",
|
|
268
|
+
"orbital.spinBody": "Das Orbital langsam um seine senkrechte Achse drehen. Ein fester Blickwinkel verbirgt, welche Keulen auf Sie zeigen; ein drehendes Orbital nicht.",
|
|
265
269
|
"orbital.resetTitle": "Ansicht zurücksetzen",
|
|
266
270
|
"orbital.resetBody": "Zurück zu Blickwinkel und Zoom, mit denen das Orbital geöffnet wurde. Ein Wechsel des Orbitals behält die Ansicht bei, in die Sie es gedreht haben.",
|
|
267
271
|
"viewer.capability.noWindow": "Der 3D-Betrachter braucht ein Browserfenster.",
|
|
@@ -449,5 +453,7 @@
|
|
|
449
453
|
"molecule3d.input.scroll": "Scrollen",
|
|
450
454
|
"molecule3d.input.clickAtom": "Ein Atom anklicken",
|
|
451
455
|
"molecule3d.input.clickBackground": "Den Hintergrund anklicken",
|
|
452
|
-
"molecule3d.helpNote": "Die Tasten wirken, solange der Zeiger über dem Molekül ist. Auf dem Mac ist Ctrl die Control-Taste, nicht ⌘. Bei eingeschaltetem Messwerkzeug wählt ein Klick ein Atom."
|
|
456
|
+
"molecule3d.helpNote": "Die Tasten wirken, solange der Zeiger über dem Molekül ist. Auf dem Mac ist Ctrl die Control-Taste, nicht ⌘. Bei eingeschaltetem Messwerkzeug wählt ein Klick ein Atom.",
|
|
457
|
+
"number.increment": "Erhöhen",
|
|
458
|
+
"number.decrement": "Verringern"
|
|
453
459
|
}
|
package/src/locales/en.json
CHANGED
|
@@ -233,6 +233,7 @@
|
|
|
233
233
|
"overlay.hoverAName": "Hover a name for what it does.",
|
|
234
234
|
"overlay.dismiss": "Dismiss",
|
|
235
235
|
"delimited.copyTable": "Copy the table",
|
|
236
|
+
"delimited.copyOrDownload": "Copy or download data",
|
|
236
237
|
"delimited.close": "Close",
|
|
237
238
|
"delimited.separator": "Separator",
|
|
238
239
|
"delimited.save": "Save",
|
|
@@ -435,6 +436,9 @@
|
|
|
435
436
|
"orbital.axesTitle": "Cartesian axes",
|
|
436
437
|
"orbital.axesBody": "Draw x, y and z through the nucleus. The label names an orbital by where its lobes sit against them.",
|
|
437
438
|
"orbital.axesExample": "four lobes between the y and z axes, none on either.",
|
|
439
|
+
"orbital.spin": "Spin the orbital",
|
|
440
|
+
"orbital.spinTitle": "Spin",
|
|
441
|
+
"orbital.spinBody": "Turn the orbital slowly on its vertical axis. One fixed angle hides which lobes point towards you; a turning one does not.",
|
|
438
442
|
"orbital.resetTitle": "Reset the view",
|
|
439
443
|
"orbital.resetBody": "Back to the angle and zoom the orbital opened on. A change of orbital keeps whatever view you have turned it to.",
|
|
440
444
|
"viewer.capability.noWindow": "The 3D viewer needs a browser window.",
|
|
@@ -449,5 +453,7 @@
|
|
|
449
453
|
"conformers.strategyDetail.likely-random": "Draws torsions at random from the torsion database, weighted by how often each angle is seen in crystal structures.",
|
|
450
454
|
"conformers.strategyDetail.pure-random": "Draws every torsion uniformly at random, ignoring how likely the angle is — the widest spread and the least realistic set.",
|
|
451
455
|
"conformers.strategyDetail.likely-systematic": "Walks the torsion combinations in decreasing likelihood, so the first conformers are the most probable ones and the set is reproducible.",
|
|
452
|
-
"conformers.minimisation.none": "None (no energies)"
|
|
456
|
+
"conformers.minimisation.none": "None (no energies)",
|
|
457
|
+
"number.increment": "Increase",
|
|
458
|
+
"number.decrement": "Decrease"
|
|
453
459
|
}
|
package/src/locales/es.json
CHANGED
|
@@ -233,6 +233,7 @@
|
|
|
233
233
|
"overlay.hoverAName": "Pase el puntero sobre un nombre para ver qué hace.",
|
|
234
234
|
"overlay.dismiss": "Cerrar",
|
|
235
235
|
"delimited.copyTable": "Copiar la tabla",
|
|
236
|
+
"delimited.copyOrDownload": "Copiar o descargar los datos",
|
|
236
237
|
"delimited.close": "Cerrar",
|
|
237
238
|
"delimited.separator": "Separador",
|
|
238
239
|
"delimited.save": "Guardar",
|
|
@@ -262,6 +263,9 @@
|
|
|
262
263
|
"orbital.axesTitle": "Ejes cartesianos",
|
|
263
264
|
"orbital.axesBody": "Trazar x, y y z a través del núcleo. La etiqueta nombra un orbital por dónde quedan sus lóbulos respecto a ellos.",
|
|
264
265
|
"orbital.axesExample": "cuatro lóbulos entre los ejes y y z, ninguno sobre ninguno de los dos.",
|
|
266
|
+
"orbital.spin": "Girar el orbital",
|
|
267
|
+
"orbital.spinTitle": "Giro",
|
|
268
|
+
"orbital.spinBody": "Girar lentamente el orbital sobre su eje vertical. Un ángulo fijo oculta qué lóbulos apuntan hacia usted; uno que gira, no.",
|
|
265
269
|
"orbital.resetTitle": "Reiniciar la vista",
|
|
266
270
|
"orbital.resetBody": "Volver al ángulo y al zoom con los que se abrió el orbital. Un cambio de orbital conserva la vista a la que usted lo haya girado.",
|
|
267
271
|
"viewer.capability.noWindow": "El visor 3D necesita una ventana de navegador.",
|
|
@@ -449,5 +453,7 @@
|
|
|
449
453
|
"molecule3d.input.scroll": "Rueda",
|
|
450
454
|
"molecule3d.input.clickAtom": "Hacer clic en un átomo",
|
|
451
455
|
"molecule3d.input.clickBackground": "Hacer clic en el fondo",
|
|
452
|
-
"molecule3d.helpNote": "Las teclas actúan mientras el puntero está sobre la molécula. En un Mac, Ctrl es la tecla Control, no ⌘. Con una herramienta de medida activa, un clic elige un átomo."
|
|
456
|
+
"molecule3d.helpNote": "Las teclas actúan mientras el puntero está sobre la molécula. En un Mac, Ctrl es la tecla Control, no ⌘. Con una herramienta de medida activa, un clic elige un átomo.",
|
|
457
|
+
"number.increment": "Aumentar",
|
|
458
|
+
"number.decrement": "Disminuir"
|
|
453
459
|
}
|
package/src/locales/fr.json
CHANGED
|
@@ -233,6 +233,7 @@
|
|
|
233
233
|
"overlay.hoverAName": "Survolez un nom pour savoir ce qu'il fait.",
|
|
234
234
|
"overlay.dismiss": "Fermer",
|
|
235
235
|
"delimited.copyTable": "Copier le tableau",
|
|
236
|
+
"delimited.copyOrDownload": "Copier ou télécharger les données",
|
|
236
237
|
"delimited.close": "Fermer",
|
|
237
238
|
"delimited.separator": "Séparateur",
|
|
238
239
|
"delimited.save": "Enregistrer",
|
|
@@ -262,6 +263,9 @@
|
|
|
262
263
|
"orbital.axesTitle": "Axes cartésiens",
|
|
263
264
|
"orbital.axesBody": "Tracer x, y et z à travers le noyau. L'étiquette nomme une orbitale par la position de ses lobes par rapport à eux.",
|
|
264
265
|
"orbital.axesExample": "quatre lobes entre les axes y et z, aucun sur l'un ou l'autre.",
|
|
266
|
+
"orbital.spin": "Faire tourner l'orbitale",
|
|
267
|
+
"orbital.spinTitle": "Rotation",
|
|
268
|
+
"orbital.spinBody": "Faire tourner lentement l'orbitale sur son axe vertical. Un angle fixe cache quels lobes pointent vers vous ; une orbitale qui tourne, non.",
|
|
265
269
|
"orbital.resetTitle": "Réinitialiser la vue",
|
|
266
270
|
"orbital.resetBody": "Revenir à l'angle et au zoom d'ouverture de l'orbitale. Un changement d'orbitale conserve la vue à laquelle vous l'avez tournée.",
|
|
267
271
|
"viewer.capability.noWindow": "La visionneuse 3D a besoin d'une fenêtre de navigateur.",
|
|
@@ -449,5 +453,7 @@
|
|
|
449
453
|
"molecule3d.input.scroll": "Molette",
|
|
450
454
|
"molecule3d.input.clickAtom": "Cliquer un atome",
|
|
451
455
|
"molecule3d.input.clickBackground": "Cliquer le fond",
|
|
452
|
-
"molecule3d.helpNote": "Les touches agissent tant que le pointeur est sur la molécule. Sur un Mac, Ctrl est la touche Contrôle, pas ⌘. Avec un outil de mesure actif, un clic choisit un atome."
|
|
456
|
+
"molecule3d.helpNote": "Les touches agissent tant que le pointeur est sur la molécule. Sur un Mac, Ctrl est la touche Contrôle, pas ⌘. Avec un outil de mesure actif, un clic choisit un atome.",
|
|
457
|
+
"number.increment": "Augmenter",
|
|
458
|
+
"number.decrement": "Diminuer"
|
|
453
459
|
}
|