react-cheminfo 0.32.0 → 0.34.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 -1
- package/lib/axis/core/axisMarks.d.ts +54 -0
- package/lib/axis/core/axisMarks.d.ts.map +1 -0
- package/lib/axis/core/axisMarks.js +69 -0
- package/lib/axis/core/axisMarks.js.map +1 -0
- package/lib/axis/core/axisScale.d.ts +31 -0
- package/lib/axis/core/axisScale.d.ts.map +1 -0
- package/lib/axis/core/axisScale.js +31 -0
- package/lib/axis/core/axisScale.js.map +1 -0
- package/lib/axis/core/index.d.ts +16 -0
- package/lib/axis/core/index.d.ts.map +1 -0
- package/lib/axis/core/index.js +13 -0
- package/lib/axis/core/index.js.map +1 -0
- package/lib/axis/core/logAxisBounds.d.ts +78 -0
- package/lib/axis/core/logAxisBounds.d.ts.map +1 -0
- package/lib/axis/core/logAxisBounds.js +129 -0
- package/lib/axis/core/logAxisBounds.js.map +1 -0
- package/lib/axis/ui/AxisScaleControl.d.ts +66 -0
- package/lib/axis/ui/AxisScaleControl.d.ts.map +1 -0
- package/lib/axis/ui/AxisScaleControl.js +26 -0
- package/lib/axis/ui/AxisScaleControl.js.map +1 -0
- package/lib/axis/ui/index.d.ts +6 -0
- package/lib/axis/ui/index.d.ts.map +1 -0
- package/lib/axis/ui/index.js +5 -0
- package/lib/axis/ui/index.js.map +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/delimited/core/index.d.ts +2 -0
- package/lib/delimited/core/index.d.ts.map +1 -1
- package/lib/delimited/core/index.js +1 -0
- package/lib/delimited/core/index.js.map +1 -1
- package/lib/delimited/core/tableRows.d.ts +49 -0
- package/lib/delimited/core/tableRows.d.ts.map +1 -0
- package/lib/delimited/core/tableRows.js +63 -0
- package/lib/delimited/core/tableRows.js.map +1 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts +9 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts.map +1 -1
- package/lib/delimited/ui/DelimitedTextPanel.js +3 -2
- package/lib/delimited/ui/DelimitedTextPanel.js.map +1 -1
- package/lib/delimited/ui/TableDataButton.d.ts +96 -0
- package/lib/delimited/ui/TableDataButton.d.ts.map +1 -0
- package/lib/delimited/ui/TableDataButton.js +39 -0
- package/lib/delimited/ui/TableDataButton.js.map +1 -0
- package/lib/delimited/ui/index.d.ts +2 -0
- package/lib/delimited/ui/index.d.ts.map +1 -1
- package/lib/delimited/ui/index.js +1 -0
- package/lib/delimited/ui/index.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 +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 +465 -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/core/index.d.ts +1 -1
- package/lib/periodic/core/index.d.ts.map +1 -1
- package/lib/periodic/core/index.js +1 -1
- package/lib/periodic/core/index.js.map +1 -1
- package/lib/periodic/core/layout.d.ts +18 -0
- package/lib/periodic/core/layout.d.ts.map +1 -1
- package/lib/periodic/core/layout.js +9 -0
- package/lib/periodic/core/layout.js.map +1 -1
- package/lib/periodic/ui/ElementCell.js +15 -3
- package/lib/periodic/ui/ElementCell.js.map +1 -1
- package/lib/periodic/ui/PeriodicTable.d.ts +12 -1
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +25 -3
- package/lib/periodic/ui/PeriodicTable.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/axis/core/axisMarks.ts +114 -0
- package/src/axis/core/axisScale.ts +41 -0
- package/src/axis/core/index.ts +20 -0
- package/src/axis/core/logAxisBounds.ts +198 -0
- package/src/axis/ui/AxisScaleControl.tsx +103 -0
- package/src/axis/ui/index.ts +9 -0
- package/src/core.ts +1 -0
- package/src/delimited/core/index.ts +2 -0
- package/src/delimited/core/tableRows.ts +93 -0
- package/src/delimited/ui/DelimitedTextPanel.tsx +25 -9
- package/src/delimited/ui/TableDataButton.tsx +162 -0
- package/src/delimited/ui/index.ts +2 -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 +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 +465 -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/core/index.ts +1 -0
- package/src/periodic/core/layout.ts +19 -0
- package/src/periodic/ui/ElementCell.tsx +15 -3
- package/src/periodic/ui/PeriodicTable.tsx +45 -1
- package/src/ui.ts +1 -0
- package/styles/chrome.css +71 -0
|
@@ -84,6 +84,25 @@ let placedCache: ReadonlyArray<{
|
|
|
84
84
|
cell: Cell;
|
|
85
85
|
}> | null = null;
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* The block of cells the table leaves empty, where no element belongs: logical
|
|
89
|
+
* columns 3 to 12 of the first three periods.
|
|
90
|
+
*
|
|
91
|
+
* It is a tenth of the drawing, in the middle of the top edge, and the one
|
|
92
|
+
* place a tool can write without covering an element — which is why a table
|
|
93
|
+
* printed on a wall puts its title or its key there.
|
|
94
|
+
*/
|
|
95
|
+
export const EMPTY_BLOCK: {
|
|
96
|
+
/** Leftmost column of the block, one-based. */
|
|
97
|
+
column: number;
|
|
98
|
+
/** Topmost row of the block, one-based. */
|
|
99
|
+
row: number;
|
|
100
|
+
/** How many columns it spans. */
|
|
101
|
+
columnSpan: number;
|
|
102
|
+
/** How many rows it spans. */
|
|
103
|
+
rowSpan: number;
|
|
104
|
+
} = { column: 3, row: 1, columnSpan: 10, rowSpan: 3 };
|
|
105
|
+
|
|
87
106
|
/**
|
|
88
107
|
* The two cells the lanthanoids and the actinoids were lifted out of.
|
|
89
108
|
*
|
|
@@ -263,16 +263,28 @@ const cellStyle = {
|
|
|
263
263
|
minWidth: 0,
|
|
264
264
|
overflow: 'hidden',
|
|
265
265
|
padding: '1px',
|
|
266
|
+
// The corner the atomic number is pinned into.
|
|
267
|
+
position: 'relative',
|
|
266
268
|
transition: 'opacity 120ms ease, filter 120ms ease',
|
|
267
269
|
} as const satisfies CSSProperties;
|
|
268
270
|
|
|
271
|
+
/**
|
|
272
|
+
* The atomic number sits out of the flow, in the corner.
|
|
273
|
+
*
|
|
274
|
+
* In the flow it rode on top of a stack the cell centres, so it moved down
|
|
275
|
+
* whenever what is written under the symbol was written smaller — the numbers
|
|
276
|
+
* of a row then sat at as many heights as the row had word lengths. Out of it,
|
|
277
|
+
* the number is in the same corner of every cell, and the symbol is centred in
|
|
278
|
+
* the cell rather than in what is left of it.
|
|
279
|
+
*/
|
|
269
280
|
const numberStyle = {
|
|
270
|
-
|
|
271
|
-
fontSize: 'max(0.33rem, 1.2cqw)',
|
|
281
|
+
fontSize: 'max(0.33rem, 1.1cqw)',
|
|
272
282
|
fontVariantNumeric: 'tabular-nums',
|
|
283
|
+
left: 'max(1px, 0.14cqw)',
|
|
273
284
|
lineHeight: 1,
|
|
274
285
|
opacity: 0.8,
|
|
275
|
-
|
|
286
|
+
position: 'absolute',
|
|
287
|
+
top: 'max(1px, 0.14cqw)',
|
|
276
288
|
} as const satisfies CSSProperties;
|
|
277
289
|
|
|
278
290
|
const symbolStyle = {
|
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
* a site's own richer element record never has to cross into this component.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
CSSProperties,
|
|
15
|
+
KeyboardEvent,
|
|
16
|
+
ReactElement,
|
|
17
|
+
ReactNode,
|
|
18
|
+
} from 'react';
|
|
14
19
|
import { useEffect, useRef } from 'react';
|
|
15
20
|
|
|
16
21
|
import type { Swatch } from '../../color/core/interpolate.ts';
|
|
@@ -20,6 +25,7 @@ import type { PeriodicElement } from '../core/elements.ts';
|
|
|
20
25
|
import type { ElementRange } from '../core/layout.ts';
|
|
21
26
|
import {
|
|
22
27
|
COLUMN_COUNT,
|
|
28
|
+
EMPTY_BLOCK,
|
|
23
29
|
elementByArrowKey,
|
|
24
30
|
placedElements,
|
|
25
31
|
} from '../core/layout.ts';
|
|
@@ -66,6 +72,17 @@ export interface PeriodicTableProps {
|
|
|
66
72
|
* @default every element is
|
|
67
73
|
*/
|
|
68
74
|
isIncluded?: (element: PeriodicElement) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* What is written in the block the table leaves empty — columns 3 to 12 of
|
|
77
|
+
* the first three periods, in the middle of the top edge. A tool that reads
|
|
78
|
+
* one element off the table puts what it says about it there, where the eye
|
|
79
|
+
* already is, rather than under the grid.
|
|
80
|
+
*
|
|
81
|
+
* It is sized against the table, like everything else in the grid, so give
|
|
82
|
+
* it type in `em` and it scales with the drawing.
|
|
83
|
+
* @default undefined — the block stays empty
|
|
84
|
+
*/
|
|
85
|
+
inset?: ReactNode;
|
|
69
86
|
/**
|
|
70
87
|
* Whether to draw the group and period strips.
|
|
71
88
|
* @default false
|
|
@@ -119,6 +136,7 @@ export function PeriodicTable(props: PeriodicTableProps): ReactElement {
|
|
|
119
136
|
detailOf,
|
|
120
137
|
nameOf = defaultNameOf,
|
|
121
138
|
isIncluded,
|
|
139
|
+
inset,
|
|
122
140
|
headers = false,
|
|
123
141
|
onSelectRange,
|
|
124
142
|
legend = false,
|
|
@@ -164,6 +182,9 @@ export function PeriodicTable(props: PeriodicTableProps): ReactElement {
|
|
|
164
182
|
onKeyDown={handleKeyDown}
|
|
165
183
|
>
|
|
166
184
|
{headers ? <HeaderStrips onSelectRange={onSelectRange} /> : null}
|
|
185
|
+
{inset === undefined ? null : (
|
|
186
|
+
<div style={insetStyle(offset)}>{inset}</div>
|
|
187
|
+
)}
|
|
167
188
|
{markers ? <InnerTransitionMarkers offset={offset} /> : null}
|
|
168
189
|
{placedElements().map(({ element, cell }) => (
|
|
169
190
|
<ElementCell
|
|
@@ -188,6 +209,29 @@ export function PeriodicTable(props: PeriodicTableProps): ReactElement {
|
|
|
188
209
|
);
|
|
189
210
|
}
|
|
190
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Where what the caller writes in the empty block is placed.
|
|
214
|
+
* @param offset - 1 when the table draws its header strips, 0 otherwise.
|
|
215
|
+
* @returns The style of the slot.
|
|
216
|
+
*/
|
|
217
|
+
function insetStyle(offset: number): CSSProperties {
|
|
218
|
+
return {
|
|
219
|
+
alignItems: 'center',
|
|
220
|
+
display: 'flex',
|
|
221
|
+
// Narrower than the block so the writing never touches the cells beside it.
|
|
222
|
+
padding: '0 1cqw',
|
|
223
|
+
gridColumn: `${String(EMPTY_BLOCK.column + offset)} / span ${String(EMPTY_BLOCK.columnSpan)}`,
|
|
224
|
+
gridRow: `${String(EMPTY_BLOCK.row + offset)} / span ${String(EMPTY_BLOCK.rowSpan)}`,
|
|
225
|
+
// A share of the table, with a floor, exactly as a cell sizes its symbol:
|
|
226
|
+
// the block holds the same three rows at every width, so what is written
|
|
227
|
+
// in it has to shrink with them.
|
|
228
|
+
fontSize: 'max(0.6rem, 1.8cqw)',
|
|
229
|
+
lineHeight: 1.35,
|
|
230
|
+
minWidth: 0,
|
|
231
|
+
overflow: 'hidden',
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
191
235
|
function defaultSwatchOf(element: PeriodicElement): Swatch {
|
|
192
236
|
return categorySwatch(element.category);
|
|
193
237
|
}
|
package/src/ui.ts
CHANGED
package/styles/chrome.css
CHANGED
|
@@ -570,6 +570,77 @@ select,
|
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
|
|
573
|
+
/* ── Help ────────────────────────────────────────────────────────────────── */
|
|
574
|
+
|
|
575
|
+
/*
|
|
576
|
+
Every piece of help in the family opens as the same card, so a reader who has
|
|
577
|
+
met one on one site has met them all: the page's own surface, its border, its
|
|
578
|
+
radius and its shadow. Blueprint's navy slab is a hole in a light page, and
|
|
579
|
+
its 14px body turns an explanation into a wall — the same words at 12.5px
|
|
580
|
+
over 1.55 read as prose.
|
|
581
|
+
*/
|
|
582
|
+
.help-tooltip .bp6-popover-content {
|
|
583
|
+
/*
|
|
584
|
+
One measure for every card, so two opened in a row are the same shape.
|
|
585
|
+
Left to itself the popover is shrink-wrapped around its own longest line.
|
|
586
|
+
*/
|
|
587
|
+
width: 300px;
|
|
588
|
+
padding: 10px 12px;
|
|
589
|
+
border: 1px solid var(--border);
|
|
590
|
+
border-radius: var(--radius);
|
|
591
|
+
background: var(--surface);
|
|
592
|
+
box-shadow: none;
|
|
593
|
+
color: var(--text);
|
|
594
|
+
font-size: 12.5px;
|
|
595
|
+
line-height: 1.55;
|
|
596
|
+
text-wrap: pretty;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/*
|
|
600
|
+
Blueprint opens a tooltip by transitioning it from `scale(0.8)`, and under
|
|
601
|
+
React 19 that transition is created but never ticks: it sits at time zero for
|
|
602
|
+
as long as the card is open, so the card and its type stay at four fifths of
|
|
603
|
+
the size they were drawn at. Help opens without an animation instead.
|
|
604
|
+
*/
|
|
605
|
+
.help-tooltip.bp6-tooltip {
|
|
606
|
+
border-radius: var(--radius);
|
|
607
|
+
box-shadow: var(--shadow-md);
|
|
608
|
+
transform: scale(1);
|
|
609
|
+
transition: none;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/* The arrow is a corner of the same card, so it carries the same two colours. */
|
|
613
|
+
.help-tooltip .bp6-popover-arrow-fill {
|
|
614
|
+
fill: var(--surface);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.help-tooltip .bp6-popover-arrow-border {
|
|
618
|
+
fill: var(--border);
|
|
619
|
+
fill-opacity: 1;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
.help-tooltip .bp6-popover-arrow::before {
|
|
623
|
+
box-shadow: none;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
.help-tooltip .help-body a {
|
|
627
|
+
color: var(--accent);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/*
|
|
631
|
+
The glyph that opens it. How it sits in its row is the site's business — it
|
|
632
|
+
follows a label on one and a heading on another — so only its ink is set
|
|
633
|
+
here.
|
|
634
|
+
*/
|
|
635
|
+
.help-icon {
|
|
636
|
+
color: var(--text-faint);
|
|
637
|
+
cursor: help;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.help-icon:hover {
|
|
641
|
+
color: var(--accent);
|
|
642
|
+
}
|
|
643
|
+
|
|
573
644
|
/* ── Printing ────────────────────────────────────────────────────────────── */
|
|
574
645
|
|
|
575
646
|
/* Students print the cheatsheet. Let them, without the chrome. */
|