react-cheminfo 0.6.0 → 0.8.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.
Files changed (93) hide show
  1. package/README.md +16 -0
  2. package/lib/citation/core/index.d.ts +2 -0
  3. package/lib/citation/core/index.d.ts.map +1 -1
  4. package/lib/citation/core/index.js +2 -0
  5. package/lib/citation/core/index.js.map +1 -1
  6. package/lib/citation/core/platformPaper.d.ts +14 -0
  7. package/lib/citation/core/platformPaper.d.ts.map +1 -0
  8. package/lib/citation/core/platformPaper.js +28 -0
  9. package/lib/citation/core/platformPaper.js.map +1 -0
  10. package/lib/citation/core/teachingPaper.d.ts +15 -0
  11. package/lib/citation/core/teachingPaper.d.ts.map +1 -0
  12. package/lib/citation/core/teachingPaper.js +32 -0
  13. package/lib/citation/core/teachingPaper.js.map +1 -0
  14. package/lib/color/core/index.d.ts +1 -1
  15. package/lib/color/core/index.d.ts.map +1 -1
  16. package/lib/color/core/index.js +1 -1
  17. package/lib/color/core/index.js.map +1 -1
  18. package/lib/core.d.ts +1 -0
  19. package/lib/core.d.ts.map +1 -1
  20. package/lib/core.js +1 -0
  21. package/lib/core.js.map +1 -1
  22. package/lib/ecosystem/core/sites.js +5 -5
  23. package/lib/orbital/core/index.d.ts +1 -1
  24. package/lib/orbital/core/index.d.ts.map +1 -1
  25. package/lib/orbital/core/index.js +1 -1
  26. package/lib/orbital/core/index.js.map +1 -1
  27. package/lib/pedagogy/ui/TutorialStepStrip.d.ts +15 -2
  28. package/lib/pedagogy/ui/TutorialStepStrip.d.ts.map +1 -1
  29. package/lib/pedagogy/ui/TutorialStepStrip.js +15 -4
  30. package/lib/pedagogy/ui/TutorialStepStrip.js.map +1 -1
  31. package/lib/pedagogy/ui/index.d.ts +1 -1
  32. package/lib/pedagogy/ui/index.d.ts.map +1 -1
  33. package/lib/pedagogy/ui/index.js.map +1 -1
  34. package/lib/periodic/core/categories.d.ts +25 -0
  35. package/lib/periodic/core/categories.d.ts.map +1 -0
  36. package/lib/periodic/core/categories.js +70 -0
  37. package/lib/periodic/core/categories.js.map +1 -0
  38. package/lib/periodic/core/elements.d.ts +49 -0
  39. package/lib/periodic/core/elements.d.ts.map +1 -0
  40. package/lib/periodic/core/elements.js +175 -0
  41. package/lib/periodic/core/elements.js.map +1 -0
  42. package/lib/periodic/core/index.d.ts +6 -0
  43. package/lib/periodic/core/index.d.ts.map +1 -0
  44. package/lib/periodic/core/index.js +4 -0
  45. package/lib/periodic/core/index.js.map +1 -0
  46. package/lib/periodic/core/layout.d.ts +73 -0
  47. package/lib/periodic/core/layout.d.ts.map +1 -0
  48. package/lib/periodic/core/layout.js +132 -0
  49. package/lib/periodic/core/layout.js.map +1 -0
  50. package/lib/periodic/ui/CategoryLegend.d.ts +26 -0
  51. package/lib/periodic/ui/CategoryLegend.d.ts.map +1 -0
  52. package/lib/periodic/ui/CategoryLegend.js +53 -0
  53. package/lib/periodic/ui/CategoryLegend.js.map +1 -0
  54. package/lib/periodic/ui/ElementCell.d.ts +53 -0
  55. package/lib/periodic/ui/ElementCell.d.ts.map +1 -0
  56. package/lib/periodic/ui/ElementCell.js +56 -0
  57. package/lib/periodic/ui/ElementCell.js.map +1 -0
  58. package/lib/periodic/ui/PeriodicTable.d.ts +90 -0
  59. package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -0
  60. package/lib/periodic/ui/PeriodicTable.js +77 -0
  61. package/lib/periodic/ui/PeriodicTable.js.map +1 -0
  62. package/lib/periodic/ui/PeriodicTableChrome.d.ts +36 -0
  63. package/lib/periodic/ui/PeriodicTableChrome.d.ts.map +1 -0
  64. package/lib/periodic/ui/PeriodicTableChrome.js +72 -0
  65. package/lib/periodic/ui/PeriodicTableChrome.js.map +1 -0
  66. package/lib/periodic/ui/index.d.ts +7 -0
  67. package/lib/periodic/ui/index.d.ts.map +1 -0
  68. package/lib/periodic/ui/index.js +4 -0
  69. package/lib/periodic/ui/index.js.map +1 -0
  70. package/lib/ui.d.ts +1 -0
  71. package/lib/ui.d.ts.map +1 -1
  72. package/lib/ui.js +1 -0
  73. package/lib/ui.js.map +1 -1
  74. package/package.json +2 -1
  75. package/src/citation/core/index.ts +2 -0
  76. package/src/citation/core/platformPaper.ts +32 -0
  77. package/src/citation/core/teachingPaper.ts +36 -0
  78. package/src/color/core/index.ts +6 -1
  79. package/src/core.ts +1 -0
  80. package/src/ecosystem/core/sites.ts +5 -5
  81. package/src/orbital/core/index.ts +1 -1
  82. package/src/pedagogy/ui/TutorialStepStrip.tsx +35 -9
  83. package/src/pedagogy/ui/index.ts +4 -1
  84. package/src/periodic/core/categories.ts +83 -0
  85. package/src/periodic/core/elements.ts +217 -0
  86. package/src/periodic/core/index.ts +27 -0
  87. package/src/periodic/core/layout.ts +183 -0
  88. package/src/periodic/ui/CategoryLegend.tsx +105 -0
  89. package/src/periodic/ui/ElementCell.tsx +137 -0
  90. package/src/periodic/ui/PeriodicTable.tsx +226 -0
  91. package/src/periodic/ui/PeriodicTableChrome.tsx +170 -0
  92. package/src/periodic/ui/index.ts +6 -0
  93. package/src/ui.ts +1 -0
