react-cheminfo 0.46.0 → 0.48.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 +69 -0
- package/lib/chart/core/chartDomain.d.ts +14 -0
- package/lib/chart/core/chartDomain.d.ts.map +1 -1
- package/lib/chart/core/chartDomain.js +1 -0
- package/lib/chart/core/chartDomain.js.map +1 -1
- package/lib/chart/core/selectionGeometry.d.ts +4 -2
- package/lib/chart/core/selectionGeometry.d.ts.map +1 -1
- package/lib/chart/core/selectionGeometry.js +4 -2
- package/lib/chart/core/selectionGeometry.js.map +1 -1
- package/lib/chart/core/zoomDomain.d.ts +11 -1
- package/lib/chart/core/zoomDomain.d.ts.map +1 -1
- package/lib/chart/core/zoomDomain.js +25 -5
- package/lib/chart/core/zoomDomain.js.map +1 -1
- package/lib/chart/ui/chartGestures.d.ts +26 -1
- package/lib/chart/ui/chartGestures.d.ts.map +1 -1
- package/lib/chart/ui/chartGestures.js +21 -0
- package/lib/chart/ui/chartGestures.js.map +1 -1
- package/lib/chart/ui/index.d.ts +1 -1
- package/lib/chart/ui/index.d.ts.map +1 -1
- package/lib/chart/ui/index.js +1 -1
- package/lib/chart/ui/index.js.map +1 -1
- package/lib/chart/ui/useChartZoom.d.ts.map +1 -1
- package/lib/chart/ui/useChartZoom.js +17 -1
- package/lib/chart/ui/useChartZoom.js.map +1 -1
- 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/download/core/cssPaint.d.ts +27 -0
- package/lib/download/core/cssPaint.d.ts.map +1 -0
- package/lib/download/core/cssPaint.js +63 -0
- package/lib/download/core/cssPaint.js.map +1 -0
- package/lib/download/core/drawingMarkup.d.ts +11 -0
- package/lib/download/core/drawingMarkup.d.ts.map +1 -0
- package/lib/download/core/drawingMarkup.js +32 -0
- package/lib/download/core/drawingMarkup.js.map +1 -0
- package/lib/download/core/figureHtml.d.ts +25 -0
- package/lib/download/core/figureHtml.d.ts.map +1 -0
- package/lib/download/core/figureHtml.js +174 -0
- package/lib/download/core/figureHtml.js.map +1 -0
- package/lib/download/core/figureHtmlMarkup.d.ts +107 -0
- package/lib/download/core/figureHtmlMarkup.d.ts.map +1 -0
- package/lib/download/core/figureHtmlMarkup.js +75 -0
- package/lib/download/core/figureHtmlMarkup.js.map +1 -0
- package/lib/download/core/figureSvg.d.ts.map +1 -1
- package/lib/download/core/figureSvg.js +16 -35
- package/lib/download/core/figureSvg.js.map +1 -1
- package/lib/download/core/figureSvgDocument.d.ts +3 -3
- package/lib/download/core/figureSvgDocument.d.ts.map +1 -1
- package/lib/download/core/figureTarget.d.ts +14 -3
- package/lib/download/core/figureTarget.d.ts.map +1 -1
- package/lib/download/core/figureTarget.js +42 -3
- package/lib/download/core/figureTarget.js.map +1 -1
- package/lib/download/core/index.d.ts +1 -1
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +1 -1
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/core/textLines.d.ts +27 -0
- package/lib/download/core/textLines.d.ts.map +1 -0
- package/lib/download/core/textLines.js +51 -0
- package/lib/download/core/textLines.js.map +1 -0
- package/lib/ecosystem/core/lookup.d.ts +2 -1
- package/lib/ecosystem/core/lookup.d.ts.map +1 -1
- package/lib/ecosystem/core/lookup.js +10 -3
- package/lib/ecosystem/core/lookup.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +2 -2
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/ecosystem/core/unlistedSites.d.ts +9 -0
- package/lib/ecosystem/core/unlistedSites.d.ts.map +1 -0
- package/lib/ecosystem/core/unlistedSites.js +35 -0
- package/lib/ecosystem/core/unlistedSites.js.map +1 -0
- package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +7 -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/ir/core/irMode.d.ts.map +1 -1
- package/lib/ir/core/irMode.js +6 -1
- package/lib/ir/core/irMode.js.map +1 -1
- package/lib/locales/de.json +56 -1
- package/lib/locales/en.json +56 -1
- package/lib/locales/es.json +56 -1
- package/lib/locales/fr.json +56 -1
- package/lib/locales/it.json +56 -1
- package/lib/periodic/core/index.d.ts +1 -1
- package/lib/periodic/core/index.d.ts.map +1 -1
- package/lib/periodic/core/layout.d.ts +11 -0
- package/lib/periodic/core/layout.d.ts.map +1 -1
- package/lib/periodic/core/layout.js.map +1 -1
- package/lib/periodic/ui/ElementCell.d.ts +6 -2
- package/lib/periodic/ui/ElementCell.d.ts.map +1 -1
- package/lib/periodic/ui/ElementCell.js +2 -2
- package/lib/periodic/ui/ElementCell.js.map +1 -1
- package/lib/periodic/ui/PeriodicTable.d.ts +3 -98
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +9 -84
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/periodic/ui/PeriodicTableChrome.d.ts +13 -3
- package/lib/periodic/ui/PeriodicTableChrome.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTableChrome.js +10 -20
- package/lib/periodic/ui/PeriodicTableChrome.js.map +1 -1
- package/lib/periodic/ui/SelectAllCorner.d.ts +23 -0
- package/lib/periodic/ui/SelectAllCorner.d.ts.map +1 -0
- package/lib/periodic/ui/SelectAllCorner.js +40 -0
- package/lib/periodic/ui/SelectAllCorner.js.map +1 -0
- package/lib/periodic/ui/headerStyles.d.ts +17 -0
- package/lib/periodic/ui/headerStyles.d.ts.map +1 -0
- package/lib/periodic/ui/headerStyles.js +19 -0
- package/lib/periodic/ui/headerStyles.js.map +1 -0
- package/lib/periodic/ui/periodicTableProps.d.ts +115 -0
- package/lib/periodic/ui/periodicTableProps.d.ts.map +1 -0
- package/lib/periodic/ui/periodicTableProps.js +8 -0
- package/lib/periodic/ui/periodicTableProps.js.map +1 -0
- package/lib/periodic/ui/tableLayout.d.ts +26 -0
- package/lib/periodic/ui/tableLayout.d.ts.map +1 -0
- package/lib/periodic/ui/tableLayout.js +86 -0
- package/lib/periodic/ui/tableLayout.js.map +1 -0
- package/lib/split/ui/SplitColumn.d.ts +29 -0
- package/lib/split/ui/SplitColumn.d.ts.map +1 -0
- package/lib/split/ui/SplitColumn.js +19 -0
- package/lib/split/ui/SplitColumn.js.map +1 -0
- package/lib/split/ui/SplitRow.d.ts +14 -53
- package/lib/split/ui/SplitRow.d.ts.map +1 -1
- package/lib/split/ui/SplitRow.js +8 -90
- package/lib/split/ui/SplitRow.js.map +1 -1
- package/lib/split/ui/index.d.ts +3 -0
- package/lib/split/ui/index.d.ts.map +1 -1
- package/lib/split/ui/index.js +1 -0
- package/lib/split/ui/index.js.map +1 -1
- package/lib/split/ui/splitPanes.d.ts +84 -0
- package/lib/split/ui/splitPanes.d.ts.map +1 -0
- package/lib/split/ui/splitPanes.js +125 -0
- package/lib/split/ui/splitPanes.js.map +1 -0
- package/lib/taxonomy/core/index.d.ts +8 -0
- package/lib/taxonomy/core/index.d.ts.map +1 -0
- package/lib/taxonomy/core/index.js +5 -0
- package/lib/taxonomy/core/index.js.map +1 -0
- package/lib/taxonomy/core/lineage.d.ts +83 -0
- package/lib/taxonomy/core/lineage.d.ts.map +1 -0
- package/lib/taxonomy/core/lineage.js +126 -0
- package/lib/taxonomy/core/lineage.js.map +1 -0
- package/lib/taxonomy/core/ncbi.d.ts +8 -0
- package/lib/taxonomy/core/ncbi.d.ts.map +1 -0
- package/lib/taxonomy/core/ncbi.js +10 -0
- package/lib/taxonomy/core/ncbi.js.map +1 -0
- package/lib/taxonomy/core/organismName.d.ts +28 -0
- package/lib/taxonomy/core/organismName.d.ts.map +1 -0
- package/lib/taxonomy/core/organismName.js +188 -0
- package/lib/taxonomy/core/organismName.js.map +1 -0
- package/lib/taxonomy/core/organismWords.d.ts +20 -0
- package/lib/taxonomy/core/organismWords.d.ts.map +1 -0
- package/lib/taxonomy/core/organismWords.js +86 -0
- package/lib/taxonomy/core/organismWords.js.map +1 -0
- package/lib/taxonomy/core/ranks.d.ts +51 -0
- package/lib/taxonomy/core/ranks.d.ts.map +1 -0
- package/lib/taxonomy/core/ranks.js +123 -0
- package/lib/taxonomy/core/ranks.js.map +1 -0
- package/lib/taxonomy/ui/OrganismName.d.ts +28 -0
- package/lib/taxonomy/ui/OrganismName.d.ts.map +1 -0
- package/lib/taxonomy/ui/OrganismName.js +28 -0
- package/lib/taxonomy/ui/OrganismName.js.map +1 -0
- package/lib/taxonomy/ui/TaxonLineage.d.ts +67 -0
- package/lib/taxonomy/ui/TaxonLineage.d.ts.map +1 -0
- package/lib/taxonomy/ui/TaxonLineage.js +45 -0
- package/lib/taxonomy/ui/TaxonLineage.js.map +1 -0
- package/lib/taxonomy/ui/index.d.ts +6 -0
- package/lib/taxonomy/ui/index.d.ts.map +1 -0
- package/lib/taxonomy/ui/index.js +4 -0
- package/lib/taxonomy/ui/index.js.map +1 -0
- package/lib/taxonomy/ui/rankLabel.d.ts +17 -0
- package/lib/taxonomy/ui/rankLabel.d.ts.map +1 -0
- package/lib/taxonomy/ui/rankLabel.js +77 -0
- package/lib/taxonomy/ui/rankLabel.js.map +1 -0
- 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/chart/core/chartDomain.ts +15 -0
- package/src/chart/core/selectionGeometry.ts +4 -2
- package/src/chart/core/zoomDomain.ts +37 -5
- package/src/chart/ui/chartGestures.ts +41 -1
- package/src/chart/ui/index.ts +1 -1
- package/src/chart/ui/useChartZoom.ts +25 -1
- package/src/core.ts +1 -0
- package/src/download/core/cssPaint.ts +71 -0
- package/src/download/core/drawingMarkup.ts +35 -0
- package/src/download/core/figureHtml.ts +214 -0
- package/src/download/core/figureHtmlMarkup.ts +187 -0
- package/src/download/core/figureSvg.ts +17 -38
- package/src/download/core/figureSvgDocument.ts +3 -3
- package/src/download/core/figureTarget.ts +41 -8
- package/src/download/core/index.ts +1 -0
- package/src/download/core/textLines.ts +67 -0
- package/src/ecosystem/core/lookup.ts +11 -3
- package/src/ecosystem/core/types.ts +4 -2
- package/src/ecosystem/core/unlistedSites.ts +37 -0
- package/src/ecosystem/ui/glyphs.tsx +44 -0
- package/src/ir/core/irMode.ts +6 -1
- package/src/locales/de.json +56 -1
- package/src/locales/en.json +56 -1
- package/src/locales/es.json +56 -1
- package/src/locales/fr.json +56 -1
- package/src/locales/it.json +56 -1
- package/src/periodic/core/index.ts +1 -1
- package/src/periodic/core/layout.ts +12 -0
- package/src/periodic/ui/ElementCell.tsx +8 -4
- package/src/periodic/ui/PeriodicTable.tsx +27 -197
- package/src/periodic/ui/PeriodicTableChrome.tsx +23 -20
- package/src/periodic/ui/SelectAllCorner.tsx +65 -0
- package/src/periodic/ui/headerStyles.ts +23 -0
- package/src/periodic/ui/periodicTableProps.ts +117 -0
- package/src/periodic/ui/tableLayout.ts +96 -0
- package/src/split/ui/SplitColumn.tsx +35 -0
- package/src/split/ui/SplitRow.tsx +16 -208
- package/src/split/ui/index.ts +3 -0
- package/src/split/ui/splitPanes.tsx +283 -0
- package/src/taxonomy/core/index.ts +20 -0
- package/src/taxonomy/core/lineage.ts +161 -0
- package/src/taxonomy/core/ncbi.ts +9 -0
- package/src/taxonomy/core/organismName.ts +217 -0
- package/src/taxonomy/core/organismWords.ts +86 -0
- package/src/taxonomy/core/ranks.ts +134 -0
- package/src/taxonomy/ui/OrganismName.tsx +59 -0
- package/src/taxonomy/ui/TaxonLineage.tsx +183 -0
- package/src/taxonomy/ui/index.ts +5 -0
- package/src/taxonomy/ui/rankLabel.ts +81 -0
- package/src/ui.ts +1 -0
- package/styles/chrome.css +135 -6
|
@@ -9,104 +9,9 @@
|
|
|
9
9
|
* Everything site-specific arrives through a callback keyed on the element, so
|
|
10
10
|
* a site's own richer element record never has to cross into this component.
|
|
11
11
|
*/
|
|
12
|
-
import type { ReactElement
|
|
13
|
-
import type {
|
|
14
|
-
|
|
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
|
-
* Electrons in each shell of an element, innermost first, written down the
|
|
47
|
-
* right-hand edge of its cell. The energy levels, which a table is also read
|
|
48
|
-
* for: none of ours knows them, so the tool that does says so here.
|
|
49
|
-
* @default undefined — no cell writes any
|
|
50
|
-
*/
|
|
51
|
-
shellsOf?: (element: PeriodicElement) => readonly number[] | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Whether an element is inside the set the tool is showing. Everything
|
|
54
|
-
* outside it is dimmed rather than removed, so the table keeps its shape.
|
|
55
|
-
* @default every element is
|
|
56
|
-
*/
|
|
57
|
-
isIncluded?: (element: PeriodicElement) => boolean;
|
|
58
|
-
/**
|
|
59
|
-
* What is written in the block the table leaves empty — columns 3 to 12 of
|
|
60
|
-
* the first three periods, in the middle of the top edge. A tool that reads
|
|
61
|
-
* one element off the table puts what it says about it there, where the eye
|
|
62
|
-
* already is, rather than under the grid.
|
|
63
|
-
*
|
|
64
|
-
* It is sized against the table, like everything else in the grid, so give
|
|
65
|
-
* it type in `em` and it scales with the drawing.
|
|
66
|
-
* @default undefined — the block stays empty
|
|
67
|
-
*/
|
|
68
|
-
inset?: ReactNode;
|
|
69
|
-
/**
|
|
70
|
-
* Whether to draw the group and period strips.
|
|
71
|
-
* @default false
|
|
72
|
-
*/
|
|
73
|
-
headers?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Called when a whole group or period header is clicked. The run says
|
|
76
|
-
* whether the click was additive — Cmd or Ctrl held — so a tool can let a
|
|
77
|
-
* reader put two periods on one chart. Without it the strips are labels
|
|
78
|
-
* rather than buttons.
|
|
79
|
-
* @default undefined
|
|
80
|
-
*/
|
|
81
|
-
onSelectRange?: (range: ElementRange) => void;
|
|
82
|
-
/**
|
|
83
|
-
* Whether to draw the family legend under the grid.
|
|
84
|
-
* @default false
|
|
85
|
-
*/
|
|
86
|
-
legend?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Whether the dashed markers stand where the two inner-transition series were
|
|
89
|
-
* lifted out of the main block.
|
|
90
|
-
* @default true
|
|
91
|
-
*/
|
|
92
|
-
markers?: boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Whether the arrow keys walk the grid: down from carbon is silicon, and
|
|
95
|
-
* right from the end of a period is the start of the next.
|
|
96
|
-
* @default true
|
|
97
|
-
*/
|
|
98
|
-
keyboard?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Called on pointer enter with the symbol, and on leave with `null`.
|
|
101
|
-
* @default undefined
|
|
102
|
-
*/
|
|
103
|
-
onHover?: (symbol: string | null) => void;
|
|
104
|
-
/**
|
|
105
|
-
* Class of the outermost element.
|
|
106
|
-
* @default undefined
|
|
107
|
-
*/
|
|
108
|
-
className?: string;
|
|
109
|
-
}
|
|
12
|
+
import type { ReactElement } from 'react';
|
|
13
|
+
import type { PeriodicTableProps } from './periodicTableProps.ts';
|
|
14
|
+
export type { PeriodicTableProps } from './periodicTableProps.ts';
|
|
110
15
|
/**
|
|
111
16
|
* The 118 elements, laid out as the table.
|
|
112
17
|
* @param props - See {@link PeriodicTableProps}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeriodicTable.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTable.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"PeriodicTable.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTable.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAuBzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAIlE,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,CA4HrE"}
|
|
@@ -3,19 +3,20 @@ import { useEffect, useRef } from 'react';
|
|
|
3
3
|
import { useResizeObserver } from "../../hooks/ui/useResizeObserver.js";
|
|
4
4
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
5
5
|
import { categorySwatch } from "../core/categories.js";
|
|
6
|
-
import {
|
|
6
|
+
import { elementByArrowKey, placedElements } from "../core/layout.js";
|
|
7
7
|
import { CategoryLegend } from "./CategoryLegend.js";
|
|
8
8
|
import { ElementCell } from "./ElementCell.js";
|
|
9
9
|
import { HeaderStrips, InnerTransitionMarkers, } from "./PeriodicTableChrome.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { SHELLS_RESERVED, detailType, shellFontSize, textWidthInEm, } from "./cellType.js";
|
|
11
|
+
import { gridStyle, insetStyle, rootStyle } from "./tableLayout.js";
|
|
12
|
+
import { UNIT_PROPERTY, unitValue } from "./unit.js";
|
|
12
13
|
/**
|
|
13
14
|
* The 118 elements, laid out as the table.
|
|
14
15
|
* @param props - See {@link PeriodicTableProps}.
|
|
15
16
|
* @returns The grid, its optional chrome, and its optional legend.
|
|
16
17
|
*/
|
|
17
18
|
export function PeriodicTable(props) {
|
|
18
|
-
const { selected, onSelect, swatchOf = defaultSwatchOf, detailOf, nameOf = defaultNameOf, shellsOf, isIncluded, inset, headers = false, onSelectRange, legend = false, markers = true, keyboard = true, onHover, className, } = props;
|
|
19
|
+
const { selected, onSelect, swatchOf = defaultSwatchOf, detailOf, nameOf = defaultNameOf, shellsOf, isIncluded, inset, headers = false, onSelectRange, onSelectAll, legend = false, markers = true, keyboard = true, onHover, className, } = props;
|
|
19
20
|
const t = useChromeT();
|
|
20
21
|
const rootRef = useRef(null);
|
|
21
22
|
const gridRef = useRef(null);
|
|
@@ -48,7 +49,7 @@ export function PeriodicTable(props) {
|
|
|
48
49
|
return;
|
|
49
50
|
event.preventDefault();
|
|
50
51
|
cameFromKeyRef.current = true;
|
|
51
|
-
onSelect(next.symbol);
|
|
52
|
+
onSelect(next.symbol, PLAIN_PICK);
|
|
52
53
|
}
|
|
53
54
|
// One size for the whole table rather than one per cell: a column of values
|
|
54
55
|
// written at eleven sizes is read as eleven things, and a name shrunk to a
|
|
@@ -67,30 +68,7 @@ export function PeriodicTable(props) {
|
|
|
67
68
|
const reserved = deepest === 0 ? 0 : SHELLS_RESERVED;
|
|
68
69
|
const type = detailType(widths, reserved);
|
|
69
70
|
const shellSize = shellFontSize(deepest);
|
|
70
|
-
return (_jsxs("div", { ref: rootRef, className: className, style: rootStyle, children: [_jsxs("div", { ref: gridRef, role: "grid", "aria-label": t('periodic.table'), "data-testid": "periodic-table", style: gridStyle(headers), onKeyDown: handleKeyDown, children: [headers ? _jsx(HeaderStrips, { onSelectRange: onSelectRange }) : null, inset === undefined ? null : (_jsx("div", { style: insetStyle(offset), children: inset })), markers ? _jsx(InnerTransitionMarkers, { offset: offset }) : null, placed.map(({ element, cell }) => (_jsx(ElementCell, { atomicNumber: element.atomicNumber, symbol: element.symbol, name: nameOf(element), detail: detailOf?.(element), detailType: type, shells: shellsOf?.(element), shellSize: shellSize, 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] }));
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Where what the caller writes in the empty block is placed.
|
|
74
|
-
* @param offset - 1 when the table draws its header strips, 0 otherwise.
|
|
75
|
-
* @returns The style of the slot.
|
|
76
|
-
*/
|
|
77
|
-
function insetStyle(offset) {
|
|
78
|
-
return {
|
|
79
|
-
alignItems: 'center',
|
|
80
|
-
display: 'flex',
|
|
81
|
-
// A column of air on each side, so the writing reads as sitting in the
|
|
82
|
-
// block rather than as running into the cells beside it.
|
|
83
|
-
padding: `0 ${ofWidth(2.4)}`,
|
|
84
|
-
gridColumn: `${String(EMPTY_BLOCK.column + offset)} / span ${String(EMPTY_BLOCK.columnSpan)}`,
|
|
85
|
-
gridRow: `${String(EMPTY_BLOCK.row + offset)} / span ${String(EMPTY_BLOCK.rowSpan)}`,
|
|
86
|
-
// A share of the table, with a floor, exactly as a cell sizes its symbol:
|
|
87
|
-
// the block holds the same three rows at every width, so what is written
|
|
88
|
-
// in it has to shrink with them.
|
|
89
|
-
fontSize: `max(0.6rem, ${ofWidth(1.8)})`,
|
|
90
|
-
lineHeight: 1.35,
|
|
91
|
-
minWidth: 0,
|
|
92
|
-
overflow: 'hidden',
|
|
93
|
-
};
|
|
71
|
+
return (_jsxs("div", { ref: rootRef, className: className, "data-figure": "html", style: rootStyle, children: [_jsxs("div", { ref: gridRef, role: "grid", "aria-label": t('periodic.table'), "data-testid": "periodic-table", style: gridStyle(headers), onKeyDown: handleKeyDown, children: [headers ? (_jsx(HeaderStrips, { onSelectRange: onSelectRange, onSelectAll: onSelectAll })) : null, inset === undefined ? null : (_jsx("div", { style: insetStyle(offset), children: inset })), markers ? _jsx(InnerTransitionMarkers, { offset: offset }) : null, placed.map(({ element, cell }) => (_jsx(ElementCell, { atomicNumber: element.atomicNumber, symbol: element.symbol, name: nameOf(element), detail: detailOf?.(element), detailType: type, shells: shellsOf?.(element), shellSize: shellSize, 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] }));
|
|
94
72
|
}
|
|
95
73
|
function defaultSwatchOf(element) {
|
|
96
74
|
return categorySwatch(element.category);
|
|
@@ -98,63 +76,10 @@ function defaultSwatchOf(element) {
|
|
|
98
76
|
function defaultNameOf(element) {
|
|
99
77
|
return element.name;
|
|
100
78
|
}
|
|
79
|
+
/** The arrow keys walk the table to read it; they never add to a set. */
|
|
80
|
+
const PLAIN_PICK = { additive: false };
|
|
101
81
|
function noop() {
|
|
102
82
|
// A table with no `onSelect` is a figure; its cells stay buttons so the
|
|
103
83
|
// keyboard and a screen reader still reach every element.
|
|
104
84
|
}
|
|
105
|
-
/** Narrowest the table is ever drawn; under it the type stops being readable. */
|
|
106
|
-
const MIN_WIDTH = 280;
|
|
107
|
-
/**
|
|
108
|
-
* How tall one row of elements is, as a share of the table's width.
|
|
109
|
-
*
|
|
110
|
-
* A column is about 5.2% of that width, so a cell is a third taller than it is
|
|
111
|
-
* wide — the proportion of a wall chart, and the room the three bands of a
|
|
112
|
-
* cell need to be read from the back of a room. It is the same height in every
|
|
113
|
-
* table: a cell keeps the band it writes a value in whether or not that table
|
|
114
|
-
* writes one.
|
|
115
|
-
*/
|
|
116
|
-
const ROW_HEIGHT = ofWidth(ROW_SHARE);
|
|
117
|
-
/** The band the two inner-transition series were lifted out across. */
|
|
118
|
-
const SERIES_GAP = `max(6px, ${ofWidth(1.1)})`;
|
|
119
|
-
const rootStyle = {
|
|
120
|
-
display: 'flex',
|
|
121
|
-
flexDirection: 'column',
|
|
122
|
-
gap: 8,
|
|
123
|
-
minWidth: MIN_WIDTH,
|
|
124
|
-
// Everything inside — the height of a row as much as the type in a cell — is
|
|
125
|
-
// a share of this box rather than of the page, so the same table reads at
|
|
126
|
-
// 280px beside a chart and fills a lecture-hall screen at twice that. The
|
|
127
|
-
// share is measured (see `unit.ts`); the container is what the `1cqw`
|
|
128
|
-
// fallback and a site's own `@container` rules are answered by, and it keeps
|
|
129
|
-
// this box's width independent of what is written inside it.
|
|
130
|
-
containerType: 'inline-size',
|
|
131
|
-
};
|
|
132
|
-
const baseGridStyle = {
|
|
133
|
-
display: 'grid',
|
|
134
|
-
gap: 2,
|
|
135
|
-
minWidth: MIN_WIDTH,
|
|
136
|
-
width: '100%',
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* The grid the cells are placed on.
|
|
140
|
-
* @param headers - Whether a leading column and row hold the period and group
|
|
141
|
-
* numbers.
|
|
142
|
-
* @returns The style of the grid.
|
|
143
|
-
*/
|
|
144
|
-
function gridStyle(headers) {
|
|
145
|
-
// The eighth row is the gap the inner-transition series are lifted out into.
|
|
146
|
-
const rows = `repeat(7, ${ROW_HEIGHT}) ${SERIES_GAP} repeat(2, ${ROW_HEIGHT})`;
|
|
147
|
-
if (!headers) {
|
|
148
|
-
return {
|
|
149
|
-
...baseGridStyle,
|
|
150
|
-
gridTemplateColumns: `repeat(${String(COLUMN_COUNT)}, minmax(0, 1fr))`,
|
|
151
|
-
gridTemplateRows: rows,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
return {
|
|
155
|
-
...baseGridStyle,
|
|
156
|
-
gridTemplateColumns: `max(14px, ${ofWidth(2.4)}) repeat(${String(COLUMN_COUNT)}, minmax(0, 1fr))`,
|
|
157
|
-
gridTemplateRows: `max(12px, ${ofWidth(2)}) ${rows}`,
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
85
|
//# sourceMappingURL=PeriodicTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeriodicTable.js","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTable.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PeriodicTable.js","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTable.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,sBAAsB,GACvB,MAAM,0BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,UAAU,EACV,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAIrD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,GAAG,eAAe,EAC1B,QAAQ,EACR,MAAM,GAAG,aAAa,EACtB,QAAQ,EACR,UAAU,EACV,KAAK,EACL,OAAO,G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M,CAAC,CAAC,CAAC,KAAC,cAAc,KAAG,CAAC,CAAC,CAAC,IAAI,IAC/B,CACP,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,OAAwB;IAC/C,OAAO,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,OAAwB;IAC7C,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,GAAgB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAEpD,SAAS,IAAI;IACX,wEAAwE;IACxE,0DAA0D;AAC5D,CAAC"}
|
|
@@ -12,14 +12,24 @@ interface HeaderStripsProps {
|
|
|
12
12
|
* @default undefined
|
|
13
13
|
*/
|
|
14
14
|
onSelectRange?: (range: ElementRange) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Called when the corner where the two strips meet is clicked. The corner of
|
|
17
|
+
* a spreadsheet takes everything, and a table whose rows and columns are one
|
|
18
|
+
* click each owes the same for the whole of it. Without it the corner stays
|
|
19
|
+
* empty.
|
|
20
|
+
* @default undefined
|
|
21
|
+
*/
|
|
22
|
+
onSelectAll?: () => void;
|
|
15
23
|
}
|
|
16
24
|
/**
|
|
17
|
-
* The 1–18 strip along the top
|
|
25
|
+
* The 1–18 strip along the top, the 1–7 strip down the left, and the corner
|
|
26
|
+
* where they meet.
|
|
18
27
|
*
|
|
19
28
|
* They are buttons when the table takes a range: "plot period 3" is one click
|
|
20
|
-
* there and eight on the cells.
|
|
29
|
+
* there and eight on the cells. The corner takes the whole table, which is the
|
|
30
|
+
* gesture a spreadsheet has taught everybody.
|
|
21
31
|
* @param props - See {@link HeaderStripsProps}.
|
|
22
|
-
* @returns The two strips,
|
|
32
|
+
* @returns The two strips, the corner, and the inner-transition period numbers.
|
|
23
33
|
*/
|
|
24
34
|
export declare function HeaderStrips(props: HeaderStripsProps): ReactElement;
|
|
25
35
|
/** What {@link InnerTransitionMarkers} needs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeriodicTableChrome.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTableChrome.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"PeriodicTableChrome.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTableChrome.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAWtD,uCAAuC;AACvC,UAAU,iBAAiB;IACzB;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC9C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAoEnE;AAED,iDAAiD;AACjD,UAAU,2BAA2B;IACnC,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,2BAA2B,GACjC,YAAY,CAmBd"}
|
|
@@ -2,17 +2,21 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
3
3
|
import { TOKEN } from "../../tokens/core/familyTokens.js";
|
|
4
4
|
import { COLUMN_COUNT, INNER_TRANSITION_MARKERS, INNER_TRANSITION_ROWS, } from "../core/layout.js";
|
|
5
|
+
import { SelectAllCorner } from "./SelectAllCorner.js";
|
|
6
|
+
import { headerButtonStyle, headerStyle } from "./headerStyles.js";
|
|
5
7
|
import { ofWidth } from "./unit.js";
|
|
6
8
|
/**
|
|
7
|
-
* The 1–18 strip along the top
|
|
9
|
+
* The 1–18 strip along the top, the 1–7 strip down the left, and the corner
|
|
10
|
+
* where they meet.
|
|
8
11
|
*
|
|
9
12
|
* They are buttons when the table takes a range: "plot period 3" is one click
|
|
10
|
-
* there and eight on the cells.
|
|
13
|
+
* there and eight on the cells. The corner takes the whole table, which is the
|
|
14
|
+
* gesture a spreadsheet has taught everybody.
|
|
11
15
|
* @param props - See {@link HeaderStripsProps}.
|
|
12
|
-
* @returns The two strips,
|
|
16
|
+
* @returns The two strips, the corner, and the inner-transition period numbers.
|
|
13
17
|
*/
|
|
14
18
|
export function HeaderStrips(props) {
|
|
15
|
-
const { onSelectRange } = props;
|
|
19
|
+
const { onSelectRange, onSelectAll } = props;
|
|
16
20
|
const t = useChromeT();
|
|
17
21
|
const groups = [];
|
|
18
22
|
for (let group = 1; group <= COLUMN_COUNT; group++) {
|
|
@@ -36,7 +40,7 @@ export function HeaderStrips(props) {
|
|
|
36
40
|
});
|
|
37
41
|
}) }, `period-${String(period)}`));
|
|
38
42
|
}
|
|
39
|
-
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)}`)))] }));
|
|
43
|
+
return (_jsxs(_Fragment, { children: [onSelectAll === undefined ? null : (_jsx(SelectAllCorner, { title: t('periodic.allElements'), onClick: onSelectAll })), groups, periods, INNER_TRANSITION_ROWS.map(({ row, period }) => (_jsx("div", { style: { ...headerStyle, gridColumn: 1, gridRow: row + 1 }, children: period }, `inner-${String(row)}`)))] }));
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
42
46
|
* The two cells the lanthanoids and the actinoids were lifted out of.
|
|
@@ -66,22 +70,8 @@ function HeaderCell(props) {
|
|
|
66
70
|
const style = { ...headerStyle, gridColumn: column, gridRow: row };
|
|
67
71
|
if (onClick === undefined)
|
|
68
72
|
return _jsx("div", { style: style, children: label });
|
|
69
|
-
return (_jsx("button", { type: "button", "aria-label": title, onClick: onClick, style: { ...style, ...headerButtonStyle }, children: label }));
|
|
73
|
+
return (_jsx("button", { type: "button", "aria-label": title, title: title, onClick: onClick, style: { ...style, ...headerButtonStyle }, children: label }));
|
|
70
74
|
}
|
|
71
|
-
const headerStyle = {
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
color: TOKEN.textMuted,
|
|
74
|
-
display: 'flex',
|
|
75
|
-
fontSize: `max(0.45rem, ${ofWidth(1.35)})`,
|
|
76
|
-
justifyContent: 'center',
|
|
77
|
-
padding: 0,
|
|
78
|
-
};
|
|
79
|
-
const headerButtonStyle = {
|
|
80
|
-
background: 'none',
|
|
81
|
-
border: 'none',
|
|
82
|
-
cursor: 'pointer',
|
|
83
|
-
font: 'inherit',
|
|
84
|
-
};
|
|
85
75
|
const markerStyle = {
|
|
86
76
|
alignItems: 'center',
|
|
87
77
|
border: `1px dashed ${TOKEN.borderStrong}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeriodicTableChrome.js","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTableChrome.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAE1D,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"PeriodicTableChrome.js","sourceRoot":"","sources":["../../../src/periodic/ui/PeriodicTableChrome.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK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I,CAAC,MAAM,GAAG,MAAM;gBAChC,OAAO,EAAE,IAAI,CAAC,GAAG,GAAG,MAAM;aAC3B,YAEA,KAAK,IARD,QAAQ,CAST,CACP,CAAC,GACD,CACJ,CAAC;AACJ,CAAC;AAUD;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,KAAiB;IACnC,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC;AACxC,CAAC;AAED,SAAS,UAAU,CAAC,KAAsB;IACxC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,KAAK,GAAG,EAAE,GAAG,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IACnE,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,cAAK,KAAK,EAAE,KAAK,YAAG,KAAK,GAAO,CAAC;IACnE,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,gBACD,KAAK,EACjB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,iBAAiB,EAAE,YAExC,KAAK,GACC,CACV,CAAC;AACJ,CAAC;AAED,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE,cAAc,KAAK,CAAC,YAAY,EAAE;IAC1C,YAAY,EAAE,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,eAAe,OAAO,CAAC,IAAI,CAAC,GAAG;IACzC,cAAc,EAAE,QAAQ;CACQ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
/** What {@link SelectAllCorner} needs. */
|
|
3
|
+
interface SelectAllCornerProps {
|
|
4
|
+
/** What it does, for the pointer and for a screen reader. */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Called when it is clicked. */
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The corner where the two header strips meet, which takes the whole table.
|
|
11
|
+
*
|
|
12
|
+
* It is a control and nothing else, so it stays out of sight until it is
|
|
13
|
+
* pointed at or reached from the keyboard, and it is left off a print and out
|
|
14
|
+
* of a saved figure. The glyph points into the grid it takes, as a
|
|
15
|
+
* spreadsheet's does; it is a mark rather than a word because the corner is a
|
|
16
|
+
* seventeenth of the table's width, and the word differs in every language the
|
|
17
|
+
* chrome speaks.
|
|
18
|
+
* @param props - See {@link SelectAllCornerProps}.
|
|
19
|
+
* @returns The corner.
|
|
20
|
+
*/
|
|
21
|
+
export declare function SelectAllCorner(props: SelectAllCornerProps): ReactElement;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=SelectAllCorner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectAllCorner.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/SelectAllCorner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,OAAO,CAAC;AAKtD,0CAA0C;AAC1C,UAAU,oBAAoB;IAC5B,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAuCzE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { headerButtonStyle, headerStyle } from "./headerStyles.js";
|
|
4
|
+
/**
|
|
5
|
+
* The corner where the two header strips meet, which takes the whole table.
|
|
6
|
+
*
|
|
7
|
+
* It is a control and nothing else, so it stays out of sight until it is
|
|
8
|
+
* pointed at or reached from the keyboard, and it is left off a print and out
|
|
9
|
+
* of a saved figure. The glyph points into the grid it takes, as a
|
|
10
|
+
* spreadsheet's does; it is a mark rather than a word because the corner is a
|
|
11
|
+
* seventeenth of the table's width, and the word differs in every language the
|
|
12
|
+
* chrome speaks.
|
|
13
|
+
* @param props - See {@link SelectAllCornerProps}.
|
|
14
|
+
* @returns The corner.
|
|
15
|
+
*/
|
|
16
|
+
export function SelectAllCorner(props) {
|
|
17
|
+
const { title, onClick } = props;
|
|
18
|
+
const [pointed, setPointed] = useState(false);
|
|
19
|
+
const [focused, setFocused] = useState(false);
|
|
20
|
+
return (_jsx("button", { type: "button", "aria-label": title, title: title, onClick: onClick, style: {
|
|
21
|
+
...headerStyle,
|
|
22
|
+
gridColumn: 1,
|
|
23
|
+
gridRow: 1,
|
|
24
|
+
...headerButtonStyle,
|
|
25
|
+
opacity: pointed || focused ? 1 : 0,
|
|
26
|
+
transition: 'opacity 120ms ease',
|
|
27
|
+
}, className: "no-print", "data-figure": "chrome", onPointerEnter: () => {
|
|
28
|
+
setPointed(true);
|
|
29
|
+
}, onPointerLeave: () => {
|
|
30
|
+
setPointed(false);
|
|
31
|
+
},
|
|
32
|
+
// Only a focus the keyboard gave it: a click focuses it too, and the
|
|
33
|
+
// glyph would otherwise stay up after the pointer has gone.
|
|
34
|
+
onFocus: (event) => {
|
|
35
|
+
setFocused(event.currentTarget.matches(':focus-visible'));
|
|
36
|
+
}, onBlur: () => {
|
|
37
|
+
setFocused(false);
|
|
38
|
+
}, children: "\u25E2" }));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=SelectAllCorner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectAllCorner.js","sourceRoot":"","sources":["../../../src/periodic/ui/SelectAllCorner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUnE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACjC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,gBACD,KAAK,EACjB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;YACL,GAAG,WAAW;YACd,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;YACV,GAAG,iBAAiB;YACpB,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnC,UAAU,EAAE,oBAAoB;SACjC,EACD,SAAS,EAAC,UAAU,iBACR,QAAQ,EACpB,cAAc,EAAE,GAAG,EAAE;YACnB,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,EACD,cAAc,EAAE,GAAG,EAAE;YACnB,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;QACD,qEAAqE;QACrE,4DAA4D;QAC5D,OAAO,EAAE,CAAC,KAAoC,EAAE,EAAE;YAChD,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC5D,CAAC,EACD,MAAM,EAAE,GAAG,EAAE;YACX,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,uBAGM,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** A group or period number, and the corner where the two strips meet. */
|
|
2
|
+
export declare const headerStyle: {
|
|
3
|
+
readonly alignItems: "center";
|
|
4
|
+
readonly color: string;
|
|
5
|
+
readonly display: "flex";
|
|
6
|
+
readonly fontSize: `max(0.45rem, ${string})`;
|
|
7
|
+
readonly justifyContent: "center";
|
|
8
|
+
readonly padding: 0;
|
|
9
|
+
};
|
|
10
|
+
/** The same, when it is a button: the type and the ground stay the strip's. */
|
|
11
|
+
export declare const headerButtonStyle: {
|
|
12
|
+
readonly background: "none";
|
|
13
|
+
readonly border: "none";
|
|
14
|
+
readonly cursor: "pointer";
|
|
15
|
+
readonly font: "inherit";
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=headerStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headerStyles.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/headerStyles.ts"],"names":[],"mappings":"AAMA,0EAA0E;AAC1E,eAAO,MAAM,WAAW;;;;;;;CAOU,CAAC;AAEnC,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB;;;;;CAKI,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TOKEN } from "../../tokens/core/familyTokens.js";
|
|
2
|
+
import { ofWidth } from "./unit.js";
|
|
3
|
+
/** A group or period number, and the corner where the two strips meet. */
|
|
4
|
+
export const headerStyle = {
|
|
5
|
+
alignItems: 'center',
|
|
6
|
+
color: TOKEN.textMuted,
|
|
7
|
+
display: 'flex',
|
|
8
|
+
fontSize: `max(0.45rem, ${ofWidth(1.35)})`,
|
|
9
|
+
justifyContent: 'center',
|
|
10
|
+
padding: 0,
|
|
11
|
+
};
|
|
12
|
+
/** The same, when it is a button: the type and the ground stay the strip's. */
|
|
13
|
+
export const headerButtonStyle = {
|
|
14
|
+
background: 'none',
|
|
15
|
+
border: 'none',
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
font: 'inherit',
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=headerStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headerStyles.js","sourceRoot":"","sources":["../../../src/periodic/ui/headerStyles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,gBAAgB,OAAO,CAAC,IAAI,CAAC,GAAG;IAC1C,cAAc,EAAE,QAAQ;IACxB,OAAO,EAAE,CAAC;CACsB,CAAC;AAEnC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;CACiB,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a caller hands a `PeriodicTable`.
|
|
3
|
+
*
|
|
4
|
+
* The props live beside the component rather than inside it, so a reader
|
|
5
|
+
* looking for what the table does does not scroll past a page of options.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactNode } from 'react';
|
|
8
|
+
import type { Swatch } from '../../color/core/interpolate.ts';
|
|
9
|
+
import type { PeriodicElement } from '../core/elements.ts';
|
|
10
|
+
import type { ElementPick, ElementRange } from '../core/layout.ts';
|
|
11
|
+
/** What `PeriodicTable` needs. */
|
|
12
|
+
export interface PeriodicTableProps {
|
|
13
|
+
/**
|
|
14
|
+
* Symbol of the element the tools are pointed at.
|
|
15
|
+
* @default undefined — none is
|
|
16
|
+
*/
|
|
17
|
+
selected?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Called with the symbol of the element that was clicked, and by the arrow
|
|
20
|
+
* keys. The pick says whether the click was additive — Cmd or Ctrl held — so
|
|
21
|
+
* a tool whose plain click already reads one element into a card can let the
|
|
22
|
+
* same table build a set of them.
|
|
23
|
+
* @default undefined — the table is a figure rather than a control
|
|
24
|
+
*/
|
|
25
|
+
onSelect?: (symbol: string, pick: ElementPick) => void;
|
|
26
|
+
/**
|
|
27
|
+
* The colour each cell takes.
|
|
28
|
+
* @default the family colour
|
|
29
|
+
*/
|
|
30
|
+
swatchOf?: (element: PeriodicElement) => Swatch;
|
|
31
|
+
/**
|
|
32
|
+
* What is written under the symbol; an empty string writes nothing.
|
|
33
|
+
* @default nothing is written
|
|
34
|
+
*/
|
|
35
|
+
detailOf?: (element: PeriodicElement) => string;
|
|
36
|
+
/**
|
|
37
|
+
* How an element is named, for the label a screen reader reads. The hook a
|
|
38
|
+
* site translating the table writes its own names through.
|
|
39
|
+
* @default the English name
|
|
40
|
+
*/
|
|
41
|
+
nameOf?: (element: PeriodicElement) => string;
|
|
42
|
+
/**
|
|
43
|
+
* Electrons in each shell of an element, innermost first, written down the
|
|
44
|
+
* right-hand edge of its cell. The energy levels, which a table is also read
|
|
45
|
+
* for: none of ours knows them, so the tool that does says so here.
|
|
46
|
+
* @default undefined — no cell writes any
|
|
47
|
+
*/
|
|
48
|
+
shellsOf?: (element: PeriodicElement) => readonly number[] | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Whether an element is inside the set the tool is showing. Everything
|
|
51
|
+
* outside it is dimmed rather than removed, so the table keeps its shape.
|
|
52
|
+
* @default every element is
|
|
53
|
+
*/
|
|
54
|
+
isIncluded?: (element: PeriodicElement) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* What is written in the block the table leaves empty — columns 3 to 12 of
|
|
57
|
+
* the first three periods, in the middle of the top edge. A tool that reads
|
|
58
|
+
* one element off the table puts what it says about it there, where the eye
|
|
59
|
+
* already is, rather than under the grid.
|
|
60
|
+
*
|
|
61
|
+
* It is sized against the table, like everything else in the grid, so give
|
|
62
|
+
* it type in `em` and it scales with the drawing.
|
|
63
|
+
* @default undefined — the block stays empty
|
|
64
|
+
*/
|
|
65
|
+
inset?: ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* Whether to draw the group and period strips.
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
headers?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Called when a whole group or period header is clicked. The run says
|
|
73
|
+
* whether the click was additive — Cmd or Ctrl held — so a tool can let a
|
|
74
|
+
* reader put two periods on one chart. Without it the strips are labels
|
|
75
|
+
* rather than buttons.
|
|
76
|
+
* @default undefined
|
|
77
|
+
*/
|
|
78
|
+
onSelectRange?: (range: ElementRange) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Called when the corner where the two header strips meet is clicked, which
|
|
81
|
+
* is how a reader takes the whole table back. The corner shows its glyph only
|
|
82
|
+
* while it is pointed at or reached from the keyboard. Without it the corner
|
|
83
|
+
* stays empty.
|
|
84
|
+
* @default undefined
|
|
85
|
+
*/
|
|
86
|
+
onSelectAll?: () => void;
|
|
87
|
+
/**
|
|
88
|
+
* Whether to draw the family legend under the grid.
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
legend?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the dashed markers stand where the two inner-transition series were
|
|
94
|
+
* lifted out of the main block.
|
|
95
|
+
* @default true
|
|
96
|
+
*/
|
|
97
|
+
markers?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Whether the arrow keys walk the grid: down from carbon is silicon, and
|
|
100
|
+
* right from the end of a period is the start of the next.
|
|
101
|
+
* @default true
|
|
102
|
+
*/
|
|
103
|
+
keyboard?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Called on pointer enter with the symbol, and on leave with `null`.
|
|
106
|
+
* @default undefined
|
|
107
|
+
*/
|
|
108
|
+
onHover?: (symbol: string | null) => void;
|
|
109
|
+
/**
|
|
110
|
+
* Class of the outermost element.
|
|
111
|
+
* @default undefined
|
|
112
|
+
*/
|
|
113
|
+
className?: string;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=periodicTableProps.d.ts.map
|
|
@@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AAM,IAAI,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a caller hands a `PeriodicTable`.
|
|
3
|
+
*
|
|
4
|
+
* The props live beside the component rather than inside it, so a reader
|
|
5
|
+
* looking for what the table does does not scroll past a page of options.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=periodicTableProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"periodicTableProps.js","sourceRoot":"","sources":["../../../src/periodic/ui/periodicTableProps.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|