react-cheminfo 0.47.0 → 0.49.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 (187) hide show
  1. package/README.md +71 -2
  2. package/bin/check-seo.mjs +4 -3
  3. package/lib/core.d.ts +1 -0
  4. package/lib/core.d.ts.map +1 -1
  5. package/lib/core.js +1 -0
  6. package/lib/core.js.map +1 -1
  7. package/lib/download/core/cssPaint.d.ts +27 -0
  8. package/lib/download/core/cssPaint.d.ts.map +1 -0
  9. package/lib/download/core/cssPaint.js +63 -0
  10. package/lib/download/core/cssPaint.js.map +1 -0
  11. package/lib/download/core/drawingMarkup.d.ts +11 -0
  12. package/lib/download/core/drawingMarkup.d.ts.map +1 -0
  13. package/lib/download/core/drawingMarkup.js +32 -0
  14. package/lib/download/core/drawingMarkup.js.map +1 -0
  15. package/lib/download/core/figureHtml.d.ts +25 -0
  16. package/lib/download/core/figureHtml.d.ts.map +1 -0
  17. package/lib/download/core/figureHtml.js +174 -0
  18. package/lib/download/core/figureHtml.js.map +1 -0
  19. package/lib/download/core/figureHtmlMarkup.d.ts +107 -0
  20. package/lib/download/core/figureHtmlMarkup.d.ts.map +1 -0
  21. package/lib/download/core/figureHtmlMarkup.js +75 -0
  22. package/lib/download/core/figureHtmlMarkup.js.map +1 -0
  23. package/lib/download/core/figureSvg.d.ts.map +1 -1
  24. package/lib/download/core/figureSvg.js +16 -35
  25. package/lib/download/core/figureSvg.js.map +1 -1
  26. package/lib/download/core/figureSvgDocument.d.ts +3 -3
  27. package/lib/download/core/figureSvgDocument.d.ts.map +1 -1
  28. package/lib/download/core/figureTarget.d.ts +14 -3
  29. package/lib/download/core/figureTarget.d.ts.map +1 -1
  30. package/lib/download/core/figureTarget.js +42 -3
  31. package/lib/download/core/figureTarget.js.map +1 -1
  32. package/lib/download/core/index.d.ts +1 -1
  33. package/lib/download/core/index.d.ts.map +1 -1
  34. package/lib/download/core/index.js +1 -1
  35. package/lib/download/core/index.js.map +1 -1
  36. package/lib/download/core/textLines.d.ts +27 -0
  37. package/lib/download/core/textLines.d.ts.map +1 -0
  38. package/lib/download/core/textLines.js +51 -0
  39. package/lib/download/core/textLines.js.map +1 -0
  40. package/lib/ecosystem/core/lookup.d.ts +2 -1
  41. package/lib/ecosystem/core/lookup.d.ts.map +1 -1
  42. package/lib/ecosystem/core/lookup.js +10 -3
  43. package/lib/ecosystem/core/lookup.js.map +1 -1
  44. package/lib/ecosystem/core/types.d.ts +2 -2
  45. package/lib/ecosystem/core/types.d.ts.map +1 -1
  46. package/lib/ecosystem/core/unlistedSites.d.ts +9 -0
  47. package/lib/ecosystem/core/unlistedSites.d.ts.map +1 -0
  48. package/lib/ecosystem/core/unlistedSites.js +35 -0
  49. package/lib/ecosystem/core/unlistedSites.js.map +1 -0
  50. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  51. package/lib/ecosystem/ui/glyphs.js +7 -0
  52. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  53. package/lib/i18n/core/chromeCatalog.d.ts +1 -1
  54. package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
  55. package/lib/locales/de.json +55 -1
  56. package/lib/locales/en.json +55 -1
  57. package/lib/locales/es.json +55 -1
  58. package/lib/locales/fr.json +55 -1
  59. package/lib/locales/it.json +55 -1
  60. package/lib/periodic/ui/PeriodicTable.d.ts +3 -107
  61. package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
  62. package/lib/periodic/ui/PeriodicTable.js +5 -82
  63. package/lib/periodic/ui/PeriodicTable.js.map +1 -1
  64. package/lib/periodic/ui/PeriodicTableChrome.d.ts.map +1 -1
  65. package/lib/periodic/ui/PeriodicTableChrome.js +3 -25
  66. package/lib/periodic/ui/PeriodicTableChrome.js.map +1 -1
  67. package/lib/periodic/ui/SelectAllCorner.d.ts +23 -0
  68. package/lib/periodic/ui/SelectAllCorner.d.ts.map +1 -0
  69. package/lib/periodic/ui/SelectAllCorner.js +40 -0
  70. package/lib/periodic/ui/SelectAllCorner.js.map +1 -0
  71. package/lib/periodic/ui/headerStyles.d.ts +17 -0
  72. package/lib/periodic/ui/headerStyles.d.ts.map +1 -0
  73. package/lib/periodic/ui/headerStyles.js +19 -0
  74. package/lib/periodic/ui/headerStyles.js.map +1 -0
  75. package/lib/periodic/ui/periodicTableProps.d.ts +115 -0
  76. package/lib/periodic/ui/periodicTableProps.d.ts.map +1 -0
  77. package/lib/periodic/ui/periodicTableProps.js +8 -0
  78. package/lib/periodic/ui/periodicTableProps.js.map +1 -0
  79. package/lib/periodic/ui/tableLayout.d.ts +26 -0
  80. package/lib/periodic/ui/tableLayout.d.ts.map +1 -0
  81. package/lib/periodic/ui/tableLayout.js +86 -0
  82. package/lib/periodic/ui/tableLayout.js.map +1 -0
  83. package/lib/seo/core/routes.d.ts +1 -1
  84. package/lib/seo/core/routes.js +1 -1
  85. package/lib/seo/vite/prerender.d.ts +6 -0
  86. package/lib/seo/vite/prerender.d.ts.map +1 -1
  87. package/lib/seo/vite/prerender.js +7 -1
  88. package/lib/seo/vite/prerender.js.map +1 -1
  89. package/lib/split/ui/SplitColumn.d.ts +0 -1
  90. package/lib/split/ui/SplitColumn.d.ts.map +1 -1
  91. package/lib/split/ui/SplitColumn.js +0 -1
  92. package/lib/split/ui/SplitColumn.js.map +1 -1
  93. package/lib/split/ui/SplitRow.d.ts +0 -1
  94. package/lib/split/ui/SplitRow.d.ts.map +1 -1
  95. package/lib/split/ui/SplitRow.js +0 -1
  96. package/lib/split/ui/SplitRow.js.map +1 -1
  97. package/lib/split/ui/splitPanes.d.ts +12 -1
  98. package/lib/split/ui/splitPanes.d.ts.map +1 -1
  99. package/lib/split/ui/splitPanes.js +1 -4
  100. package/lib/split/ui/splitPanes.js.map +1 -1
  101. package/lib/taxonomy/core/index.d.ts +8 -0
  102. package/lib/taxonomy/core/index.d.ts.map +1 -0
  103. package/lib/taxonomy/core/index.js +5 -0
  104. package/lib/taxonomy/core/index.js.map +1 -0
  105. package/lib/taxonomy/core/lineage.d.ts +83 -0
  106. package/lib/taxonomy/core/lineage.d.ts.map +1 -0
  107. package/lib/taxonomy/core/lineage.js +126 -0
  108. package/lib/taxonomy/core/lineage.js.map +1 -0
  109. package/lib/taxonomy/core/ncbi.d.ts +8 -0
  110. package/lib/taxonomy/core/ncbi.d.ts.map +1 -0
  111. package/lib/taxonomy/core/ncbi.js +10 -0
  112. package/lib/taxonomy/core/ncbi.js.map +1 -0
  113. package/lib/taxonomy/core/organismName.d.ts +28 -0
  114. package/lib/taxonomy/core/organismName.d.ts.map +1 -0
  115. package/lib/taxonomy/core/organismName.js +188 -0
  116. package/lib/taxonomy/core/organismName.js.map +1 -0
  117. package/lib/taxonomy/core/organismWords.d.ts +20 -0
  118. package/lib/taxonomy/core/organismWords.d.ts.map +1 -0
  119. package/lib/taxonomy/core/organismWords.js +86 -0
  120. package/lib/taxonomy/core/organismWords.js.map +1 -0
  121. package/lib/taxonomy/core/ranks.d.ts +51 -0
  122. package/lib/taxonomy/core/ranks.d.ts.map +1 -0
  123. package/lib/taxonomy/core/ranks.js +123 -0
  124. package/lib/taxonomy/core/ranks.js.map +1 -0
  125. package/lib/taxonomy/ui/OrganismName.d.ts +28 -0
  126. package/lib/taxonomy/ui/OrganismName.d.ts.map +1 -0
  127. package/lib/taxonomy/ui/OrganismName.js +28 -0
  128. package/lib/taxonomy/ui/OrganismName.js.map +1 -0
  129. package/lib/taxonomy/ui/TaxonLineage.d.ts +67 -0
  130. package/lib/taxonomy/ui/TaxonLineage.d.ts.map +1 -0
  131. package/lib/taxonomy/ui/TaxonLineage.js +45 -0
  132. package/lib/taxonomy/ui/TaxonLineage.js.map +1 -0
  133. package/lib/taxonomy/ui/index.d.ts +6 -0
  134. package/lib/taxonomy/ui/index.d.ts.map +1 -0
  135. package/lib/taxonomy/ui/index.js +4 -0
  136. package/lib/taxonomy/ui/index.js.map +1 -0
  137. package/lib/taxonomy/ui/rankLabel.d.ts +17 -0
  138. package/lib/taxonomy/ui/rankLabel.d.ts.map +1 -0
  139. package/lib/taxonomy/ui/rankLabel.js +77 -0
  140. package/lib/taxonomy/ui/rankLabel.js.map +1 -0
  141. package/lib/ui.d.ts +1 -0
  142. package/lib/ui.d.ts.map +1 -1
  143. package/lib/ui.js +1 -0
  144. package/lib/ui.js.map +1 -1
  145. package/package.json +1 -1
  146. package/src/core.ts +1 -0
  147. package/src/download/core/cssPaint.ts +71 -0
  148. package/src/download/core/drawingMarkup.ts +35 -0
  149. package/src/download/core/figureHtml.ts +214 -0
  150. package/src/download/core/figureHtmlMarkup.ts +187 -0
  151. package/src/download/core/figureSvg.ts +17 -38
  152. package/src/download/core/figureSvgDocument.ts +3 -3
  153. package/src/download/core/figureTarget.ts +41 -8
  154. package/src/download/core/index.ts +1 -0
  155. package/src/download/core/textLines.ts +67 -0
  156. package/src/ecosystem/core/lookup.ts +11 -3
  157. package/src/ecosystem/core/types.ts +4 -2
  158. package/src/ecosystem/core/unlistedSites.ts +37 -0
  159. package/src/ecosystem/ui/glyphs.tsx +44 -0
  160. package/src/locales/de.json +55 -1
  161. package/src/locales/en.json +55 -1
  162. package/src/locales/es.json +55 -1
  163. package/src/locales/fr.json +55 -1
  164. package/src/locales/it.json +55 -1
  165. package/src/periodic/ui/PeriodicTable.tsx +16 -204
  166. package/src/periodic/ui/PeriodicTableChrome.tsx +3 -24
  167. package/src/periodic/ui/SelectAllCorner.tsx +65 -0
  168. package/src/periodic/ui/headerStyles.ts +23 -0
  169. package/src/periodic/ui/periodicTableProps.ts +117 -0
  170. package/src/periodic/ui/tableLayout.ts +96 -0
  171. package/src/seo/core/routes.ts +1 -1
  172. package/src/seo/vite/prerender.ts +7 -1
  173. package/src/split/ui/SplitColumn.tsx +0 -1
  174. package/src/split/ui/SplitRow.tsx +0 -1
  175. package/src/split/ui/splitPanes.tsx +21 -5
  176. package/src/taxonomy/core/index.ts +20 -0
  177. package/src/taxonomy/core/lineage.ts +161 -0
  178. package/src/taxonomy/core/ncbi.ts +9 -0
  179. package/src/taxonomy/core/organismName.ts +217 -0
  180. package/src/taxonomy/core/organismWords.ts +86 -0
  181. package/src/taxonomy/core/ranks.ts +134 -0
  182. package/src/taxonomy/ui/OrganismName.tsx +59 -0
  183. package/src/taxonomy/ui/TaxonLineage.tsx +183 -0
  184. package/src/taxonomy/ui/index.ts +5 -0
  185. package/src/taxonomy/ui/rankLabel.ts +81 -0
  186. package/src/ui.ts +1 -0
  187. package/styles/chrome.css +135 -6
