react-cheminfo 0.47.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/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/locales/de.json +55 -1
- package/lib/locales/en.json +55 -1
- package/lib/locales/es.json +55 -1
- package/lib/locales/fr.json +55 -1
- package/lib/locales/it.json +55 -1
- package/lib/periodic/ui/PeriodicTable.d.ts +3 -107
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +5 -82
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/periodic/ui/PeriodicTableChrome.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTableChrome.js +3 -25
- 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 +0 -1
- package/lib/split/ui/SplitColumn.d.ts.map +1 -1
- package/lib/split/ui/SplitColumn.js +0 -1
- package/lib/split/ui/SplitColumn.js.map +1 -1
- package/lib/split/ui/SplitRow.d.ts +0 -1
- package/lib/split/ui/SplitRow.d.ts.map +1 -1
- package/lib/split/ui/SplitRow.js +0 -1
- package/lib/split/ui/SplitRow.js.map +1 -1
- package/lib/split/ui/splitPanes.d.ts +12 -1
- package/lib/split/ui/splitPanes.d.ts.map +1 -1
- package/lib/split/ui/splitPanes.js +1 -4
- package/lib/split/ui/splitPanes.js.map +1 -1
- 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/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/locales/de.json +55 -1
- package/src/locales/en.json +55 -1
- package/src/locales/es.json +55 -1
- package/src/locales/fr.json +55 -1
- package/src/locales/it.json +55 -1
- package/src/periodic/ui/PeriodicTable.tsx +16 -204
- package/src/periodic/ui/PeriodicTableChrome.tsx +3 -24
- 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 +0 -1
- package/src/split/ui/SplitRow.tsx +0 -1
- package/src/split/ui/splitPanes.tsx +21 -5
- 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,113 +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 { ElementPick, 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. The pick says whether the click was additive — Cmd or Ctrl held — so
|
|
26
|
-
* a tool whose plain click already reads one element into a card can let the
|
|
27
|
-
* same table build a set of them.
|
|
28
|
-
* @default undefined — the table is a figure rather than a control
|
|
29
|
-
*/
|
|
30
|
-
onSelect?: (symbol: string, pick: ElementPick) => void;
|
|
31
|
-
/**
|
|
32
|
-
* The colour each cell takes.
|
|
33
|
-
* @default the family colour
|
|
34
|
-
*/
|
|
35
|
-
swatchOf?: (element: PeriodicElement) => Swatch;
|
|
36
|
-
/**
|
|
37
|
-
* What is written under the symbol; an empty string writes nothing.
|
|
38
|
-
* @default nothing is written
|
|
39
|
-
*/
|
|
40
|
-
detailOf?: (element: PeriodicElement) => string;
|
|
41
|
-
/**
|
|
42
|
-
* How an element is named, for the label a screen reader reads. The hook a
|
|
43
|
-
* site translating the table writes its own names through.
|
|
44
|
-
* @default the English name
|
|
45
|
-
*/
|
|
46
|
-
nameOf?: (element: PeriodicElement) => string;
|
|
47
|
-
/**
|
|
48
|
-
* Electrons in each shell of an element, innermost first, written down the
|
|
49
|
-
* right-hand edge of its cell. The energy levels, which a table is also read
|
|
50
|
-
* for: none of ours knows them, so the tool that does says so here.
|
|
51
|
-
* @default undefined — no cell writes any
|
|
52
|
-
*/
|
|
53
|
-
shellsOf?: (element: PeriodicElement) => readonly number[] | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* Whether an element is inside the set the tool is showing. Everything
|
|
56
|
-
* outside it is dimmed rather than removed, so the table keeps its shape.
|
|
57
|
-
* @default every element is
|
|
58
|
-
*/
|
|
59
|
-
isIncluded?: (element: PeriodicElement) => boolean;
|
|
60
|
-
/**
|
|
61
|
-
* What is written in the block the table leaves empty — columns 3 to 12 of
|
|
62
|
-
* the first three periods, in the middle of the top edge. A tool that reads
|
|
63
|
-
* one element off the table puts what it says about it there, where the eye
|
|
64
|
-
* already is, rather than under the grid.
|
|
65
|
-
*
|
|
66
|
-
* It is sized against the table, like everything else in the grid, so give
|
|
67
|
-
* it type in `em` and it scales with the drawing.
|
|
68
|
-
* @default undefined — the block stays empty
|
|
69
|
-
*/
|
|
70
|
-
inset?: ReactNode;
|
|
71
|
-
/**
|
|
72
|
-
* Whether to draw the group and period strips.
|
|
73
|
-
* @default false
|
|
74
|
-
*/
|
|
75
|
-
headers?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Called when a whole group or period header is clicked. The run says
|
|
78
|
-
* whether the click was additive — Cmd or Ctrl held — so a tool can let a
|
|
79
|
-
* reader put two periods on one chart. Without it the strips are labels
|
|
80
|
-
* rather than buttons.
|
|
81
|
-
* @default undefined
|
|
82
|
-
*/
|
|
83
|
-
onSelectRange?: (range: ElementRange) => void;
|
|
84
|
-
/**
|
|
85
|
-
* Called when the corner where the two header strips meet is clicked, which
|
|
86
|
-
* is how a reader takes the whole table back. Without it the corner stays
|
|
87
|
-
* empty.
|
|
88
|
-
* @default undefined
|
|
89
|
-
*/
|
|
90
|
-
onSelectAll?: () => void;
|
|
91
|
-
/**
|
|
92
|
-
* Whether to draw the family legend under the grid.
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
legend?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Whether the dashed markers stand where the two inner-transition series were
|
|
98
|
-
* lifted out of the main block.
|
|
99
|
-
* @default true
|
|
100
|
-
*/
|
|
101
|
-
markers?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Whether the arrow keys walk the grid: down from carbon is silicon, and
|
|
104
|
-
* right from the end of a period is the start of the next.
|
|
105
|
-
* @default true
|
|
106
|
-
*/
|
|
107
|
-
keyboard?: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Called on pointer enter with the symbol, and on leave with `null`.
|
|
110
|
-
* @default undefined
|
|
111
|
-
*/
|
|
112
|
-
onHover?: (symbol: string | null) => void;
|
|
113
|
-
/**
|
|
114
|
-
* Class of the outermost element.
|
|
115
|
-
* @default undefined
|
|
116
|
-
*/
|
|
117
|
-
className?: string;
|
|
118
|
-
}
|
|
12
|
+
import type { ReactElement } from 'react';
|
|
13
|
+
import type { PeriodicTableProps } from './periodicTableProps.ts';
|
|
14
|
+
export type { PeriodicTableProps } from './periodicTableProps.ts';
|
|
119
15
|
/**
|
|
120
16
|
* The 118 elements, laid out as the table.
|
|
121
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,12 +3,13 @@ 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}.
|
|
@@ -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, 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] }));
|
|
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);
|
|
@@ -104,59 +82,4 @@ function noop() {
|
|
|
104
82
|
// A table with no `onSelect` is a figure; its cells stay buttons so the
|
|
105
83
|
// keyboard and a screen reader still reach every element.
|
|
106
84
|
}
|
|
107
|
-
/** Narrowest the table is ever drawn; under it the type stops being readable. */
|
|
108
|
-
const MIN_WIDTH = 280;
|
|
109
|
-
/**
|
|
110
|
-
* How tall one row of elements is, as a share of the table's width.
|
|
111
|
-
*
|
|
112
|
-
* A column is about 5.2% of that width, so a cell is a third taller than it is
|
|
113
|
-
* wide — the proportion of a wall chart, and the room the three bands of a
|
|
114
|
-
* cell need to be read from the back of a room. It is the same height in every
|
|
115
|
-
* table: a cell keeps the band it writes a value in whether or not that table
|
|
116
|
-
* writes one.
|
|
117
|
-
*/
|
|
118
|
-
const ROW_HEIGHT = ofWidth(ROW_SHARE);
|
|
119
|
-
/** The band the two inner-transition series were lifted out across. */
|
|
120
|
-
const SERIES_GAP = `max(6px, ${ofWidth(1.1)})`;
|
|
121
|
-
const rootStyle = {
|
|
122
|
-
display: 'flex',
|
|
123
|
-
flexDirection: 'column',
|
|
124
|
-
gap: 8,
|
|
125
|
-
minWidth: MIN_WIDTH,
|
|
126
|
-
// Everything inside — the height of a row as much as the type in a cell — is
|
|
127
|
-
// a share of this box rather than of the page, so the same table reads at
|
|
128
|
-
// 280px beside a chart and fills a lecture-hall screen at twice that. The
|
|
129
|
-
// share is measured (see `unit.ts`); the container is what the `1cqw`
|
|
130
|
-
// fallback and a site's own `@container` rules are answered by, and it keeps
|
|
131
|
-
// this box's width independent of what is written inside it.
|
|
132
|
-
containerType: 'inline-size',
|
|
133
|
-
};
|
|
134
|
-
const baseGridStyle = {
|
|
135
|
-
display: 'grid',
|
|
136
|
-
gap: 2,
|
|
137
|
-
minWidth: MIN_WIDTH,
|
|
138
|
-
width: '100%',
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* The grid the cells are placed on.
|
|
142
|
-
* @param headers - Whether a leading column and row hold the period and group
|
|
143
|
-
* numbers.
|
|
144
|
-
* @returns The style of the grid.
|
|
145
|
-
*/
|
|
146
|
-
function gridStyle(headers) {
|
|
147
|
-
// The eighth row is the gap the inner-transition series are lifted out into.
|
|
148
|
-
const rows = `repeat(7, ${ROW_HEIGHT}) ${SERIES_GAP} repeat(2, ${ROW_HEIGHT})`;
|
|
149
|
-
if (!headers) {
|
|
150
|
-
return {
|
|
151
|
-
...baseGridStyle,
|
|
152
|
-
gridTemplateColumns: `repeat(${String(COLUMN_COUNT)}, minmax(0, 1fr))`,
|
|
153
|
-
gridTemplateRows: rows,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
return {
|
|
157
|
-
...baseGridStyle,
|
|
158
|
-
gridTemplateColumns: `max(14px, ${ofWidth(2.4)}) repeat(${String(COLUMN_COUNT)}, minmax(0, 1fr))`,
|
|
159
|
-
gridTemplateRows: `max(12px, ${ofWidth(2)}) ${rows}`,
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
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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zB,UAAU,EAAE,OAAO,CAAC,MAAM,KAAK,QAAQ,EACvC,UAAU,EAAE,UAAU,EAAE,CAAC,OAAO,CAAC,EACjC,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM,EAC5B,GAAG,EAAE,IAAI,CAAC,GAAG,GAAG,MAAM,EACtB,QAAQ,EAAE,QAAQ,IAAI,IAAI,EAC1B,OAAO,EAAE,OAAO,IAdX,OAAO,CAAC,MAAM,CAenB,CACH,CAAC,IACE,EACL,MAAM,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"}
|
|
@@ -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,6 +2,8 @@ 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
9
|
* The 1–18 strip along the top, the 1–7 strip down the left, and the corner
|
|
@@ -38,17 +40,7 @@ export function HeaderStrips(props) {
|
|
|
38
40
|
});
|
|
39
41
|
}) }, `period-${String(period)}`));
|
|
40
42
|
}
|
|
41
|
-
return (_jsxs(_Fragment, { children: [onSelectAll === undefined ? null : (_jsx(
|
|
42
|
-
// The glyph points into the grid it takes, as a spreadsheet's does.
|
|
43
|
-
// It is a mark rather than a word because the corner is a
|
|
44
|
-
// seventeenth of the table's width, and the word differs in every
|
|
45
|
-
// language the chrome speaks.
|
|
46
|
-
, {
|
|
47
|
-
// The glyph points into the grid it takes, as a spreadsheet's does.
|
|
48
|
-
// It is a mark rather than a word because the corner is a
|
|
49
|
-
// seventeenth of the table's width, and the word differs in every
|
|
50
|
-
// language the chrome speaks.
|
|
51
|
-
label: "\u25E2", title: t('periodic.allElements'), column: 1, row: 1, onClick: onSelectAll })), 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)}`)))] }));
|
|
52
44
|
}
|
|
53
45
|
/**
|
|
54
46
|
* The two cells the lanthanoids and the actinoids were lifted out of.
|
|
@@ -80,20 +72,6 @@ function HeaderCell(props) {
|
|
|
80
72
|
return _jsx("div", { style: style, children: label });
|
|
81
73
|
return (_jsx("button", { type: "button", "aria-label": title, title: title, onClick: onClick, style: { ...style, ...headerButtonStyle }, children: label }));
|
|
82
74
|
}
|
|
83
|
-
const headerStyle = {
|
|
84
|
-
alignItems: 'center',
|
|
85
|
-
color: TOKEN.textMuted,
|
|
86
|
-
display: 'flex',
|
|
87
|
-
fontSize: `max(0.45rem, ${ofWidth(1.35)})`,
|
|
88
|
-
justifyContent: 'center',
|
|
89
|
-
padding: 0,
|
|
90
|
-
};
|
|
91
|
-
const headerButtonStyle = {
|
|
92
|
-
background: 'none',
|
|
93
|
-
border: 'none',
|
|
94
|
-
cursor: 'pointer',
|
|
95
|
-
font: 'inherit',
|
|
96
|
-
};
|
|
97
75
|
const markerStyle = {
|
|
98
76
|
alignItems: 'center',
|
|
99
77
|
border: `1px dashed ${TOKEN.borderStrong}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeriodicTableChrome.js","sourceRoot":"","sources":["../../../src/periodic/ui/Pe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,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"periodicTableProps.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/periodicTableProps.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC;IAChD;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC;IAC9C;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACvE;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC;IACnD;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC9C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the table is laid out: the box it measures, the grid its cells sit on,
|
|
3
|
+
* and the block a caller may write in.
|
|
4
|
+
*/
|
|
5
|
+
import type { CSSProperties } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Where what the caller writes in the empty block is placed.
|
|
8
|
+
* @param offset - 1 when the table draws its header strips, 0 otherwise.
|
|
9
|
+
* @returns The style of the slot.
|
|
10
|
+
*/
|
|
11
|
+
export declare function insetStyle(offset: number): CSSProperties;
|
|
12
|
+
export declare const rootStyle: {
|
|
13
|
+
readonly display: "flex";
|
|
14
|
+
readonly flexDirection: "column";
|
|
15
|
+
readonly gap: 8;
|
|
16
|
+
readonly minWidth: 280;
|
|
17
|
+
readonly containerType: "inline-size";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The grid the cells are placed on.
|
|
21
|
+
* @param headers - Whether a leading column and row hold the period and group
|
|
22
|
+
* numbers.
|
|
23
|
+
* @returns The style of the grid.
|
|
24
|
+
*/
|
|
25
|
+
export declare function gridStyle(headers: boolean): CSSProperties;
|
|
26
|
+
//# sourceMappingURL=tableLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableLayout.d.ts","sourceRoot":"","sources":["../../../src/periodic/ui/tableLayout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAO3C;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAiBxD;AAmBD,eAAO,MAAM,SAAS;;;;;;CAYY,CAAC;AASnC;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,CAezD"}
|