react-cheminfo 0.20.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 (104) hide show
  1. package/README.md +1 -1
  2. package/lib/about/core/about.d.ts +3 -3
  3. package/lib/about/core/about.d.ts.map +1 -1
  4. package/lib/build/vite/gitHead.d.ts.map +1 -1
  5. package/lib/build/vite/gitHead.js +17 -2
  6. package/lib/build/vite/gitHead.js.map +1 -1
  7. package/lib/chrome/ui/SiteHeader.d.ts +20 -3
  8. package/lib/chrome/ui/SiteHeader.d.ts.map +1 -1
  9. package/lib/chrome/ui/SiteHeader.js +7 -3
  10. package/lib/chrome/ui/SiteHeader.js.map +1 -1
  11. package/lib/clipboard/ui/ClickToCopy.d.ts +69 -0
  12. package/lib/clipboard/ui/ClickToCopy.d.ts.map +1 -0
  13. package/lib/clipboard/ui/ClickToCopy.js +66 -0
  14. package/lib/clipboard/ui/ClickToCopy.js.map +1 -0
  15. package/lib/clipboard/ui/CopyButton.d.ts +1 -1
  16. package/lib/clipboard/ui/CopyButton.js +1 -1
  17. package/lib/clipboard/ui/CopyableValue.d.ts +3 -3
  18. package/lib/clipboard/ui/CopyableValue.d.ts.map +1 -1
  19. package/lib/clipboard/ui/CopyableValue.js +5 -5
  20. package/lib/clipboard/ui/CopyableValue.js.map +1 -1
  21. package/lib/clipboard/ui/index.d.ts +2 -0
  22. package/lib/clipboard/ui/index.d.ts.map +1 -1
  23. package/lib/clipboard/ui/index.js +1 -0
  24. package/lib/clipboard/ui/index.js.map +1 -1
  25. package/lib/ecosystem/core/groups.d.ts +4 -3
  26. package/lib/ecosystem/core/groups.d.ts.map +1 -1
  27. package/lib/ecosystem/core/groups.js +8 -2
  28. package/lib/ecosystem/core/groups.js.map +1 -1
  29. package/lib/ecosystem/core/index.d.ts +1 -1
  30. package/lib/ecosystem/core/index.d.ts.map +1 -1
  31. package/lib/ecosystem/core/index.js.map +1 -1
  32. package/lib/ecosystem/core/lookup.d.ts +2 -2
  33. package/lib/ecosystem/core/lookup.d.ts.map +1 -1
  34. package/lib/ecosystem/core/lookup.js.map +1 -1
  35. package/lib/ecosystem/core/nameColors.d.ts +2 -2
  36. package/lib/ecosystem/core/nameColors.d.ts.map +1 -1
  37. package/lib/ecosystem/core/nameColors.js.map +1 -1
  38. package/lib/ecosystem/core/sites.d.ts +3 -3
  39. package/lib/ecosystem/core/sites.d.ts.map +1 -1
  40. package/lib/ecosystem/core/sites.js +39 -0
  41. package/lib/ecosystem/core/sites.js.map +1 -1
  42. package/lib/ecosystem/core/tokens.d.ts +4 -3
  43. package/lib/ecosystem/core/tokens.d.ts.map +1 -1
  44. package/lib/ecosystem/core/tokens.js +8 -7
  45. package/lib/ecosystem/core/tokens.js.map +1 -1
  46. package/lib/ecosystem/core/types.d.ts +19 -10
  47. package/lib/ecosystem/core/types.d.ts.map +1 -1
  48. package/lib/ecosystem/ui/SiteTheme.d.ts +14 -3
  49. package/lib/ecosystem/ui/SiteTheme.d.ts.map +1 -1
  50. package/lib/ecosystem/ui/SiteTheme.js +6 -1
  51. package/lib/ecosystem/ui/SiteTheme.js.map +1 -1
  52. package/lib/ecosystem/ui/Wordmark.d.ts +2 -2
  53. package/lib/ecosystem/ui/Wordmark.d.ts.map +1 -1
  54. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  55. package/lib/ecosystem/ui/glyphs.js +9 -0
  56. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  57. package/lib/ecosystem/ui/marks.d.ts +13 -4
  58. package/lib/ecosystem/ui/marks.d.ts.map +1 -1
  59. package/lib/ecosystem/ui/marks.js +11 -3
  60. package/lib/ecosystem/ui/marks.js.map +1 -1
  61. package/lib/error/ui/ErrorFallback.d.ts.map +1 -1
  62. package/lib/error/ui/ErrorFallback.js +1 -1
  63. package/lib/error/ui/ErrorFallback.js.map +1 -1
  64. package/lib/pedagogy/ui/ReferenceSectionBlock.d.ts.map +1 -1
  65. package/lib/pedagogy/ui/ReferenceSectionBlock.js +2 -1
  66. package/lib/pedagogy/ui/ReferenceSectionBlock.js.map +1 -1
  67. package/lib/seo/core/pageMeta.d.ts +2 -2
  68. package/lib/seo/core/pageMeta.d.ts.map +1 -1
  69. package/lib/seo/core/siteFiles.d.ts +3 -3
  70. package/lib/seo/core/siteFiles.d.ts.map +1 -1
  71. package/lib/seo/core/siteFiles.js.map +1 -1
  72. package/lib/seo/vite/ogCard.d.ts +9 -2
  73. package/lib/seo/vite/ogCard.d.ts.map +1 -1
  74. package/lib/seo/vite/ogCard.js +6 -1
  75. package/lib/seo/vite/ogCard.js.map +1 -1
  76. package/lib/seo/vite/prerender.d.ts +2 -2
  77. package/lib/seo/vite/prerender.d.ts.map +1 -1
  78. package/package.json +1 -1
  79. package/src/about/core/about.ts +3 -3
  80. package/src/build/vite/gitHead.ts +17 -2
  81. package/src/chrome/ui/SiteHeader.tsx +28 -6
  82. package/src/clipboard/ui/ClickToCopy.tsx +190 -0
  83. package/src/clipboard/ui/CopyButton.tsx +2 -2
  84. package/src/clipboard/ui/CopyableValue.tsx +11 -6
  85. package/src/clipboard/ui/index.ts +2 -0
  86. package/src/ecosystem/core/groups.ts +10 -3
  87. package/src/ecosystem/core/index.ts +1 -0
  88. package/src/ecosystem/core/lookup.ts +2 -2
  89. package/src/ecosystem/core/nameColors.ts +2 -2
  90. package/src/ecosystem/core/sites.ts +42 -2
  91. package/src/ecosystem/core/tokens.ts +10 -9
  92. package/src/ecosystem/core/types.ts +23 -10
  93. package/src/ecosystem/ui/SiteTheme.tsx +19 -4
  94. package/src/ecosystem/ui/Wordmark.tsx +2 -2
  95. package/src/ecosystem/ui/glyphs.tsx +51 -0
  96. package/src/ecosystem/ui/marks.tsx +23 -5
  97. package/src/error/ui/ErrorFallback.tsx +3 -1
  98. package/src/pedagogy/ui/ReferenceSectionBlock.tsx +10 -1
  99. package/src/seo/core/noscript.ts +1 -1
  100. package/src/seo/core/pageMeta.ts +2 -2
  101. package/src/seo/core/siteFiles.ts +3 -3
  102. package/src/seo/vite/ogCard.ts +16 -3
  103. package/src/seo/vite/prerender.ts +2 -2
  104. package/styles/chrome.css +163 -0