@@ -0,0 +1,81 @@
1
+ import type { ChromeKey } from '../../i18n/core/chromeCatalog.ts';
2
+ import type { Translate } from '../../i18n/ui/useT.ts';
3
+ import { useChromeT } from '../../i18n/ui/useT.ts';
4
+
5
+ // Each rank NCBI writes, with the key its label is translated under. Written
6
+ // out rather than built from the rank, so a key the catalog lacks fails the
7
+ // type check instead of rendering raw.
8
+ const RANK_KEYS: Readonly<Record<string, ChromeKey>> = {
9
+ realm: 'taxonomy.rank.realm',
10
+ domain: 'taxonomy.rank.domain',
11
+ superkingdom: 'taxonomy.rank.superkingdom',
12
+ kingdom: 'taxonomy.rank.kingdom',
13
+ subkingdom: 'taxonomy.rank.subkingdom',
14
+ superphylum: 'taxonomy.rank.superphylum',
15
+ phylum: 'taxonomy.rank.phylum',
16
+ subphylum: 'taxonomy.rank.subphylum',
17
+ superclass: 'taxonomy.rank.superclass',
18
+ class: 'taxonomy.rank.class',
19
+ subclass: 'taxonomy.rank.subclass',
20
+ infraclass: 'taxonomy.rank.infraclass',
21
+ cohort: 'taxonomy.rank.cohort',
22
+ subcohort: 'taxonomy.rank.subcohort',
23
+ superorder: 'taxonomy.rank.superorder',
24
+ order: 'taxonomy.rank.order',
25
+ suborder: 'taxonomy.rank.suborder',
26
+ infraorder: 'taxonomy.rank.infraorder',
27
+ parvorder: 'taxonomy.rank.parvorder',
28
+ superfamily: 'taxonomy.rank.superfamily',
29
+ family: 'taxonomy.rank.family',
30
+ subfamily: 'taxonomy.rank.subfamily',
31
+ tribe: 'taxonomy.rank.tribe',
32
+ subtribe: 'taxonomy.rank.subtribe',
33
+ genus: 'taxonomy.rank.genus',
34
+ subgenus: 'taxonomy.rank.subgenus',
35
+ section: 'taxonomy.rank.section',
36
+ subsection: 'taxonomy.rank.subsection',
37
+ series: 'taxonomy.rank.series',
38
+ subseries: 'taxonomy.rank.subseries',
39
+ 'species group': 'taxonomy.rank.speciesGroup',
40
+ 'species subgroup': 'taxonomy.rank.speciesSubgroup',
41
+ species: 'taxonomy.rank.species',
42
+ 'forma specialis': 'taxonomy.rank.formaSpecialis',
43
+ subspecies: 'taxonomy.rank.subspecies',
44
+ varietas: 'taxonomy.rank.varietas',
45
+ subvariety: 'taxonomy.rank.subvariety',
46
+ forma: 'taxonomy.rank.forma',
47
+ pathogroup: 'taxonomy.rank.pathogroup',
48
+ serogroup: 'taxonomy.rank.serogroup',
49
+ serotype: 'taxonomy.rank.serotype',
50
+ biotype: 'taxonomy.rank.biotype',
51
+ genotype: 'taxonomy.rank.genotype',
52
+ morph: 'taxonomy.rank.morph',
53
+ strain: 'taxonomy.rank.strain',
54
+ isolate: 'taxonomy.rank.isolate',
55
+ 'no rank': 'taxonomy.rank.noRank',
56
+ clade: 'taxonomy.rank.clade',
57
+ 'cellular root': 'taxonomy.rank.cellularRoot',
58
+ 'acellular root': 'taxonomy.rank.acellularRoot',
59
+ };
60
+
61
+ /**
62
+ * A rank as the reader's language names it.
63
+ * @param t - The chrome's formatter.
64
+ * @param rank - The rank, as NCBI writes it.
65
+ * @returns Its label, or the rank itself when the catalog has none for it.
66
+ */
67
+ export function rankLabel(t: Translate<ChromeKey>, rank: string): string {
68
+ const key = Object.hasOwn(RANK_KEYS, rank) ? RANK_KEYS[rank] : undefined;
69
+ return key === undefined ? rank : t(key);
70
+ }
71
+
72
+ /**
73
+ * The label of a rank in the reader's language, for a site writing a rank
74
+ * beside the lineage — a taxon's heading, a list of its children.
75
+ * @returns `label(rank)`: the rank as NCBI writes it, named the way the chrome
76
+ * names it; a rank the catalog does not know is returned as it is.
77
+ */
78
+ export function useRankLabel(): (rank: string) => string {
79
+ const t = useChromeT();
80
+ return (rank) => rankLabel(t, rank);
81
+ }
package/src/ui.ts CHANGED
@@ -31,6 +31,7 @@ export * from './scatter3d/ui/index.ts';
31
31
  export * from './share/ui/index.ts';