@@ -0,0 +1,90 @@
1
+ /**
2
+ * The periodic table.
3
+ *
4
+ * It knows nothing about what it is showing: the caller says what colour each
5
+ * cell takes and what is written in it, and gets back which element was
6
+ * clicked. That is what lets the same grid be an element picker, a property
7
+ * map, and a chart's selection control.
8
+ *
9
+ * Everything site-specific arrives through a callback keyed on the element, so
10
+ * a site's own richer element record never has to cross into this component.
11
+ */
12
+ import type { ReactElement } from 'react';
13
+ import type { Swatch } from '../../color/core/scale.ts';
14
+ import type { PeriodicElement } from '../core/elements.ts';
15
+ import type { ElementRange } from '../core/layout.ts';
16
+ /** What {@link PeriodicTable} needs. */
17
+ export interface PeriodicTableProps {
18
+ /**
19
+ * Symbol of the element the tools are pointed at.
20
+ * @default undefined — none is
21
+ */
22
+ selected?: string;
23
+ /**
24
+ * Called with the symbol of the element that was clicked, and by the arrow
25
+ * keys.
26
+ * @default undefined — the table is a figure rather than a control
27
+ */
28
+ onSelect?: (symbol: string) => void;
29
+ /**
30
+ * The colour each cell takes.
31
+ * @default the family colour
32
+ */
33
+ swatchOf?: (element: PeriodicElement) => Swatch;
34
+ /**
35
+ * What is written under the symbol; an empty string writes nothing.
36
+ * @default nothing is written
37
+ */
38
+ detailOf?: (element: PeriodicElement) => string;
39
+ /**
40
+ * How an element is named, for the label a screen reader reads. The hook a
41
+ * site translating the table writes its own names through.
42
+ * @default the English name
43
+ */
44
+ nameOf?: (element: PeriodicElement) => string;
45
+ /**
46
+ * Whether an element is inside the set the tool is showing. Everything
47
+ * outside it is dimmed rather than removed, so the table keeps its shape.
48
+ * @default every element is
49
+ */
50
+ isIncluded?: (element: PeriodicElement) => boolean;
51
+ /**
52
+ * Whether to draw the group and period strips.
53
+ * @default false
54
+ */
55
+ headers?: boolean;
56
+ /**
57
+ * Called when a whole group or period header is clicked. Without it the
58
+ * strips are labels rather than buttons.
59
+ * @default undefined
60
+ */
61
+ onSelectRange?: (range: ElementRange) => void;
62
+ /**
63
+ * Whether to draw the family legend under the grid.
64
+ * @default false
65
+ */
66
+ legend?: boolean;
67
+ /**
68
+ * Whether the dashed markers stand where the two inner-transition series were
69
+ * lifted out of the main block.
70
+ * @default true
71
+ */
72
+ markers?: boolean;
73
+ /**
74
+ * Whether the arrow keys walk the table by atomic number.
75
+ * @default true
76
+ */
77
+ keyboard?: boolean;
78
+ /**
79
+ * Called on pointer enter with the symbol, and on leave with `null`.
80
+ * @default undefined
81
+ */
82
+ onHover?: (symbol: string | null) => void;
83
+ }
84
+ /**
85
+ * The 118 elements, laid out as the table.
86
+ * @param props - See {@link PeriodicTableProps}.
87
+ * @returns The grid, its optional chrome, and its optional legend.
88
+ */
89
+ export declare function PeriodicTable(props: PeriodicTableProps): ReactElement;
90
+ //# sourceMappingURL=PeriodicTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PeriodicTable.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTable.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0,0 +1,77 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ import { categorySwatch } from "../core/categories.js";
4
+ import { COLUMN_COUNT, elementByArrowKey, placedElements, } from "../core/layout.js";
5
+ import { CategoryLegend } from "./CategoryLegend.js";
6
+ import { ElementCell } from "./ElementCell.js";
7
+ import { HeaderStrips, InnerTransitionMarkers, } from "./PeriodicTableChrome.js";
8
+ /**
9
+ * The 118 elements, laid out as the table.
10
+ * @param props - See {@link PeriodicTableProps}.
11
+ * @returns The grid, its optional chrome, and its optional legend.
12
+ */
13
+ export function PeriodicTable(props) {
14
+ const { selected, onSelect, swatchOf = defaultSwatchOf, detailOf, nameOf = defaultNameOf, isIncluded, headers = false, onSelectRange, legend = false, markers = true, keyboard = true, onHover, } = props;
15
+ const gridRef = useRef(null);
16
+ const cameFromKeyRef = useRef(false);
17
+ const offset = headers ? 1 : 0;
18
+ useEffect(() => {
19
+ if (!cameFromKeyRef.current)
20
+ return;
21
+ cameFromKeyRef.current = false;
22
+ const cell = gridRef.current?.querySelector(`[data-symbol="${CSS.escape(selected ?? '')}"]`);
23
+ cell?.focus();
24
+ cell?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
25
+ }, [selected]);
26
+ function handleKeyDown(event) {
27
+ if (!keyboard || onSelect === undefined)
28
+ return;
29
+ const next = elementByArrowKey(event.key, selected);
30
+ if (next === null)
31
+ return;
32
+ event.preventDefault();
33
+ cameFromKeyRef.current = true;
34
+ onSelect(next.symbol);
35
+ }
36
+ return (_jsxs("div", { style: rootStyle, children: [_jsxs("div", { ref: gridRef, role: "grid", "aria-label": "Periodic table", "data-testid": "periodic-table", style: headers ? gridWithHeadersStyle : gridStyle, onKeyDown: handleKeyDown, children: [headers ? _jsx(HeaderStrips, { onSelectRange: onSelectRange }) : null, markers ? _jsx(InnerTransitionMarkers, { offset: offset }) : null, placedElements().map(({ element, cell }) => (_jsx(ElementCell, { atomicNumber: element.atomicNumber, symbol: element.symbol, name: nameOf(element), detail: detailOf?.(element), swatch: swatchOf(element), isSelected: element.symbol === selected, isIncluded: isIncluded?.(element), column: cell.column + offset, row: cell.row + offset, onSelect: onSelect ?? noop, onHover: onHover }, element.symbol)))] }), legend ? _jsx(CategoryLegend, {}) : null] }));
37
+ }
38
+ function defaultSwatchOf(element) {
39
+ return categorySwatch(element.category);
40
+ }
41
+ function defaultNameOf(element) {
42
+ return element.name;
43
+ }
44
+ function noop() {
45
+ // A table with no `onSelect` is a figure; its cells stay buttons so the
46
+ // keyboard and a screen reader still reach every element.
47
+ }
48
+ const rootStyle = {
49
+ display: 'flex',
50
+ flexDirection: 'column',
51
+ gap: 8,
52
+ };
53
+ const baseGridStyle = {
54
+ display: 'grid',
55
+ gap: 2,
56
+ width: '100%',
57
+ // The cells size their type against this box rather than against the page,
58
+ // so the same table reads at 320px beside a chart and at 900px on its own.
59
+ containerType: 'inline-size',
60
+ };
61
+ const gridStyle = {
62
+ ...baseGridStyle,
63
+ // The eighth row is the gap the inner-transition series are lifted out into.
64
+ gridTemplateColumns: `repeat(${String(COLUMN_COUNT)}, minmax(0, 1fr))`,
65
+ gridTemplateRows: 'repeat(7, minmax(0, 1fr)) 0.5rem repeat(2, minmax(0, 1fr))',
66
+ aspectRatio: `${String(COLUMN_COUNT)} / 9.7`,
67
+ minWidth: 280,
68
+ };
69
+ const gridWithHeadersStyle = {
70
+ ...baseGridStyle,
71
+ // A leading column and a leading row hold the period and group numbers.
72
+ gridTemplateColumns: `1.4rem repeat(${String(COLUMN_COUNT)}, minmax(0, 1fr))`,
73
+ gridTemplateRows: '1rem repeat(7, minmax(0, 1fr)) 0.5rem repeat(2, minmax(0, 1fr))',
74
+ aspectRatio: `${String(COLUMN_COUNT + 1.2)} / 10.6`,
75
+ minWidth: 280,
76
+ };
77
+ //# sourceMappingURL=PeriodicTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PeriodicTable.js","sourceRoot":"","sources":["../../../src/period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AC7E,gBAAgB,EACd,iEAAiE;IACnE,WAAW,EAAE,GAAG,MAAM,CAAC,YAAY,GAAG,GAAG,CAAC,SAAS;IACnD,QAAQ,EAAE,GAAG;CACmB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The furniture around the cells: the group and period strips, and the two
3
+ * markers the inner-transition series were lifted out of.
4
+ */
5
+ import type { ReactElement } from 'react';
6
+ import type { ElementRange } from '../core/layout.ts';
7
+ /** What {@link HeaderStrips} needs. */
8
+ export interface HeaderStripsProps {
9
+ /**
10
+ * Called with the run whose header was clicked. Without it the strips are
11
+ * labels rather than buttons.
12
+ * @default undefined
13
+ */
14
+ onSelectRange?: (range: ElementRange) => void;
15
+ }
16
+ /**
17
+ * The 1–18 strip along the top and the 1–7 strip down the left.
18
+ *
19
+ * They are buttons when the table takes a range: "plot period 3" is one click
20
+ * there and eight on the cells.
21
+ * @param props - See {@link HeaderStripsProps}.
22
+ * @returns The two strips, placed on the grid.
23
+ */
24
+ export declare function HeaderStrips(props: HeaderStripsProps): ReactElement;
25
+ /** What {@link InnerTransitionMarkers} needs. */
26
+ export interface InnerTransitionMarkersProps {
27
+ /** 1 when the table draws its header strips, 0 otherwise. */
28
+ offset: number;
29
+ }
30
+ /**
31
+ * The two cells the lanthanoids and the actinoids were lifted out of.
32
+ * @param props - See {@link InnerTransitionMarkersProps}.
33
+ * @returns The markers, placed on the grid.
34
+ */
35
+ export declare function InnerTransitionMarkers(props: InnerTransitionMarkersProps): ReactElement;
36
+ //# sourceMappingURL=PeriodicTableChrome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PeriodicTableChrome.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTableChrome.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAqDnE;AAED,iDAAiD;AACjD,MAAM,WAAW,2BAA2B;IAC1C,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,2BAA2B,GACjC,YAAY,CAmBd"}
@@ -0,0 +1,72 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { COLUMN_COUNT, INNER_TRANSITION_MARKERS, INNER_TRANSITION_ROWS, } from "../core/layout.js";
3
+ /**
4
+ * The 1–18 strip along the top and the 1–7 strip down the left.
5
+ *
6
+ * They are buttons when the table takes a range: "plot period 3" is one click
7
+ * there and eight on the cells.
8
+ * @param props - See {@link HeaderStripsProps}.
9
+ * @returns The two strips, placed on the grid.
10
+ */
11
+ export function HeaderStrips(props) {
12
+ const { onSelectRange } = props;
13
+ const groups = [];
14
+ for (let group = 1; group <= COLUMN_COUNT; group++) {
15
+ groups.push(_jsx(HeaderCell, { label: String(group), title: `Group ${String(group)}`, column: group + 1, row: 1, onClick: onSelectRange &&
16
+ (() => {
17
+ onSelectRange({ kind: 'group', value: group });
18
+ }) }, `group-${String(group)}`));
19
+ }
20
+ const periods = [];
21
+ for (let period = 1; period <= 7; period++) {
22
+ periods.push(_jsx(HeaderCell, { label: String(period), title: `Period ${String(period)}`, column: 1, row: period + 1, onClick: onSelectRange &&
23
+ (() => {
24
+ onSelectRange({ kind: 'period', value: period });
25
+ }) }, `period-${String(period)}`));
26
+ }
27
+ return (_jsxs(_Fragment, { children: [groups, periods, INNER_TRANSITION_ROWS.map(({ row, period }) => (_jsx("div", { style: { ...headerStyle, gridColumn: 1, gridRow: row + 1 }, children: period }, `inner-${String(row)}`)))] }));
28
+ }
29
+ /**
30
+ * The two cells the lanthanoids and the actinoids were lifted out of.
31
+ * @param props - See {@link InnerTransitionMarkersProps}.
32
+ * @returns The markers, placed on the grid.
33
+ */
34
+ export function InnerTransitionMarkers(props) {
35
+ const { offset } = props;
36
+ return (_jsx(_Fragment, { children: INNER_TRANSITION_MARKERS.map(({ cell, label, category }) => (_jsx("div", { "aria-hidden": "true", style: {
37
+ ...markerStyle,
38
+ gridColumn: cell.column + offset,
39
+ gridRow: cell.row + offset,
40
+ }, children: label }, category))) }));
41
+ }
42
+ function HeaderCell(props) {
43
+ const { label, title, column, row, onClick } = props;
44
+ const style = { ...headerStyle, gridColumn: column, gridRow: row };
45
+ if (onClick === undefined)
46
+ return _jsx("div", { style: style, children: label });
47
+ return (_jsx("button", { type: "button", "aria-label": title, onClick: onClick, style: { ...style, ...headerButtonStyle }, children: label }));
48
+ }
49
+ const headerStyle = {
50
+ alignItems: 'center',
51
+ color: 'rgb(95 107 124)',
52
+ display: 'flex',
53
+ fontSize: 'clamp(0.4rem, 1.9cqw, 0.62rem)',
54
+ justifyContent: 'center',
55
+ padding: 0,
56
+ };
57
+ const headerButtonStyle = {
58
+ background: 'none',
59
+ border: 'none',
60
+ cursor: 'pointer',
61
+ font: 'inherit',
62
+ };
63
+ const markerStyle = {
64
+ alignItems: 'center',
65
+ border: '1px dashed rgb(182 191 204)',
66
+ borderRadius: 3,
67
+ color: 'rgb(95 107 124)',
68
+ display: 'flex',
69
+ fontSize: 'clamp(0.36rem, 1.7cqw, 0.55rem)',
70
+ justifyContent: 'center',
71
+ };
72
+ //# sourceMappingURL=PeriodicTableChrome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PeriodicTableChrome.js","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTableChrome.tsx"],"names":[],"mappings":";AAQA,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,mBAAmB,C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ACV,CAAC;AACJ,CAAC;AAED,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,iBAAiB;IACxB,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,gCAAgC;IAC1C,cAAc,EAAE,QAAQ;IACxB,OAAO,EAAE,CAAC;CACsB,CAAC;AAEnC,MAAM,iBAAiB,GAAG;IACxB,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;CACiB,CAAC;AAEnC,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,6BAA6B;IACrC,YAAY,EAAE,CAAC;IACf,KAAK,EAAE,iBAAiB;IACxB,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,iCAAiC;IAC3C,cAAc,EAAE,QAAQ;CACQ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type { CategoryLegendProps } from './CategoryLegend.tsx';
2
+ export { CategoryLegend } from './CategoryLegend.tsx';
3
+ export type { ElementCellProps } from './ElementCell.tsx';
4
+ export { ElementCell } from './ElementCell.tsx';
5
+ export type { PeriodicTableProps } from './PeriodicTable.tsx';
6
+ export { PeriodicTable } from './PeriodicTable.tsx';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { CategoryLegend } from "./CategoryLegend.js";
2
+ export { ElementCell } from "./ElementCell.js";
3
+ export { PeriodicTable } from "./PeriodicTable.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/periodic/ui/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC"}
package/lib/ui.d.ts CHANGED
@@ -11,6 +11,7 @@ export * from './error/ui/index.ts';
11
11
  export * from './help/ui/index.ts';