@@ -8,12 +8,12 @@
8
8
  * entry need. The mount is read back out of it here, so the addresses these
9
9
  * files hand out start where the site actually answers.
10
10
  */
11
- import type { EcosystemSite, SiteId } from '../../ecosystem/core/sites.ts';
11
+ import type { SiteId, SiteRecord } from '../../ecosystem/core/sites.ts';
12
12
  import type { RouteMeta } from './routes.ts';
13
13
  /** What a crawler is told about the site as a whole. */
14
14
  export interface SiteFilesOptions {
15
15
  /** The site, named or passed. */
16
- site: EcosystemSite | SiteId;
16
+ site: SiteRecord | SiteId;
17
17
  /** Every address it answers. */
18
18
  routes: readonly RouteMeta[];
19
19
  /**
@@ -41,7 +41,7 @@ export declare function sitemapXml(options: SiteFilesOptions): string;
41
41
  * @param site - The site, named or passed.
42
42
  * @returns Its record.
43
43
  */
44
- export declare function resolveSite(site: EcosystemSite | SiteId): EcosystemSite;
44
+ export declare function resolveSite(site: SiteRecord | SiteId): SiteRecord;
45
45
  /**
46
46
  * Where the site is served, as an absolute address without a trailing slash.
47
47
  *
@@ -1 +1 @@
1
- {"version":3,"file":"siteFiles.d.ts","sourceRoot":"","sources":["../../../src/seo/core/siteFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAK3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAO7C,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC;IAC7B,gCAAgC;IAChC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAgB5D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,aAAa,CAEvE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAQ1D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAE7D"}
1
+ {"version":3,"file":"siteFiles.d.ts","sourceRoot":"","sources":["../../../src/seo/core/siteFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAKxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAO7C,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC1B,gCAAgC;IAChC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAgB5D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,CAEjE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAQ1D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAE7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"siteFiles.js","sourceRoot":"","sources":["../../../src/seo/core/siteFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MA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AI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAyB;IAChD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,WAAW,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7E,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CACb,sEAAsE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAC/F,CAAC;IACJ,CAAC;IACD,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAyB;IACnD,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AACvC,CAAC"}
@@ -9,7 +9,8 @@
9
9
  * load: this module sits in the same entry point as the prerender plugin, which
10
10
  * a site must be able to import with none of the optional peers installed.
11
11
  */
12
- import type { EcosystemSite, SiteId } from '../../ecosystem/core/sites.ts';
12
+ import type { ReactNode } from 'react';
13
+ import type { SiteId, SiteRecord } from '../../ecosystem/core/sites.ts';
13
14
  /** The width every card is drawn at. */
14
15
  export declare const OG_WIDTH = 1200;
15
16
  /** The height every card is drawn at. */
@@ -17,12 +18,18 @@ export declare const OG_HEIGHT = 630;
17
18
  /** What the card says, beyond the site's own name and mark. */
18
19
  export interface OgCardOptions {
19
20
  /** The site, named or passed. */
20
- site: EcosystemSite | SiteId;
21
+ site: SiteRecord | SiteId;
21
22
  /**
22
23
  * The sentence under the name.
23
24
  * @default the site's tagline
24
25
  */
25
26
  description?: string;
27
+ /**
28
+ * The drawing on the mark's plate, for a site the shared glyph set does not
29
+ * hold — see `SiteMark`.
30
+ * @default the family's drawing for that site
31
+ */
32
+ glyph?: (accent: string) => ReactNode;
26
33
  }
27
34
  /**
28
35
  * The card, as a standalone page.
@@ -1 +1 @@
1
- {"version":3,"file":"ogCard.d.ts","sourceRoot":"","sources":["../../../src/seo/vite/ogCard.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAK3E,wCAAwC;AACxC,eAAO,MAAM,QAAQ,OAAO,CAAC;AAE7B,yCAAyC;AACzC,eAAO,MAAM,SAAS,MAAM,CAAC;AAE7B,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAuDxE"}
1
+ {"version":3,"file":"ogCard.d.ts","sourceRoot":"","sources":["../../../src/seo/vite/ogCard.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAKxE,wCAAwC;AACxC,eAAO,MAAM,QAAQ,OAAO,CAAC;AAE7B,yCAAyC;AACzC,eAAO,MAAM,SAAS,MAAM,CAAC;AAE7B,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,CAAC;CACvC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA4DxE"}
@@ -40,7 +40,12 @@ export async function ogCardHtml(options) {
40
40
  import('react-dom/server'),
41
41
  import("../../ecosystem/ui/marks.js"),
42
42
  ]);
43
- const mark = renderToStaticMarkup(createElement(SiteMark, { site, size: 132, colors: 'literal' }));
43
+ const mark = renderToStaticMarkup(createElement(SiteMark, {
44
+ site,
45
+ glyph: options.glyph,
46
+ size: 132,
47
+ colors: 'literal',
48
+ }));
44
49
  const dot = site.name.dot === true ? '<span class="dot">.</span>' : '';
45
50
  return `<!doctype html>
46
51
  <html lang="en">
@@ -1 +1 @@
1
- {"version":3,"file":"ogCard.js","sourceRoot":"","sources":["../../../src/seo/vite/ogCard.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,wCAAwC;AACxC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC;AAE7B,yCAAyC;AACzC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAa7B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAsB;IACrD,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC3D,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC;IACxD,MAAM,C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AM,CAAC,GAAG;qCACK,mBAAmB,CAAC,cAAc,CAAC;;;;;sBAKlD,IAAI,CAAC,QAAQ;;;;;MAK7B,IAAI;6BACmB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,qBAAqB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;;SAEzG,UAAU,CAAC,WAAW,CAAC;;;CAG/B,CAAC;AACF,CAAC"}
@@ -17,14 +17,14 @@
17
17
  * a name it does not have.
18
18
  */
19
19
  import type { Plugin } from 'vite';
20
- import type { EcosystemSite, SiteId } from '../../ecosystem/core/sites.ts';
20
+ import type { SiteId, SiteRecord } from '../../ecosystem/core/sites.ts';
21
21
  import type { NoscriptText } from '../core/noscript.ts';
22
22
  import type { RobotsDisallow } from '../core/robots.ts';
23
23
  import type { RouteMeta } from '../core/routes.ts';
24
24
  /** What the build needs to know to write the site's addresses. */
25
25
  export interface PrerenderOptions {
26
26
  /** The site, named or passed. */
27
- site: EcosystemSite | SiteId;
27
+ site: SiteRecord | SiteId;
28
28
  /** Every address it answers, each with its title and description. */
29
29
  routes: readonly RouteMeta[];
30
30
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"prerender.d.ts","sourceRoot":"","sources":["../../../src/seo/vite/prerender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMnD,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,IAAI,EAAE,aAAa,GAAG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ACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,aAAa,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC;IACxD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CA6EnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cheminfo",
3
- "version": "0.20.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",
@@ -3,7 +3,7 @@ import type { CitedWork } from '../../citation/core/works.ts';
3
3
  import type { CreditEntry, CreditId } from '../../credits/core/credits.ts';
4
4
  import { credits } from '../../credits/core/credits.ts';
5
5
  import { siteById } from '../../ecosystem/core/lookup.ts';
6
- import type { EcosystemSite, SiteId } from '../../ecosystem/core/sites.ts';
6
+ import type { SiteId, SiteRecord } from '../../ecosystem/core/sites.ts';
7
7
 
8
8
  import type { ProviderEntry, ProviderId } from './providers.ts';
9
9
  import { providers } from './providers.ts';
@@ -23,7 +23,7 @@ export interface AboutContent {
23
23
  * is deliberately not listed in the family's Tools menu and therefore not in
24
24
  * `ECOSYSTEM_SITES`.
25
25
  */
26
- siteId: SiteId | EcosystemSite;
26
+ siteId: SiteId | SiteRecord;
27
27
  /** One sentence: what this tool is. */
28
28
  what: string;
29
29
  /**
@@ -101,7 +101,7 @@ export interface AboutPerson {
101
101
  */
102
102
  export interface ResolvedAbout {
103
103
  /** The site's own record, which carries its name, tagline and colours. */
104
- site: EcosystemSite;
104
+ site: SiteRecord;
105
105
  what: string;
106
106
  /** The context paragraphs, empty when the site writes none. */
107
107
  paragraphs: readonly string[];
@@ -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.
@@ -2,7 +2,7 @@ import type { ReactElement, ReactNode } from 'react';
2
2
  import { Fragment } from 'react';
3
3
 
4
4
  import { siteById } from '../../ecosystem/core/lookup.ts';
5
- import type { SiteId } from '../../ecosystem/core/sites.ts';
5
+ import type { SiteId, SiteRecord } from '../../ecosystem/core/sites.ts';
6
6
  import { Wordmark } from '../../ecosystem/ui/Wordmark.tsx';
7
7
  import { SiteMark } from '../../ecosystem/ui/marks.tsx';
8
8
 
@@ -12,8 +12,24 @@ import type { NavItem } from './navItem.ts';
12
12
  import { isModifiedClick } from './navItem.ts';
13
13
 
14
14
  export interface SiteHeaderProps {
15
- /** The site the bar belongs to, which draws its mark and writes its name. */
16
- siteId: SiteId;
15
+ /**
16
+ * The site the bar belongs to, which draws its mark and writes its name. One
17
+ * of `site` and `siteId` is required.
18
+ * @default undefined
19
+ */
20
+ siteId?: SiteId;
21
+ /**
22
+ * The same site, passed rather than named — for a site that is deliberately
23
+ * not one of `ECOSYSTEM_SITES`, and so is linked from no other site's menu.
24
+ * @default undefined
25
+ */
26
+ site?: SiteRecord;
27
+ /**
28
+ * The site's own mark, for a site the shared glyph set does not hold. It
29
+ * stands where `SiteMark` would, at the size the site draws it.
30
+ * @default undefined — the family's mark for that site
31
+ */
32
+ mark?: ReactNode;
17
33
  /** The pages, in the order the bar lists them. */
18
34
  nav: readonly NavItem[];
19
35
  /**
@@ -86,10 +102,13 @@ export interface SiteHeaderProps {
86
102
  * @param props - The site, its pages, its utilities, and whether the page is
87
103
  * framed in another site.
88
104
  * @returns The bar, or nothing at all on an embedded page.
105
+ * @throws {Error} When neither `site` nor `siteId` is given.
89
106
  */
90
107
  export function SiteHeader(props: SiteHeaderProps): ReactElement | null {
91
108
  const {
92
109
  siteId,
110
+ site: record,
111
+ mark,
93
112
  nav,
94
113
  activeId,
95
114
  actions,
@@ -104,7 +123,10 @@ export function SiteHeader(props: SiteHeaderProps): ReactElement | null {
104
123
 
105
124
  if (embedded) return null;
106
125
 
107
- const site = siteById(siteId);
126
+ const site = record ?? (siteId === undefined ? undefined : siteById(siteId));
127
+ if (site === undefined) {
128
+ throw new Error('SiteHeader needs one of its `site` and `siteId` props');
129
+ }
108
130
 
109
131
  return (
110
132
  <header className="app-header no-print">
@@ -119,8 +141,8 @@ export function SiteHeader(props: SiteHeaderProps): ReactElement | null {
119
141
  onHome();
120
142
  }}
121
143
  >
122
- <SiteMark siteId={siteId} size={markSize} />
123
- <Wordmark siteId={siteId} />
144
+ {mark ?? <SiteMark site={site} size={markSize} />}
145
+ <Wordmark site={site} />
124
146
  </a>
125
147
  <nav className="app-header-nav">
126
148
  {nav.map((item) => (
@@ -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',
@@ -14,6 +14,7 @@ export type {
14
14
  SiteId,
15
15
  SiteMarkColors,
16
16
  SiteName,
17
+ SiteRecord,
17
18
  } from './sites.ts';
18
19
  export { ECOSYSTEM_SITES, siteUrl } from './sites.ts';
19
20
  export { siteTokensCss } from './tokens.ts';
@@ -1,6 +1,6 @@
1
1
  import type { SiteGroup, SiteGroupId } from './groups.ts';
2
2
  import { SITE_GROUPS } from './groups.ts';
3
- import type { EcosystemSite, SiteId } from './sites.ts';
3
+ import type { EcosystemSite, SiteId, SiteRecord } from './sites.ts';
4
4
  import { ECOSYSTEM_SITES } from './sites.ts';
5
5
 
6
6
  /** One topic and the sites written under it. */
@@ -62,7 +62,7 @@ export function siteById(id: SiteId): EcosystemSite {
62
62
  * @param site - The site being named.
63
63
  * @returns What the site is called, in one string.
64
64
  */
65
- export function siteDisplayName(site: EcosystemSite): string {
65
+ export function siteDisplayName(site: SiteRecord): string {
66
66
  return site.name.dot === true
67
67
  ? site.host
68
68
  : `${site.name.lead}${site.name.alt}`;
@@ -1,6 +1,6 @@
1
1
  import { FAMILY_TOKEN_VALUES, TOKEN } from '../../tokens/core/familyTokens.ts';
2
2
 
3
- import type { EcosystemSite } from './types.ts';
3
+ import type { SiteRecord } from './types.ts';
4
4
 
5
5
  /** The colour each half of a site's name is written in. */
6
6
  export interface SiteNameColors {
@@ -35,7 +35,7 @@ export interface SiteNameColorsOptions {
35
35
  * @returns The colour of each half, and of the dot between them.
36
36
  */
37
37
  export function siteNameColors(
38
- site: EcosystemSite,
38
+ site: SiteRecord,
39
39
  options: SiteNameColorsOptions = {},
40
40
  ): SiteNameColors {
41
41
  const literal = options.colors === 'literal';