react-cheminfo 0.21.0 → 0.22.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 (49) hide show
  1. package/README.md +1 -1
  2. package/lib/build/vite/gitHead.d.ts.map +1 -1
  3. package/lib/build/vite/gitHead.js +17 -2
  4. package/lib/build/vite/gitHead.js.map +1 -1
  5. package/lib/clipboard/ui/ClickToCopy.d.ts +69 -0
  6. package/lib/clipboard/ui/ClickToCopy.d.ts.map +1 -0
  7. package/lib/clipboard/ui/ClickToCopy.js +66 -0
  8. package/lib/clipboard/ui/ClickToCopy.js.map +1 -0
  9. package/lib/clipboard/ui/CopyButton.d.ts +1 -1
  10. package/lib/clipboard/ui/CopyButton.js +1 -1
  11. package/lib/clipboard/ui/CopyableValue.d.ts +3 -3
  12. package/lib/clipboard/ui/CopyableValue.d.ts.map +1 -1
  13. package/lib/clipboard/ui/CopyableValue.js +5 -5
  14. package/lib/clipboard/ui/CopyableValue.js.map +1 -1
  15. package/lib/clipboard/ui/index.d.ts +2 -0
  16. package/lib/clipboard/ui/index.d.ts.map +1 -1
  17. package/lib/clipboard/ui/index.js +1 -0
  18. package/lib/clipboard/ui/index.js.map +1 -1
  19. package/lib/ecosystem/core/groups.d.ts +4 -3
  20. package/lib/ecosystem/core/groups.d.ts.map +1 -1
  21. package/lib/ecosystem/core/groups.js +8 -2
  22. package/lib/ecosystem/core/groups.js.map +1 -1
  23. package/lib/ecosystem/core/sites.d.ts.map +1 -1
  24. package/lib/ecosystem/core/sites.js +39 -0
  25. package/lib/ecosystem/core/sites.js.map +1 -1
  26. package/lib/ecosystem/core/types.d.ts +1 -1
  27. package/lib/ecosystem/core/types.d.ts.map +1 -1
  28. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  29. package/lib/ecosystem/ui/glyphs.js +9 -0
  30. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  31. package/lib/error/ui/ErrorFallback.d.ts.map +1 -1
  32. package/lib/error/ui/ErrorFallback.js +1 -1
  33. package/lib/error/ui/ErrorFallback.js.map +1 -1
  34. package/lib/pedagogy/ui/ReferenceSectionBlock.d.ts.map +1 -1
  35. package/lib/pedagogy/ui/ReferenceSectionBlock.js +2 -1
  36. package/lib/pedagogy/ui/ReferenceSectionBlock.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/build/vite/gitHead.ts +17 -2
  39. package/src/clipboard/ui/ClickToCopy.tsx +190 -0
  40. package/src/clipboard/ui/CopyButton.tsx +2 -2
  41. package/src/clipboard/ui/CopyableValue.tsx +11 -6
  42. package/src/clipboard/ui/index.ts +2 -0
  43. package/src/ecosystem/core/groups.ts +10 -3
  44. package/src/ecosystem/core/sites.ts +39 -0
  45. package/src/ecosystem/core/types.ts +4 -1
  46. package/src/ecosystem/ui/glyphs.tsx +51 -0
  47. package/src/error/ui/ErrorFallback.tsx +3 -1
  48. package/src/pedagogy/ui/ReferenceSectionBlock.tsx +10 -1
  49. package/styles/chrome.css +163 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorFallback.js","sourceRoot":"","sources":["../../../src/error/ui/ErrorFallback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA8B1D;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EACJ,KAAK,EACL,OAAO,EACP,KAAK,GAAG,sBAAsB,EAC9B,UAAU,GAAG,WAAW,EACxB,SAAS,GACV,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,KAAC,aAAa,IACZ,SAAS,EAAE,SAAS,EACpB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,EACZ,WAAW,EACT,KAAK,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAEhE,MAAM,EACJ,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAClC,KAAC,MAAM,IAAC,IAAI,EAAC,SAAS,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAI,CAC9D,GAEH,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"ErrorFallback.js","sourceRoot":"","sources":["../../../src/error/ui/ErrorFallback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA8B1D;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EACJ,KAAK,EACL,OAAO,EACP,KAAK,GAAG,sBAAsB,EAC9B,UAAU,GAAG,WAAW,EACxB,SAAS,GACV,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,KAAC,aAAa,IACZ,SAAS,EAAE,SAAS,EACpB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,EACZ,WAAW,EACT,eAAM,SAAS,EAAC,yBAAyB,YACtC,KAAK,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAC1D,EAET,MAAM,EACJ,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAClC,KAAC,MAAM,IAAC,IAAI,EAAC,SAAS,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAI,CAC9D,GAEH,CACH,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReferenceSectionBlock.d.ts","sourceRoot":"","sources":["../../../src/pedagogy/ui/ReferenceSectionBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAKzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIhE,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED,0CAA0C;AAC1C,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,gDAAgD;AAChD,MAAM,WAAW,0BAA0B;IACzC,yBAAyB;IACzB,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,0BAA0B,GAChC,YAAY,CAsBd"}
1
+ {"version":3,"file":"ReferenceSectionBlock.d.ts","sourceRoot":"","sources":["../../../src/pedagogy/ui/ReferenceSectionBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAMzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIhE,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED,0CAA0C;AAC1C,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,gDAAgD;AAChD,MAAM,WAAW,0BAA0B;IACzC,yBAAyB;IACzB,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,0BAA0B,GAChC,YAAY,CAsBd"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ClickToCopy } from "../../clipboard/ui/ClickToCopy.js";
2
3
  import { joinClassNames } from "../../shared/ui/joinClassNames.js";
3
4
  import { TOKEN } from "../../tokens/core/familyTokens.js";
4
5
  import { SyntaxTooltip } from "./SyntaxTooltip.js";
@@ -19,7 +20,7 @@ export function ReferenceSectionBlock(props) {
19
20
  function ReferenceRowLine(props) {
20
21
  const { row, width } = props;
21
22
  const interactive = row.tooltip !== undefined;
22
- const line = (_jsxs("span", { style: interactive ? INTERACTIVE_ROW_STYLE : ROW_STYLE, children: [_jsx("span", { style: syntaxStyle(width, interactive), children: row.syntax }), _jsx("span", { style: DESCRIPTION_STYLE, children: row.description })] }));
23
+ const line = (_jsxs("span", { style: interactive ? INTERACTIVE_ROW_STYLE : ROW_STYLE, children: [_jsx("span", { style: syntaxStyle(width, interactive), children: _jsx(ClickToCopy, { value: row.syntax, label: "syntax", title: interactive ? '' : undefined, children: row.syntax }) }), _jsx("span", { style: DESCRIPTION_STYLE, children: row.description })] }));
23
24
  if (row.tooltip === undefined)
24
25
  return line;
25
26
  return (_jsx(SyntaxTooltip, { content: row.tooltip, placement: "right", children: line }));
@@ -1 +1 @@
1
- {"version":3,"file":"ReferenceSectionBlock.js","sourceRoot":"","sources":["../../../src/pedagogy/ui/ReferenceSectionBlock.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA4D/C;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAiC;IAEjC,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,GAAG,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAExD,OAAO,CACL,mBACE,EAAE,EAAE,OAAO,CAAC,EAAE,EACd,SAAS,EAAE,cAAc,CACvB,mBAAmB,EACnB,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,UAAU,EACtC,SAAS,CACV,EACD,KAAK,EAAE,aAAa,aAEpB,aAAI,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,YAAG,OAAO,CAAC,KAAK,GAAM,EAC3D,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,CAC9B,YAAG,KAAK,EAAE,WAAW,YAAG,OAAO,CAAC,KAAK,GAAK,CAC3C,EACA,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACzB,KAAC,gBAAgB,IAAkB,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,IAAxC,GAAG,CAAC,MAAM,CAAkC,CACpE,CAAC,IACM,CACX,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAGzB;IACC,MAAM,EAAE,GAAG,EAAE,KAAK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EAAE,MAAM;CACd,CAAC;AAEF,MAAM,qBAAqB,GAAkB,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAE9E,MAAM,iBAAiB,GAAkB;IACvC,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,GAAG;IACf,KAAK,EAAE,KAAK,CAAC,IAAI;CAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cheminfo",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "license": "MIT",
5
5
  "description": "React components, hooks and framework-free helpers shared by the cheminfo sites: site chrome, citations, sharing, routing, pedagogy, charts, and the structure, orbital and 3D molecule viewers",
6
6
  "author": "Luc Patiny",
@@ -29,11 +29,14 @@ export function readGitHead(start: string): string | undefined {
29
29
  // itself and neither `refs` nor `packed-refs` is read at all.
30
30
  if (!head.startsWith('ref:')) return asCommit(head);
31
31
 
32
+ // A linked worktree keeps only its own `HEAD`: the branch it names lives in
33
+ // the repository's common directory, which `commondir` points to.
32
34
  const ref = head.slice('ref:'.length).trim();
33
- const loose = readText(join(gitDir, ref));
35
+ const commonDir = findCommonDir(gitDir);
36
+ const loose = readText(join(gitDir, ref)) ?? readText(join(commonDir, ref));
34
37
  return (
35
38
  asCommit(loose) ??
36
- commitInPackedRefs(readText(join(gitDir, 'packed-refs')), ref)
39
+ commitInPackedRefs(readText(join(commonDir, 'packed-refs')), ref)
37
40
  );
38
41
  }
39
42
 
@@ -74,6 +77,18 @@ export function findGitDir(start: string): string | undefined {
74
77
  }
75
78
  }
76
79
 
80
+ /**
81
+ * The directory the refs of a repository live in: the `.git` directory itself,
82
+ * or for a linked worktree the one its `commondir` file names.
83
+ * @param gitDir - The `.git` directory `HEAD` was read from.
84
+ * @returns The absolute path of the common directory.
85
+ */
86
+ function findCommonDir(gitDir: string): string {
87
+ const pointer = readText(join(gitDir, 'commondir'));
88
+ if (pointer === undefined || pointer === '') return gitDir;
89
+ return isAbsolute(pointer) ? pointer : resolve(gitDir, pointer);
90
+ }
91
+
77
92
  /**
78
93
  * The hash a packed `refs` file gives a ref.
79
94
  * @param packed - The contents of `packed-refs`, when there is one.
@@ -0,0 +1,190 @@
1
+ import { Icon } from '@blueprintjs/core';
2
+ import type {
3
+ CSSProperties,
4
+ KeyboardEvent,
5
+ MouseEvent,
6
+ ReactElement,
7
+ ReactNode,
8
+ } from 'react';
9
+
10
+ import { onActivateKey } from '../../hooks/ui/activationKey.ts';
11
+ import { joinClassNames } from '../../shared/ui/joinClassNames.ts';
12
+ import type { ClipboardContent } from '../core/writeToClipboard.ts';
13
+ import { writeToClipboard } from '../core/writeToClipboard.ts';
14
+
15
+ import { useCopyToClipboard } from './useCopyToClipboard.ts';
16
+
17
+ /** The elements a {@link ClickToCopy} can be, so a table cell is its own target. */
18
+ export type ClickToCopyElement = 'span' | 'code' | 'div' | 'td' | 'th';
19
+
20
+ /** What {@link ClickToCopy} copies, and how it reads. */
21
+ export interface ClickToCopyProps {
22
+ /**
23
+ * What goes on the clipboard: text, or text with its HTML rendering. A
24
+ * function is called only when the value is clicked.
25
+ */
26
+ value: ClipboardContent | (() => ClipboardContent);
27
+ /** What is shown; the pointer turns into the copy cursor over it. */
28
+ children: ReactNode;
29
+ /**
30
+ * What the value is, named in the hover title: `Copy the SMILES (C=CC=O)`.
31
+ * @default undefined — the title names only the value
32
+ */
33
+ label?: string;
34
+ /**
35
+ * Hover title, replacing the one built from `label` and the value.
36
+ * @default undefined
37
+ */
38
+ title?: string;
39
+ /**
40
+ * The element drawn. A `span` or a `code` sits in a line of text and shows
41
+ * its glyph past its right edge; a `div`, `td` or `th` keeps room for it
42
+ * inside. A `td` or `th` keeps its cell role, so a table stays a table to a
43
+ * screen reader. A list item or a paragraph holds a `span` or a `div`
44
+ * instead, so it stays a list item or a paragraph.
45
+ * @default 'span'
46
+ */
47
+ as?: ClickToCopyElement;
48
+ /**
49
+ * Whether the value is a tab stop and a button of its own, with its glyph.
50
+ * Off when a copy button beside it already copies the same value, so the
51
+ * keyboard and a screen reader meet one control, and the eye one glyph.
52
+ * @default true
53
+ */
54
+ focusable?: boolean;
55
+ /**
56
+ * Whether there is nothing to copy: the children are drawn as plain content.
57
+ * @default false
58
+ */
59
+ disabled?: boolean;
60
+ /**
61
+ * Class the element carries, in addition to `click-to-copy`.
62
+ * @default undefined
63
+ */
64
+ className?: string;
65
+ /**
66
+ * Inline style of the element.
67
+ * @default undefined
68
+ */
69
+ style?: CSSProperties;
70
+ }
71
+
72
+ /** Past this length the value is left out of the title: a molfile is no tooltip. */
73
+ const TITLE_VALUE_MAX = 120;
74
+
75
+ const INLINE = new Set<ClickToCopyElement>(['span', 'code']);
76
+ const CELLS = new Set<ClickToCopyElement>(['td', 'th']);
77
+
78
+ /** A control inside the value acts on its own click, which copies nothing. */
79
+ const NESTED_CONTROL =
80
+ 'a[href], button, input, select, textarea, summary, label, [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="tab"], [role="menuitem"]';
81
+
82
+ /**
83
+ * A value that is copied by clicking it.
84
+ *
85
+ * Text in a tool is not selectable — a drag across a viewer must not paint the
86
+ * page — so what is worth taking away is copied this way instead: the copy
87
+ * cursor, a tint and a clipboard glyph announce it on hover, a click or `Enter`
88
+ * puts it on the clipboard, and a tick confirms it. The click stops there, so
89
+ * a value inside a clickable row copies without also opening the row, and a
90
+ * link or a button nested in the value keeps its own click.
91
+ * @param props - See {@link ClickToCopyProps}.
92
+ * @returns The copyable value.
93
+ */
94
+ export function ClickToCopy(props: ClickToCopyProps): ReactElement {
95
+ const {
96
+ value,
97
+ children,
98
+ label,
99
+ title,
100
+ as: Element = 'span',
101
+ focusable = true,
102
+ disabled = false,
103
+ className,
104
+ style,
105
+ } = props;
106
+ const { copied, failed, copy } = useCopyToClipboard();
107
+
108
+ if (disabled) {
109
+ return (
110
+ <Element className={className} style={style}>
111
+ {children}
112
+ </Element>
113
+ );
114
+ }
115
+
116
+ function activate(
117
+ event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>,
118
+ ): void {
119
+ if (isOnNestedControl(event)) return;
120
+ event.stopPropagation();
121
+ void copy(
122
+ typeof value === 'function' ? () => writeToClipboard(value()) : value,
123
+ );
124
+ }
125
+
126
+ const outcome = copied ? 'copied' : failed ? 'failed' : undefined;
127
+
128
+ return (
129
+ <Element
130
+ className={joinClassNames(
131
+ 'click-to-copy',
132
+ INLINE.has(Element) ? 'click-to-copy--inline' : 'click-to-copy--block',
133
+ className,
134
+ )}
135
+ style={style}
136
+ role={focusable && !CELLS.has(Element) ? 'button' : undefined}
137
+ tabIndex={focusable ? 0 : undefined}
138
+ title={title ?? copyTitle(value, label)}
139
+ data-copy={outcome}
140
+ onClick={activate}
141
+ onKeyDown={onActivateKey<KeyboardEvent<HTMLElement>>(activate)}
142
+ >
143
+ {children}
144
+ {focusable ? (
145
+ <Icon
146
+ className="click-to-copy__icon"
147
+ icon={
148
+ outcome === 'copied'
149
+ ? 'tick'
150
+ : outcome === 'failed'
151
+ ? 'cross'
152
+ : 'clipboard'
153
+ }
154
+ size={16}
155
+ />
156
+ ) : null}
157
+ <span className="click-to-copy__status" role="status">
158
+ {outcome === 'copied'
159
+ ? 'Copied'
160
+ : outcome === 'failed'
161
+ ? 'Copy failed'
162
+ : null}
163
+ </span>
164
+ </Element>
165
+ );
166
+ }
167
+
168
+ function isOnNestedControl(
169
+ event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>,
170
+ ): boolean {
171
+ const { target, currentTarget } = event;
172
+ if (!(target instanceof Element) || target === currentTarget) return false;
173
+ const control = target.closest(NESTED_CONTROL);
174
+ return (
175
+ control !== null &&
176
+ control !== currentTarget &&
177
+ currentTarget.contains(control)
178
+ );
179
+ }
180
+
181
+ function copyTitle(
182
+ value: ClickToCopyProps['value'],
183
+ label: string | undefined,
184
+ ): string {
185
+ const what = label === undefined ? 'Copy' : `Copy the ${label}`;
186
+ if (typeof value === 'function') return what;
187
+ const text = typeof value === 'string' ? value : value.text;
188
+ if (text === '' || text.length > TITLE_VALUE_MAX) return what;
189
+ return label === undefined ? `Copy ${text}` : `${what} (${text})`;
190
+ }
@@ -44,7 +44,7 @@ export interface CopyButtonProps {
44
44
  small?: boolean;
45
45
  /**
46
46
  * Glyph shown at rest. A tick replaces it while the copy is confirmed.
47
- * @default 'duplicate'
47
+ * @default 'clipboard'
48
48
  */
49
49
  icon?: IconName;
50
50
  /**
@@ -83,7 +83,7 @@ export function CopyButton(props: CopyButtonProps): ReactElement {
83
83
  failedLabel = 'Copy failed',
84
84
  minimal = false,
85
85
  small = false,
86
- icon = 'duplicate',
86
+ icon = 'clipboard',
87
87
  disabled = false,
88
88
  resetAfter = DEFAULT_COPY_RESET_AFTER,
89
89
  title = 'Copy to clipboard',
@@ -3,6 +3,7 @@ import type { CSSProperties, ReactElement, ReactNode } from 'react';
3
3
  import { MISSING_VALUE } from '../../format/core/missing.ts';
4
4
  import { TOKEN } from '../../tokens/core/familyTokens.ts';
5
5
 
6
+ import { ClickToCopy } from './ClickToCopy.tsx';
6
7
  import { CopyButton } from './CopyButton.tsx';
7
8
 
8
9
  const DEFAULT_BLOCK_HEIGHT = 160;
@@ -50,9 +51,9 @@ export interface CopyableValueProps {
50
51
  * One read-only value, named, with the button that copies it.
51
52
  *
52
53
  * A derived notation — a SMILES, an InChIKey, an accession — is only useful
53
- * somewhere else, so it is shown with the single click that puts it on the
54
- * clipboard, and selecting the value by hand takes all of it at once. An empty
55
- * value reads as the missing marker and offers nothing to copy.
54
+ * somewhere else, so a click on the value or on its button puts it on the
55
+ * clipboard. An empty value reads as the missing marker and offers nothing to
56
+ * copy.
56
57
  * @param props - See {@link CopyableValueProps}.
57
58
  * @returns The labelled value and its copy button.
58
59
  */
@@ -93,12 +94,17 @@ export function CopyableValue(props: CopyableValueProps): ReactElement {
93
94
  small
94
95
  />
95
96
  </div>
96
- <code
97
+ <ClickToCopy
98
+ as="code"
99
+ value={value}
100
+ label={label}
101
+ focusable={false}
102
+ disabled={isEmpty}
97
103
  className="copyable-value__value"
98
104
  style={block ? { ...BLOCK_VALUE_STYLE, maxHeight } : VALUE_STYLE}
99
105
  >
100
106
  {isEmpty ? MISSING_VALUE : value}
101
- </code>
107
+ </ClickToCopy>
102
108
  {children}
103
109
  </div>
104
110
  );
@@ -127,7 +133,6 @@ const VALUE_STYLE = {
127
133
  fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
128
134
  fontSize: 12,
129
135
  overflowWrap: 'anywhere',
130
- userSelect: 'all',
131
136
  } as const satisfies CSSProperties;
132
137
 
133
138
  const BLOCK_VALUE_STYLE = {
@@ -1,3 +1,5 @@
1
+ export type { ClickToCopyElement, ClickToCopyProps } from './ClickToCopy.tsx';
2
+ export { ClickToCopy } from './ClickToCopy.tsx';
1
3
  export type { CodeBlockProps, CodeBlockTone } from './CodeBlock.tsx';
2
4
  export { CodeBlock } from './CodeBlock.tsx';
3
5
  export type { CopyableValueProps } from './CopyableValue.tsx';
@@ -4,13 +4,14 @@
4
4
  * A single grid of tiles tells a visitor nothing about which of them is for
5
5
  * a first-year student and which is for a research project. The groups are the
6
6
  * answer, and they read as a progression: the chemistry a course opens with,
7
- * then the molecule itself, then what was measured of it, then the work only a
8
- * project needs — and last the three tools that are not chemistry at all.
7
+ * the exercises that practise it, then the molecule itself, then what was
8
+ * measured of it, then the work only a project needs — and last the tools that
9
+ * are not chemistry at all.
9
10
  */
10
11
 
11
12
  /** The topics, in the order they are written. */
12
13
  export type SiteGroupId =
13
- 'basics' | 'structures' | 'spectra' | 'research' | 'computing';
14
+ 'basics' | 'practice' | 'structures' | 'spectra' | 'research' | 'computing';
14
15
 
15
16
  /** One topic the family's tools are gathered under. */
16
17
  export interface SiteGroup {
@@ -36,6 +37,12 @@ export const SITE_GROUPS: readonly SiteGroup[] = [
36
37
  label: 'Chemistry basics',
37
38
  blurb: 'Where a course starts, and what you go back to.',
38
39
  },
40
+ {
41
+ id: 'practice',
42
+ label: 'Practice',
43
+ blurb:
44
+ 'Where a first course is worked through, one graded series at a time.',
45
+ },
39
46
  {
40
47
  id: 'structures',
41
48
  label: 'Structures & notation',
@@ -289,6 +289,45 @@ export const ECOSYSTEM_SITES: readonly EcosystemSite[] = [
289
289
  brandAlt: '#1d4ed8',
290
290
  mark: { plate: '#854d0e', accent: '#60a5fa' },
291
291
  },
292
+ {
293
+ id: 'atoms',
294
+ name: { lead: 'atoms', alt: 'cheminfo', dot: true },
295
+ host: 'atoms.cheminfo.org',
296
+ repository: 'https://github.com/cheminfo/atoms.cheminfo.org',
297
+ tagline: 'Electrons, neutrons, Lewis structures and oxidation states.',
298
+ group: 'practice',
299
+ brand: '#b91c1c',
300
+ // The sky the mark's electron is drawn in sits at 2.1:1 on white, so the
301
+ // second half of the wordmark takes this darkened form instead.
302
+ brandAlt: '#0369a1',
303
+ mark: { plate: '#b91c1c', accent: '#38bdf8' },
304
+ },
305
+ {
306
+ id: 'moles',
307
+ name: { lead: 'moles', alt: 'cheminfo', dot: true },
308
+ host: 'moles.cheminfo.org',
309
+ repository: 'https://github.com/cheminfo/moles.cheminfo.org',
310
+ tagline: 'Balance a reaction, and work out its mass composition.',
311
+ group: 'practice',
312
+ brand: '#334155',
313
+ // The amber the mark's loaded pan is drawn in sits at 2.2:1 on white, so
314
+ // the second half of the wordmark takes this darkened form instead.
315
+ brandAlt: '#b45309',
316
+ mark: { plate: '#334155', accent: '#f59e0b' },
317
+ },
318
+ {
319
+ id: 'inorganic',
320
+ name: { lead: 'inorganic', alt: 'cheminfo', dot: true },
321
+ host: 'inorganic.cheminfo.org',
322
+ repository: 'https://github.com/cheminfo/inorganic.cheminfo.org',
323
+ tagline: 'Name an inorganic compound, and write its formula.',
324
+ group: 'practice',
325
+ brand: '#a3620a',
326
+ // The cyan the mark's named ion is drawn in sits at 1.8:1 on white, so the
327
+ // second half of the wordmark takes this darkened form instead.
328
+ brandAlt: '#0e7490',
329
+ mark: { plate: '#a3620a', accent: '#22d3ee' },
330
+ },
292
331
  ];
293
332
 
294
333
  /**
@@ -24,7 +24,10 @@ export type SiteId =
24
24
  | 'periodic-table'
25
25
  | 'database'
26
26
  | 'symmetry'
27
- | 'osiris';
27
+ | 'osiris'
28
+ | 'atoms'
29
+ | 'moles'
30
+ | 'inorganic';
28
31
 
29
32
  /** A site's name, split the way its own wordmark splits it. */
30
33
  export interface SiteName {
@@ -409,4 +409,55 @@ export const GLYPHS: Record<SiteId, (alt: string) => ReactNode> = {
409
409
  />
410
410
  </>
411
411
  ),
412
+ // A nucleus with one electron on its orbit. The electron carries the
413
+ // answering colour because the electron is what every tool here counts.
414
+ atoms: (alt) => (
415
+ <>
416
+ <circle
417
+ cx="16"
418
+ cy="16"
419
+ r="10.5"
420
+ fill="none"
421
+ stroke="#ffffff"
422
+ strokeWidth="2.2"
423
+ />
424
+ <circle cx="16" cy="16" r="3.6" fill="#ffffff" />
425
+ <circle cx="23.42" cy="8.58" r="3.2" fill={alt} />
426
+ </>
427
+ ),
428
+ // A balance still tipped, its two pans holding the two sides of the
429
+ // calculation. The pan that carries the answer carries the colour.
430
+ moles: (alt) => (
431
+ <>
432
+ <path
433
+ d="M6.5 11.5 25.5 15.5M16 13.5V24M10.5 24h11"
434
+ fill="none"
435
+ stroke="#ffffff"
436
+ strokeWidth="2.2"
437
+ strokeLinecap="round"
438
+ strokeLinejoin="round"
439
+ />
440
+ <circle cx="6.5" cy="11.5" r="3.2" fill="#ffffff" />
441
+ <circle cx="25.5" cy="15.5" r="3.2" fill={alt} />
442
+ </>
443
+ ),
444
+ // One cell of an ionic lattice, cations and anions alternating: the shape of
445
+ // the compounds this site names. The ion being named carries the colour.
446
+ inorganic: (alt) => (
447
+ <>
448
+ <path
449
+ d="M9.5 9.5h13v13h-13Z"
450
+ fill="none"
451
+ stroke="#ffffff"
452
+ strokeWidth="1.6"
453
+ opacity="0.55"
454
+ />
455
+ <g fill="#ffffff">
456
+ <circle cx="9.5" cy="9.5" r="4.3" />
457
+ <circle cx="22.5" cy="9.5" r="2.7" />
458
+ <circle cx="9.5" cy="22.5" r="2.7" />
459
+ </g>
460
+ <circle cx="22.5" cy="22.5" r="4.3" fill={alt} />
461
+ </>
462
+ ),
412
463
  };
@@ -52,7 +52,9 @@ export function ErrorFallback(props: ErrorFallbackProps): ReactElement {
52
52
  icon="error"
53
53
  title={title}
54
54
  description={
55
- error.message === '' ? 'No message was given.' : error.message
55
+ <span className="error-fallback__message">
56
+ {error.message === '' ? 'No message was given.' : error.message}
57
+ </span>
56
58
  }
57
59
  action={
58
60
  onRetry === undefined ? undefined : (
@@ -1,5 +1,6 @@
1
1
  import type { CSSProperties, ReactElement } from 'react';
2
2
 
3
+ import { ClickToCopy } from '../../clipboard/ui/ClickToCopy.tsx';
3
4
  import { joinClassNames } from '../../shared/ui/joinClassNames.ts';
4
5
  import { TOKEN } from '../../tokens/core/familyTokens.ts';
5
6
 
@@ -108,7 +109,15 @@ function ReferenceRowLine(props: {
108
109
  const interactive = row.tooltip !== undefined;
109
110
  const line = (
110
111
  <span style={interactive ? INTERACTIVE_ROW_STYLE : ROW_STYLE}>
111
- <span style={syntaxStyle(width, interactive)}>{row.syntax}</span>
112
+ <span style={syntaxStyle(width, interactive)}>
113
+ <ClickToCopy
114
+ value={row.syntax}
115
+ label="syntax"
116
+ title={interactive ? '' : undefined}
117
+ >
118
+ {row.syntax}
119
+ </ClickToCopy>
120
+ </span>
112
121
  <span style={DESCRIPTION_STYLE}>{row.description}</span>
113
122
  </span>
114
123
  );