32
32
  export * from './shared/ui/index.ts';
33
33
  export * from './split/ui/index.ts';
34
+ export * from './taxonomy/ui/index.ts';
34
35
  // The conformer table, from the structure module's file rather than its
35
36
  // barrel: `structure/ui/index.ts` is the door that must never reach react-ocl,
36
37
  // and this component does not, but `react-cheminfo/conformers` is imported by
package/styles/chrome.css CHANGED
@@ -1059,6 +1059,112 @@ select,
1059
1059
  text-align: right;
1060
1060
  }
1061
1061
 
1062
+ /* ── Taxonomy ────────────────────────────────────────────────────────────── */
1063
+
1064
+ /* A breadcrumb that wraps between its taxa, never inside one, so a lineage in
1065
+ a table cell stays as narrow as its longest name. The size and the link
1066
+ colour are the page's. */
1067
+ .taxon-lineage {
1068
+ display: flex;
1069
+ min-width: 0;
1070
+ flex-wrap: wrap;
1071
+ align-items: baseline;
1072
+ column-gap: 0.6em;
1073
+ }
1074
+
1075
+ .taxon-lineage__list {
1076
+ display: flex;
1077
+ min-width: 0;
1078
+ flex-wrap: wrap;
1079
+ align-items: baseline;
1080
+ padding: 0;
1081
+ margin: 0;
1082
+ list-style: none;
1083
+ row-gap: 0.1em;
1084
+ }
1085
+
1086
+ .taxon-lineage__taxon {
1087
+ display: inline-flex;
1088
+ align-items: baseline;
1089
+ }
1090
+
1091
+ .taxon-lineage__step {
1092
+ display: inline-flex;
1093
+ flex-direction: column;
1094
+ }
1095
+
1096
+ /* A taxon the site has no page for is read, not followed. */
1097
+ span.taxon-lineage__name {
1098
+ color: var(--text-muted);
1099
+ }
1100
+
1101
+ .taxon-lineage__taxon--leaf .taxon-lineage__name {
1102
+ font-weight: 600;
1103
+ }
1104
+
1105
+ .taxon-lineage__taxon--leaf span.taxon-lineage__name {
1106
+ color: var(--text);
1107
+ }
1108
+
1109
+ .taxon-lineage__separator {
1110
+ margin: 0 0.35em;
1111
+ color: var(--text-faint);
1112
+ }
1113
+
1114
+ .taxon-lineage__rank {
1115
+ color: var(--text-faint);
1116
+ font-size: 0.75em;
1117
+ line-height: 1.2;
1118
+ }
1119
+
1120
+ /* The rank a tooltip shows the pointer, said to a screen reader; never copied
1121
+ with the names. */
1122
+ .taxon-lineage__spoken {
1123
+ position: absolute;
1124
+ width: 1px;
1125
+ height: 1px;
1126
+ overflow: hidden;
1127
+ clip-path: inset(50%);
1128
+ user-select: none;
1129
+ white-space: nowrap;
1130
+ }
1131
+
1132
+ /* With its rank over each name, the separators sit on the line of the names. */
1133
+ .taxon-lineage--ranks .taxon-lineage__taxon {
1134
+ align-items: flex-end;
1135
+ }
1136
+
1137
+ /* A rank wider than its name runs on over the separator rather than pushing
1138
+ the separator away from the name it follows. */
1139
+ .taxon-lineage--ranks .taxon-lineage__rank {
1140
+ width: 0;
1141
+ overflow: visible;
1142
+ white-space: nowrap;
1143
+ }
1144
+
1145
+ .taxon-lineage__ncbi {
1146
+ margin-left: 0.75em;
1147
+ font-size: 0.85em;
1148
+ white-space: nowrap;
1149
+ }
1150
+
1151
+ /* Upright again inside italic text, so a name in a caption still sets its
1152
+ genus apart. */
1153
+ .organism-name {
1154
+ font-style: normal;
1155
+ }
1156
+
1157
+ .organism-name i {
1158
+ font-style: italic;
1159
+ }
1160
+
1161
+ @media print {
1162
+ .taxon-lineage a {
1163
+ color: inherit;
1164
+ text-decoration: none;
1165
+ }
1166
+ }
1167
+
1062
1168
  /* ── Help ────────────────────────────────────────────────────────────────── */