12
12
  export * from './hooks/ui/index.ts';
13
13
  export * from './pedagogy/ui/index.ts';
14
+ export * from './periodic/ui/index.ts';
14
15
  export * from './share/ui/index.ts';
15
16
  export * from './shared/ui/index.ts';
16
17
  export * from './state/ui/index.ts';
package/lib/ui.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
package/lib/ui.js CHANGED
@@ -11,6 +11,7 @@ export * from "./error/ui/index.js";
11
11
  export * from "./help/ui/index.js";
12
12
  export * from "./hooks/ui/index.js";
13
13
  export * from "./pedagogy/ui/index.js";
14
+ export * from "./periodic/ui/index.js";
14
15
  export * from "./share/ui/index.js";
15
16
  export * from "./shared/ui/index.js";
16
17
  export * from "./state/ui/index.js";
package/lib/ui.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cheminfo",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "license": "MIT",
5
5
  "description": "Assembled React components shared by the cheminfo sites: a Cite button and an ecosystem menu",
6
6
  "author": "Luc Patiny",
@@ -54,6 +54,7 @@
54
54
  "@types/react-dom": "^19.2.4",
55
55
  "@vitest/coverage-v8": "^4.1.10",
56
56
  "@zakodium/tsconfig": "^1.0.5",
57
+ "chemical-elements": "^2.3.2",
57
58
  "eslint": "^9.39.5",