1063
1169
 
1064
1170
  /*
@@ -1176,21 +1282,35 @@ select,
1176
1282
  /* ── The splitter ───────────────────────────────────────────────────────── */
1177
1283
 
1178
1284
  /*
1179
- The bar between the two figures of a `<SplitRow>` is react-science's, and it
1180
- keeps react-science's look — the pale track with the grip written on it that
1181
- NMRium and every other tool of ours is divided by. It is barely visible on
1182
- purpose: what is read is the two figures, and the bar is found by the pointer
1183
- that changes over it rather than by the eye.
1285
+ The bar between the two figures of a `<SplitRow>` or a `<SplitColumn>` is
1286
+ react-science's, and it keeps react-science's look — the pale track with the
1287
+ grip written on it that NMRium and every other tool of ours is divided by. It
1288
+ is barely visible on purpose: what is read is the two figures, and the bar is
1289
+ found by the pointer that changes over it rather than by the eye.
1184
1290
 
1185
1291
  All this says is that eleven pixels is more gutter than two figures need.
1186
1292
  `:nth-child(2)` is the bar: a split is only mounted with a pane on each side
1187
1293
  of it, so the three children are always side, bar, side.
1294
+
1295
+ **Which measurement is the seven pixels is the direction's, so each direction
1296
+ says it for itself.** A row's bar is a column of pixels, and narrowing it is
1297
+ narrowing its width; a column's bar is that same line turned a quarter, so
1298
+ there the seven pixels are its height and the width is left to run the width
1299
+ of the pane. One rule for both — the width one, which is what this was — turns
1300
+ a column's bar into a seven-by-ten nub against the left edge of the pane:
1301
+ addressable, draggable, and invisible. The whole argument for a splitter is a
1302
+ line a reader can see, so a bar that renders as a dot is no splitter at all.
1188
1303
  */
1189
- .split-row > div > div:nth-child(2) {
1304
+ .split-row:not(.split-row--down) > div > div:nth-child(2) {
1190
1305
  width: 7px;
1191
1306
  min-width: 7px;
1192
1307
  }
1193
1308
 
1309
+ .split-row--down > div > div:nth-child(2) {
1310
+ height: 7px;
1311
+ min-height: 7px;
1312
+ }
1313
+
1194
1314
  /* ── Printing ────────────────────────────────────────────────────────────── */
1195
1315
 
1196
1316
  /*
@@ -1218,4 +1338,13 @@ select,
1218
1338
  .click-to-copy__icon.click-to-copy__icon.click-to-copy__icon {
1219
1339
  display: none !important;
1220
1340
  }
1341
+
1342
+ /*
1343
+ The bar is a control, and nothing is dragged on paper: all it leaves there
1344
+ is a grey line nobody drew. The panes keep the shares the reader left them
1345
+ at — that is the layout being printed — and simply meet.
1346
+ */
1347
+ .split-row > div > div:nth-child(2) {
1348
+ display: none !important;
1349
+ }
1221
1350
  }