58
59
  "eslint-config-cheminfo-react": "^20.1.0",
59
60
  "eslint-config-cheminfo-typescript": "^22.1.0",
@@ -12,6 +12,7 @@ export {
12
12
  citationFilename,
13
13
  formatCitation,
14
14
  } from './formats.ts';
15
+ export { PLATFORM_PAPER, PLATFORM_WORK } from './platformPaper.ts';
15
16
  export type { Reference, ReferenceAuthor } from './reference.ts';
16
17
  export { doiUrl } from './reference.ts';
17
18
  export type {
@@ -20,6 +21,7 @@ export type {
20
21
  CitationStyleId,
21
22
  } from './segments.ts';
22
23
  export { CITATION_STYLES, citationSegments } from './segments.ts';
24
+ export { TEACHING_PAPER, TEACHING_WORK } from './teachingPaper.ts';
23
25
  export type { CitedWork } from './works.ts';
24
26
  export {
25
27
  citationsFilename,
@@ -0,0 +1,32 @@
1
+ import type { Reference } from './reference.ts';
2
+ import type { CitedWork } from './works.ts';
3
+
4
+ /**
5
+ * The platform every site of the family runs on: chemical data processed in the
6
+ * browser, which is what makes these applications rather than queues of jobs.
7
+ * One record holds it, so no site can name a different version of it.
8
+ */
9
+ export const PLATFORM_PAPER: Reference = {
10
+ authors: [{ given: 'L.', family: 'Patiny' }],
11
+ title:
12
+ 'Unlocking the Potential of Browser-Based Scientific Data Analysis: A 20-Year Journey of Expertise',
13
+ journal: 'CHIMIA',
14
+ journalAbbreviation: 'Chimia',
15
+ year: 2025,
16
+ volume: '79',
17
+ issue: '1-2',
18
+ firstPage: '66',
19
+ lastPage: '69',
20
+ doi: '10.2533/chimia.2025.66',
21
+ publisher: 'Swiss Chemical Society',
22
+ };
23
+
24
+ /**
25
+ * The platform paper as the second work a site asks to be cited, after the work
26
+ * the tool itself implements.
27
+ */
28
+ export const PLATFORM_WORK: CitedWork = {
29
+ reference: PLATFORM_PAPER,
30
+ what: 'Data processing in the browser',
31
+ note: 'Cite it for the site itself, which runs in the browser.',
32
+ };
@@ -0,0 +1,36 @@
1
+ import type { Reference } from './reference.ts';
2
+ import type { CitedWork } from './works.ts';
3
+
4
+ /**
5
+ * The twenty years of online teaching the pedagogic sites of the family come
6
+ * out of: the tutorials, the exercises and the marking are the web-based tools
7
+ * it describes. One record holds it, so no site can name a different version
8
+ * of it.
9
+ */
10
+ export const TEACHING_PAPER: Reference = {
11
+ authors: [
12
+ { given: 'R.', family: 'Turin' },
13
+ { given: 'L.', family: 'Patiny' },
14
+ ],
15
+ title:
16
+ 'Two Decades of Online Teaching: Trends, Challenges, and Future Directions',
17
+ journal: 'CHIMIA',
18
+ journalAbbreviation: 'Chimia',
19
+ year: 2023,
20
+ volume: '77',
21
+ issue: '10',
22
+ firstPage: '683',
23
+ lastPage: '687',
24
+ doi: '10.2533/chimia.2023.683',
25
+ publisher: 'Swiss Chemical Society',
26
+ };
27
+
28
+ /**
29
+ * The teaching paper as one of the works a site that teaches asks to be cited,
30
+ * beside `PLATFORM_WORK` and the work the tool itself implements.
31
+ */
32
+ export const TEACHING_WORK: CitedWork = {
33
+ reference: TEACHING_PAPER,
34
+ what: 'Teaching chemistry online',
35
+ note: 'Cite it for the exercises, which are the web-based teaching it describes.',
36
+ };
@@ -1,4 +1,9 @@
1
1
  export type { ReadableInkOptions } from './contrast.ts';
2
2
  export { contrastRatio, readableInk, relativeLuminance } from './contrast.ts';
3
3
  export type { PositionInRangeOptions, Swatch } from './scale.ts';
4
- export { VIRIDIS_SCALE, positionInRange, swatchFromScale } from './scale.ts';
4
+ export {
5
+ VIRIDIS_SCALE,
6
+ colorFromScale,
7
+ positionInRange,
8
+ swatchFromScale,
9
+ } from './scale.ts';
package/src/core.ts CHANGED
@@ -8,6 +8,7 @@ export * from './ecosystem/core/index.ts';
8
8
  export * from './format/core/index.ts';
9
9
  export * from './orbital/core/index.ts';
10
10
  export * from './pedagogy/core/index.ts';
11
+ export * from './periodic/core/index.ts';
11
12
  export * from './router/core/index.ts';
12
13
  export * from './seo/core/index.ts';
13
14
  export * from './share/core/index.ts';
@@ -107,8 +107,8 @@ export const ECOSYSTEM_SITES: readonly EcosystemSite[] = [
107
107
  repository: 'https://github.com/cheminfo/chemcalc.org',
108
108
  tagline: 'Molecular formula, exact mass and isotopic distribution.',
109
109
  brand: '#5b52e0',
110
- brandAlt: '#0d9488',
111
- mark: { plate: '#5b52e0', accent: '#09d3ac' },
110
+ brandAlt: '#d63384',
111
+ mark: { plate: '#5b52e0', accent: '#ff8ac2' },
112
112
  },
113
113
  {
114
114
  id: 'nmrium',
@@ -206,9 +206,9 @@ export const ECOSYSTEM_SITES: readonly EcosystemSite[] = [
206
206
  host: 'polycarp.cheminfo.org',
207
207
  repository: 'https://github.com/cheminfo/polycarp.cheminfo.org',
208
208
  tagline: 'Predict the microstructure of a radical copolymerisation.',
209
- brand: '#0d1d37',
210
- brandAlt: '#0c9ba3',
211
- mark: { plate: '#0d1d37', accent: '#0c9ba3' },
209
+ brand: '#701a75',
210
+ brandAlt: '#4d7c0f',
211
+ mark: { plate: '#701a75', accent: '#a3e635' },
212
212
  },
213
213
  {
214
214
  id: '3d',
@@ -60,4 +60,4 @@ export type {
60
60
  } from './sample.ts';
61
61
  export { runAtomicSample } from './sample.ts';
62
62
  export type { Screening } from './screening.ts';
63
- export { slaterScreening } from './screening.ts';
63
+ export { groupRank, slaterScreening } from './screening.ts';
@@ -1,15 +1,29 @@
1
1
  import { Button, Tag, Tooltip } from '@blueprintjs/core';
2
2
  import type { CSSProperties, ReactElement, ReactNode } from 'react';
3
3
 
4
- import type { ExerciseLevel, TutorialStep } from '../core/types.ts';
4
+ import type { ExerciseLevel } from '../core/types.ts';
5
5
 
6
6
  import { LEVEL_ORDER } from './exerciseMeta.ts';
7
7
  import type { TutorialLevelColours } from './tutorialLevels.ts';
8
8
  import { TUTORIAL_LEVEL_COLOURS } from './tutorialLevels.ts';
9
9
 
10
+ /**
11
+ * The little a strip needs of a step: what to call it, and which coloured group
12
+ * it belongs to. A tool passes its own steps, whatever else they carry.
13
+ */
14
+ export interface TutorialStripStep {
15
+ /**
16
+ * What keys the button, when the tool gives its steps one.
17
+ * @default undefined — the position in the tour keys it instead
18
+ */
19
+ id?: string;
20
+ title: string;
21
+ level: ExerciseLevel;
22
+ }
23
+
10
24
  export interface TutorialStepStripProps {
11
25
  /** The whole tour, in teaching order. */
12
- steps: readonly TutorialStep[];
26
+ steps: readonly TutorialStripStep[];
13
27
  /**
14
28
  * Which step is open, as its position in `steps`. A position outside the
15
29
  * tour is read as one of its ends, so a hand-edited link still opens.
@@ -110,7 +124,7 @@ export function TutorialStepStrip(props: TutorialStepStripProps): ReactElement {
110
124
  }
111
125
 
112
126
  interface LevelStripProps {
113
- steps: readonly TutorialStep[];
127
+ steps: readonly TutorialStripStep[];
114
128
  positions: readonly number[];
115
129
  colours: TutorialLevelColours;
116
130
  label: string;
@@ -122,11 +136,11 @@ function LevelStrip(props: LevelStripProps): ReactElement {
122
136
  const { steps, positions, colours, label, activeIndex, onSelect } = props;
123
137
  const buttons: ReactNode[] = [];
124
138
  for (const position of positions) {
125
- const step = steps[position] as TutorialStep;
139
+ const step = steps[position] as TutorialStripStep;
126
140
  const active = position === activeIndex;
127
141
  buttons.push(
128
142
  <Tooltip
129
- key={step.id}
143
+ key={step.id ?? position}
130
144
  content={step.title}
131
145
  hoverOpenDelay={HOVER_OPEN_DELAY}
132
146
  placement="bottom"
@@ -155,7 +169,7 @@ function LevelStrip(props: LevelStripProps): ReactElement {
155
169
  }
156
170
 
157
171
  function positionsOfLevel(
158
- steps: readonly TutorialStep[],
172
+ steps: readonly TutorialStripStep[],
159
173
  level: ExerciseLevel,
160
174
  ): number[] {
161
175
  const positions: number[] = [];
@@ -172,6 +186,9 @@ function clampIndex(index: number, total: number): number {
172
186
 
173
187
  /**
174
188
  * The open step takes the darker shade of its own level, plus a border.
189
+ *
190
+ * Every button is the same square whatever it holds, so the numbers of one
191
+ * strip stand above those of the next and the tour reads as a grid.
175
192
  * @param colours - The two shades of the level the step belongs to.
176
193
  * @param active - Whether this is the step on screen.
177
194
  * @returns The style of one numbered button.
@@ -181,20 +198,29 @@ function numberStyle(
181
198
  active: boolean,
182
199
  ): CSSProperties {
183
200
  return {
184
- background: active ? colours.activeBackground : '#ffffff',
201
+ display: 'inline-flex',
202
+ width: STEP_SIZE,
203
+ height: STEP_SIZE,
204
+ alignItems: 'center',
205
+ justifyContent: 'center',
206
+ padding: 0,
185
207
  border: active ? '2px solid #1c2127' : '1px solid rgb(17 20 24 / 20%)',
186
208
  borderRadius: 4,
209
+ background: active ? colours.activeBackground : '#ffffff',
210
+ boxSizing: 'border-box',
187
211
  color: '#1c2127',
188
212
  cursor: 'pointer',
189
213
  font: 'inherit',
190
214
  fontSize: 12,
215
+ fontVariantNumeric: 'tabular-nums',
191
216
  fontWeight: active ? 700 : 500,
192
217
  lineHeight: 1,
193
- minWidth: 26,
194
- padding: active ? '5px 6px' : '6px 7px',
195
218
  };
196
219
  }
197
220
 
221
+ /** Wide enough for two digits, which every tour of ours stays under a hundred of. */
222
+ const STEP_SIZE = 28;
223
+
198
224
  /** Long enough that the pointer can cross the strip without opening a title. */
199
225
  const HOVER_OPEN_DELAY = 150;
200
226
 
@@ -31,7 +31,10 @@ export type {
31
31
  export { SyntaxTooltip } from './SyntaxTooltip.tsx';
32
32
  export type { TestCaseListProps } from './TestCaseList.tsx';
33
33
  export { TestCaseList } from './TestCaseList.tsx';
34
- export type { TutorialStepStripProps } from './TutorialStepStrip.tsx';
34
+ export type {
35
+ TutorialStepStripProps,
36
+ TutorialStripStep,
37
+ } from './TutorialStepStrip.tsx';
35
38
  export { TutorialStepStrip } from './TutorialStepStrip.tsx';
36
39
  export type { TutorialLevelColours } from './tutorialLevels.ts';
37
40
  export { TUTORIAL_LEVEL_COLOURS } from './tutorialLevels.ts';