react-cheminfo 0.24.0 → 0.26.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 (432) hide show
  1. package/README.md +73 -2
  2. package/bin/check-messages.mjs +229 -0
  3. package/lib/about/ui/AboutBuild.d.ts.map +1 -1
  4. package/lib/about/ui/AboutBuild.js +15 -4
  5. package/lib/about/ui/AboutBuild.js.map +1 -1
  6. package/lib/about/ui/AboutCitations.d.ts.map +1 -1
  7. package/lib/about/ui/AboutCitations.js +3 -1
  8. package/lib/about/ui/AboutCitations.js.map +1 -1
  9. package/lib/about/ui/AboutPage.d.ts.map +1 -1
  10. package/lib/about/ui/AboutPage.js +9 -1
  11. package/lib/about/ui/AboutPage.js.map +1 -1
  12. package/lib/about/ui/AboutProvidedBy.d.ts.map +1 -1
  13. package/lib/about/ui/AboutProvidedBy.js +8 -3
  14. package/lib/about/ui/AboutProvidedBy.js.map +1 -1
  15. package/lib/capsule/ui/Capsule.d.ts +30 -0
  16. package/lib/capsule/ui/Capsule.d.ts.map +1 -0
  17. package/lib/capsule/ui/Capsule.js +12 -0
  18. package/lib/capsule/ui/Capsule.js.map +1 -0
  19. package/lib/capsule/ui/CapsuleFilter.d.ts +19 -3
  20. package/lib/capsule/ui/CapsuleFilter.d.ts.map +1 -1
  21. package/lib/capsule/ui/CapsuleFilter.js +14 -44
  22. package/lib/capsule/ui/CapsuleFilter.js.map +1 -1
  23. package/lib/capsule/ui/capsuleFilterCapsules.d.ts +15 -0
  24. package/lib/capsule/ui/capsuleFilterCapsules.d.ts.map +1 -0
  25. package/lib/capsule/ui/capsuleFilterCapsules.js +47 -0
  26. package/lib/capsule/ui/capsuleFilterCapsules.js.map +1 -0
  27. package/lib/chart/ui/ChartTrackingLayer.d.ts.map +1 -1
  28. package/lib/chart/ui/ChartTrackingLayer.js +4 -2
  29. package/lib/chart/ui/ChartTrackingLayer.js.map +1 -1
  30. package/lib/chrome/ui/SiteHeader.d.ts +1 -1
  31. package/lib/chrome/ui/SiteHeader.d.ts.map +1 -1
  32. package/lib/chrome/ui/SiteHeader.js +4 -2
  33. package/lib/chrome/ui/SiteHeader.js.map +1 -1
  34. package/lib/citation/ui/CitationMenu.d.ts +1 -1
  35. package/lib/citation/ui/CitationMenu.d.ts.map +1 -1
  36. package/lib/citation/ui/CitationMenu.js +7 -3
  37. package/lib/citation/ui/CitationMenu.js.map +1 -1
  38. package/lib/citation/ui/CiteButton.d.ts +1 -1
  39. package/lib/citation/ui/CiteButton.d.ts.map +1 -1
  40. package/lib/citation/ui/CiteButton.js +3 -1
  41. package/lib/citation/ui/CiteButton.js.map +1 -1
  42. package/lib/citation/ui/CopyFormatEntries.d.ts.map +1 -1
  43. package/lib/citation/ui/CopyFormatEntries.js +3 -1
  44. package/lib/citation/ui/CopyFormatEntries.js.map +1 -1
  45. package/lib/citation/ui/WorkEntry.d.ts.map +1 -1
  46. package/lib/citation/ui/WorkEntry.js +3 -1
  47. package/lib/citation/ui/WorkEntry.js.map +1 -1
  48. package/lib/citation/ui/entries.d.ts.map +1 -1
  49. package/lib/citation/ui/entries.js +8 -2
  50. package/lib/citation/ui/entries.js.map +1 -1
  51. package/lib/citation/ui/useCopyFeedback.d.ts.map +1 -1
  52. package/lib/citation/ui/useCopyFeedback.js +9 -4
  53. package/lib/citation/ui/useCopyFeedback.js.map +1 -1
  54. package/lib/clipboard/ui/ClickToCopy.d.ts.map +1 -1
  55. package/lib/clipboard/ui/ClickToCopy.js +12 -6
  56. package/lib/clipboard/ui/ClickToCopy.js.map +1 -1
  57. package/lib/clipboard/ui/CopyButton.d.ts +3 -3
  58. package/lib/clipboard/ui/CopyButton.d.ts.map +1 -1
  59. package/lib/clipboard/ui/CopyButton.js +7 -4
  60. package/lib/clipboard/ui/CopyButton.js.map +1 -1
  61. package/lib/color/ui/ColorScaleEditor.d.ts.map +1 -1
  62. package/lib/color/ui/ColorScaleEditor.js +15 -10
  63. package/lib/color/ui/ColorScaleEditor.js.map +1 -1
  64. package/lib/color/ui/ColorScaleEntry.d.ts.map +1 -1
  65. package/lib/color/ui/ColorScaleEntry.js +4 -2
  66. package/lib/color/ui/ColorScaleEntry.js.map +1 -1
  67. package/lib/color/ui/ColorScaleLegend.d.ts.map +1 -1
  68. package/lib/color/ui/ColorScaleLegend.js +7 -1
  69. package/lib/color/ui/ColorScaleLegend.js.map +1 -1
  70. package/lib/color/ui/ColorScaleSelect.d.ts.map +1 -1
  71. package/lib/color/ui/ColorScaleSelect.js +8 -4
  72. package/lib/color/ui/ColorScaleSelect.js.map +1 -1
  73. package/lib/confirm/ui/ConfirmButton.d.ts +2 -2
  74. package/lib/confirm/ui/ConfirmButton.d.ts.map +1 -1
  75. package/lib/confirm/ui/ConfirmButton.js +4 -2
  76. package/lib/confirm/ui/ConfirmButton.js.map +1 -1
  77. package/lib/core.d.ts +1 -0
  78. package/lib/core.d.ts.map +1 -1
  79. package/lib/core.js +1 -0
  80. package/lib/core.js.map +1 -1
  81. package/lib/credits/ui/CreditsList.d.ts.map +1 -1
  82. package/lib/credits/ui/CreditsList.js +3 -1
  83. package/lib/credits/ui/CreditsList.js.map +1 -1
  84. package/lib/delimited/ui/DelimitedTextDialog.d.ts.map +1 -1
  85. package/lib/delimited/ui/DelimitedTextDialog.js +5 -2
  86. package/lib/delimited/ui/DelimitedTextDialog.js.map +1 -1
  87. package/lib/delimited/ui/DelimitedTextPanel.d.ts.map +1 -1
  88. package/lib/delimited/ui/DelimitedTextPanel.js +8 -8
  89. package/lib/delimited/ui/DelimitedTextPanel.js.map +1 -1
  90. package/lib/download/ui/FigureDownload.d.ts +2 -2
  91. package/lib/download/ui/FigureDownload.d.ts.map +1 -1
  92. package/lib/download/ui/FigureDownload.js +4 -2
  93. package/lib/download/ui/FigureDownload.js.map +1 -1
  94. package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
  95. package/lib/download/ui/FigureDownloadPanel.js +24 -18
  96. package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
  97. package/lib/ecosystem/core/sites.d.ts.map +1 -1
  98. package/lib/ecosystem/core/sites.js +4 -2
  99. package/lib/ecosystem/core/sites.js.map +1 -1
  100. package/lib/ecosystem/ui/EcosystemButton.d.ts +1 -1
  101. package/lib/ecosystem/ui/EcosystemButton.d.ts.map +1 -1
  102. package/lib/ecosystem/ui/EcosystemButton.js +4 -2
  103. package/lib/ecosystem/ui/EcosystemButton.js.map +1 -1
  104. package/lib/ecosystem/ui/EcosystemLinks.d.ts +1 -1
  105. package/lib/ecosystem/ui/EcosystemLinks.d.ts.map +1 -1
  106. package/lib/ecosystem/ui/EcosystemLinks.js +5 -2
  107. package/lib/ecosystem/ui/EcosystemLinks.js.map +1 -1
  108. package/lib/ecosystem/ui/EcosystemMenu.d.ts.map +1 -1
  109. package/lib/ecosystem/ui/EcosystemMenu.js +3 -1
  110. package/lib/ecosystem/ui/EcosystemMenu.js.map +1 -1
  111. package/lib/ecosystem/ui/SiteGroupSection.d.ts.map +1 -1
  112. package/lib/ecosystem/ui/SiteGroupSection.js +3 -1
  113. package/lib/ecosystem/ui/SiteGroupSection.js.map +1 -1
  114. package/lib/ecosystem/ui/SiteTile.d.ts.map +1 -1
  115. package/lib/ecosystem/ui/SiteTile.js +3 -1
  116. package/lib/ecosystem/ui/SiteTile.js.map +1 -1
  117. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  118. package/lib/ecosystem/ui/glyphs.js +6 -5
  119. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  120. package/lib/error/ui/ErrorFallback.d.ts +2 -2
  121. package/lib/error/ui/ErrorFallback.d.ts.map +1 -1
  122. package/lib/error/ui/ErrorFallback.js +4 -2
  123. package/lib/error/ui/ErrorFallback.js.map +1 -1
  124. package/lib/help/ui/HelpBody.d.ts.map +1 -1
  125. package/lib/help/ui/HelpBody.js +3 -1
  126. package/lib/help/ui/HelpBody.js.map +1 -1
  127. package/lib/help/ui/HelpIcon.d.ts +2 -1
  128. package/lib/help/ui/HelpIcon.d.ts.map +1 -1
  129. package/lib/help/ui/HelpIcon.js +4 -2
  130. package/lib/help/ui/HelpIcon.js.map +1 -1
  131. package/lib/help/ui/HelpToolbarButton.d.ts.map +1 -1
  132. package/lib/help/ui/HelpToolbarButton.js +3 -1
  133. package/lib/help/ui/HelpToolbarButton.js.map +1 -1
  134. package/lib/help/ui/helpName.d.ts +5 -1
  135. package/lib/help/ui/helpName.d.ts.map +1 -1
  136. package/lib/help/ui/helpName.js +4 -2
  137. package/lib/help/ui/helpName.js.map +1 -1
  138. package/lib/i18n/core/chromeCatalog.d.ts +21 -0
  139. package/lib/i18n/core/chromeCatalog.d.ts.map +1 -0
  140. package/lib/i18n/core/chromeCatalog.js +29 -0
  141. package/lib/i18n/core/chromeCatalog.js.map +1 -0
  142. package/lib/i18n/core/index.d.ts +12 -0
  143. package/lib/i18n/core/index.d.ts.map +1 -0
  144. package/lib/i18n/core/index.js +6 -0
  145. package/lib/i18n/core/index.js.map +1 -0
  146. package/lib/i18n/core/languages.d.ts +32 -0
  147. package/lib/i18n/core/languages.d.ts.map +1 -0
  148. package/lib/i18n/core/languages.js +41 -0
  149. package/lib/i18n/core/languages.js.map +1 -0
  150. package/lib/i18n/core/messageCatalog.d.ts +113 -0
  151. package/lib/i18n/core/messageCatalog.d.ts.map +1 -0
  152. package/lib/i18n/core/messageCatalog.js +135 -0
  153. package/lib/i18n/core/messageCatalog.js.map +1 -0
  154. package/lib/i18n/core/messageValues.d.ts +3 -0
  155. package/lib/i18n/core/messageValues.d.ts.map +1 -0
  156. package/lib/i18n/core/messageValues.js +2 -0
  157. package/lib/i18n/core/messageValues.js.map +1 -0
  158. package/lib/i18n/core/session.d.ts +51 -0
  159. package/lib/i18n/core/session.d.ts.map +1 -0
  160. package/lib/i18n/core/session.js +64 -0
  161. package/lib/i18n/core/session.js.map +1 -0
  162. package/lib/i18n/core/translateSetup.d.ts +28 -0
  163. package/lib/i18n/core/translateSetup.d.ts.map +1 -0
  164. package/lib/i18n/core/translateSetup.js +30 -0
  165. package/lib/i18n/core/translateSetup.js.map +1 -0
  166. package/lib/i18n/ui/LanguageSelect.d.ts +37 -0
  167. package/lib/i18n/ui/LanguageSelect.d.ts.map +1 -0
  168. package/lib/i18n/ui/LanguageSelect.js +27 -0
  169. package/lib/i18n/ui/LanguageSelect.js.map +1 -0
  170. package/lib/i18n/ui/index.d.ts +6 -0
  171. package/lib/i18n/ui/index.d.ts.map +1 -0
  172. package/lib/i18n/ui/index.js +4 -0
  173. package/lib/i18n/ui/index.js.map +1 -0
  174. package/lib/i18n/ui/useLanguage.d.ts +23 -0
  175. package/lib/i18n/ui/useLanguage.d.ts.map +1 -0
  176. package/lib/i18n/ui/useLanguage.js +36 -0
  177. package/lib/i18n/ui/useLanguage.js.map +1 -0
  178. package/lib/i18n/ui/useT.d.ts +47 -0
  179. package/lib/i18n/ui/useT.d.ts.map +1 -0
  180. package/lib/i18n/ui/useT.js +51 -0
  181. package/lib/i18n/ui/useT.js.map +1 -0
  182. package/lib/locales/de.json +442 -0
  183. package/lib/locales/en.json +442 -0
  184. package/lib/locales/es.json +442 -0
  185. package/lib/locales/fr.json +442 -0
  186. package/lib/molecule3d/core/gestures.d.ts +10 -0
  187. package/lib/molecule3d/core/gestures.d.ts.map +1 -1
  188. package/lib/molecule3d/core/gestures.js +39 -7
  189. package/lib/molecule3d/core/gestures.js.map +1 -1
  190. package/lib/molecule3d/ui/Molecule3DExport.d.ts.map +1 -1
  191. package/lib/molecule3d/ui/Molecule3DExport.js +3 -1
  192. package/lib/molecule3d/ui/Molecule3DExport.js.map +1 -1
  193. package/lib/molecule3d/ui/Molecule3DHelp.d.ts.map +1 -1
  194. package/lib/molecule3d/ui/Molecule3DHelp.js +7 -2
  195. package/lib/molecule3d/ui/Molecule3DHelp.js.map +1 -1
  196. package/lib/molecule3d/ui/Molecule3DOptions.d.ts.map +1 -1
  197. package/lib/molecule3d/ui/Molecule3DOptions.js +9 -9
  198. package/lib/molecule3d/ui/Molecule3DOptions.js.map +1 -1
  199. package/lib/molecule3d/ui/Molecule3DSurfaceColors.d.ts.map +1 -1
  200. package/lib/molecule3d/ui/Molecule3DSurfaceColors.js +8 -8
  201. package/lib/molecule3d/ui/Molecule3DSurfaceColors.js.map +1 -1
  202. package/lib/molecule3d/ui/Molecule3DToolbar.d.ts.map +1 -1
  203. package/lib/molecule3d/ui/Molecule3DToolbar.js +15 -10
  204. package/lib/molecule3d/ui/Molecule3DToolbar.js.map +1 -1
  205. package/lib/molecule3d/ui/MoleculeViewer3D.d.ts.map +1 -1
  206. package/lib/molecule3d/ui/MoleculeViewer3D.js +6 -3
  207. package/lib/molecule3d/ui/MoleculeViewer3D.js.map +1 -1
  208. package/lib/orbital/ui/AtomicOrbitalCanvas.d.ts.map +1 -1
  209. package/lib/orbital/ui/AtomicOrbitalCanvas.js +3 -1
  210. package/lib/orbital/ui/AtomicOrbitalCanvas.js.map +1 -1
  211. package/lib/orbital/ui/AtomicOrbitalControls.d.ts.map +1 -1
  212. package/lib/orbital/ui/AtomicOrbitalControls.js +12 -15
  213. package/lib/orbital/ui/AtomicOrbitalControls.js.map +1 -1
  214. package/lib/orbital/ui/AtomicOrbitalViewer.d.ts.map +1 -1
  215. package/lib/orbital/ui/AtomicOrbitalViewer.js +6 -3
  216. package/lib/orbital/ui/AtomicOrbitalViewer.js.map +1 -1
  217. package/lib/orbital/ui/capability.d.ts +4 -0
  218. package/lib/orbital/ui/capability.d.ts.map +1 -1
  219. package/lib/orbital/ui/capability.js +4 -0
  220. package/lib/orbital/ui/capability.js.map +1 -1
  221. package/lib/overlay/ui/OverlayBar.d.ts +1 -1
  222. package/lib/overlay/ui/OverlayBar.d.ts.map +1 -1
  223. package/lib/overlay/ui/OverlayBar.js +6 -3
  224. package/lib/overlay/ui/OverlayBar.js.map +1 -1
  225. package/lib/overlay/ui/OverlayInfo.d.ts +1 -1
  226. package/lib/overlay/ui/OverlayInfo.d.ts.map +1 -1
  227. package/lib/overlay/ui/OverlayInfo.js +5 -2
  228. package/lib/overlay/ui/OverlayInfo.js.map +1 -1
  229. package/lib/overlay/ui/OverlayPanel.d.ts +9 -2
  230. package/lib/overlay/ui/OverlayPanel.d.ts.map +1 -1
  231. package/lib/overlay/ui/OverlayPanel.js +5 -11
  232. package/lib/overlay/ui/OverlayPanel.js.map +1 -1
  233. package/lib/overlay/ui/OverlayReadout.d.ts.map +1 -1
  234. package/lib/overlay/ui/OverlayReadout.js +3 -1
  235. package/lib/overlay/ui/OverlayReadout.js.map +1 -1
  236. package/lib/pedagogy/ui/ExerciseActions.d.ts +1 -1
  237. package/lib/pedagogy/ui/ExerciseActions.d.ts.map +1 -1
  238. package/lib/pedagogy/ui/ExerciseActions.js +9 -2
  239. package/lib/pedagogy/ui/ExerciseActions.js.map +1 -1
  240. package/lib/pedagogy/ui/ExerciseProgressHeader.d.ts +1 -1
  241. package/lib/pedagogy/ui/ExerciseProgressHeader.d.ts.map +1 -1
  242. package/lib/pedagogy/ui/ExerciseProgressHeader.js +9 -5
  243. package/lib/pedagogy/ui/ExerciseProgressHeader.js.map +1 -1
  244. package/lib/pedagogy/ui/GlossaryIndex.d.ts +1 -1
  245. package/lib/pedagogy/ui/GlossaryIndex.d.ts.map +1 -1
  246. package/lib/pedagogy/ui/GlossaryIndex.js +6 -8
  247. package/lib/pedagogy/ui/GlossaryIndex.js.map +1 -1
  248. package/lib/pedagogy/ui/HintLadder.d.ts +2 -2
  249. package/lib/pedagogy/ui/HintLadder.d.ts.map +1 -1
  250. package/lib/pedagogy/ui/HintLadder.js +8 -2
  251. package/lib/pedagogy/ui/HintLadder.js.map +1 -1
  252. package/lib/pedagogy/ui/SyntaxTooltip.d.ts +4 -4
  253. package/lib/pedagogy/ui/SyntaxTooltip.d.ts.map +1 -1
  254. package/lib/pedagogy/ui/SyntaxTooltip.js +4 -2
  255. package/lib/pedagogy/ui/SyntaxTooltip.js.map +1 -1
  256. package/lib/pedagogy/ui/TutorialStepStrip.d.ts.map +1 -1
  257. package/lib/pedagogy/ui/TutorialStepStrip.js +7 -2
  258. package/lib/pedagogy/ui/TutorialStepStrip.js.map +1 -1
  259. package/lib/periodic/ui/CategoryLegend.d.ts.map +1 -1
  260. package/lib/periodic/ui/CategoryLegend.js +3 -1
  261. package/lib/periodic/ui/CategoryLegend.js.map +1 -1
  262. package/lib/periodic/ui/ElementCell.d.ts.map +1 -1
  263. package/lib/periodic/ui/ElementCell.js +7 -1
  264. package/lib/periodic/ui/ElementCell.js.map +1 -1
  265. package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
  266. package/lib/periodic/ui/PeriodicTable.js +3 -1
  267. package/lib/periodic/ui/PeriodicTable.js.map +1 -1
  268. package/lib/periodic/ui/PeriodicTableChrome.d.ts.map +1 -1
  269. package/lib/periodic/ui/PeriodicTableChrome.js +4 -2
  270. package/lib/periodic/ui/PeriodicTableChrome.js.map +1 -1
  271. package/lib/share/ui/ShareButton.d.ts +2 -2
  272. package/lib/share/ui/ShareButton.d.ts.map +1 -1
  273. package/lib/share/ui/ShareButton.js +5 -2
  274. package/lib/share/ui/ShareButton.js.map +1 -1
  275. package/lib/share/ui/ShareConfigOptions.d.ts.map +1 -1
  276. package/lib/share/ui/ShareConfigOptions.js +4 -2
  277. package/lib/share/ui/ShareConfigOptions.js.map +1 -1
  278. package/lib/share/ui/ShareDialog.d.ts.map +1 -1
  279. package/lib/share/ui/ShareDialog.js +3 -1
  280. package/lib/share/ui/ShareDialog.js.map +1 -1
  281. package/lib/share/ui/ShareDialogContent.d.ts.map +1 -1
  282. package/lib/share/ui/ShareDialogContent.js +10 -1
  283. package/lib/share/ui/ShareDialogContent.js.map +1 -1
  284. package/lib/share/ui/SharePresetTabs.d.ts.map +1 -1
  285. package/lib/share/ui/SharePresetTabs.js +3 -1
  286. package/lib/share/ui/SharePresetTabs.js.map +1 -1
  287. package/lib/slides/ui/BackToSlides.d.ts.map +1 -1
  288. package/lib/slides/ui/BackToSlides.js +4 -2
  289. package/lib/slides/ui/BackToSlides.js.map +1 -1
  290. package/lib/slides/ui/EmbedSlide.d.ts.map +1 -1
  291. package/lib/slides/ui/EmbedSlide.js +3 -1
  292. package/lib/slides/ui/EmbedSlide.js.map +1 -1
  293. package/lib/slides/ui/Slide.d.ts.map +1 -1
  294. package/lib/slides/ui/Slide.js +3 -1
  295. package/lib/slides/ui/Slide.js.map +1 -1
  296. package/lib/slides/ui/SlideshowBar.d.ts.map +1 -1
  297. package/lib/slides/ui/SlideshowBar.js +5 -3
  298. package/lib/slides/ui/SlideshowBar.js.map +1 -1
  299. package/lib/slides/ui/TalkList.d.ts +1 -1
  300. package/lib/slides/ui/TalkList.d.ts.map +1 -1
  301. package/lib/slides/ui/TalkList.js +4 -2
  302. package/lib/slides/ui/TalkList.js.map +1 -1
  303. package/lib/structure/core/editorGuide.d.ts +14 -0
  304. package/lib/structure/core/editorGuide.d.ts.map +1 -1
  305. package/lib/structure/core/editorGuide.js +117 -19
  306. package/lib/structure/core/editorGuide.js.map +1 -1
  307. package/lib/structure/core/editorToolbar.d.ts +3 -1
  308. package/lib/structure/core/editorToolbar.d.ts.map +1 -1
  309. package/lib/structure/core/editorToolbar.js +44 -23
  310. package/lib/structure/core/editorToolbar.js.map +1 -1
  311. package/lib/structure/ui/EditorHelpButton.d.ts.map +1 -1
  312. package/lib/structure/ui/EditorHelpButton.js +3 -2
  313. package/lib/structure/ui/EditorHelpButton.js.map +1 -1
  314. package/lib/structure/ui/StructureEditor.d.ts.map +1 -1
  315. package/lib/structure/ui/StructureEditor.js +3 -1
  316. package/lib/structure/ui/StructureEditor.js.map +1 -1
  317. package/lib/structure/ui/StructureEditorHelp.d.ts.map +1 -1
  318. package/lib/structure/ui/StructureEditorHelp.js +12 -3
  319. package/lib/structure/ui/StructureEditorHelp.js.map +1 -1
  320. package/lib/structure/ui/ToolbarTooltip.d.ts.map +1 -1
  321. package/lib/structure/ui/ToolbarTooltip.js +5 -3
  322. package/lib/structure/ui/ToolbarTooltip.js.map +1 -1
  323. package/lib/translate/core/index.d.ts +1 -1
  324. package/lib/translate/core/index.d.ts.map +1 -1
  325. package/lib/translate/core/start.d.ts +35 -2
  326. package/lib/translate/core/start.d.ts.map +1 -1
  327. package/lib/translate/core/start.js +23 -4
  328. package/lib/translate/core/start.js.map +1 -1
  329. package/lib/ui.d.ts +1 -0
  330. package/lib/ui.d.ts.map +1 -1
  331. package/lib/ui.js +1 -0
  332. package/lib/ui.js.map +1 -1
  333. package/package.json +4 -2
  334. package/src/about/ui/AboutBuild.tsx +23 -16
  335. package/src/about/ui/AboutCitations.tsx +3 -1
  336. package/src/about/ui/AboutPage.tsx +38 -12
  337. package/src/about/ui/AboutProvidedBy.tsx +13 -3
  338. package/src/capsule/ui/Capsule.tsx +48 -0
  339. package/src/capsule/ui/CapsuleFilter.tsx +38 -114
  340. package/src/capsule/ui/capsuleFilterCapsules.tsx +110 -0
  341. package/src/chart/ui/ChartTrackingLayer.tsx +4 -2
  342. package/src/chrome/ui/SiteHeader.tsx +5 -3
  343. package/src/citation/ui/CitationMenu.tsx +9 -5
  344. package/src/citation/ui/CiteButton.tsx +4 -2
  345. package/src/citation/ui/CopyFormatEntries.tsx +3 -1
  346. package/src/citation/ui/WorkEntry.tsx +5 -3
  347. package/src/citation/ui/entries.tsx +9 -2
  348. package/src/citation/ui/useCopyFeedback.ts +11 -4
  349. package/src/clipboard/ui/ClickToCopy.tsx +15 -5
  350. package/src/clipboard/ui/CopyButton.tsx +14 -10
  351. package/src/color/ui/ColorScaleEditor.tsx +17 -15
  352. package/src/color/ui/ColorScaleEntry.tsx +7 -3
  353. package/src/color/ui/ColorScaleLegend.tsx +7 -1
  354. package/src/color/ui/ColorScaleSelect.tsx +12 -6
  355. package/src/confirm/ui/ConfirmButton.tsx +9 -11
  356. package/src/core.ts +1 -0
  357. package/src/credits/ui/CreditsList.tsx +5 -1
  358. package/src/delimited/ui/DelimitedTextDialog.tsx +10 -10
  359. package/src/delimited/ui/DelimitedTextPanel.tsx +19 -12
  360. package/src/download/ui/FigureDownload.tsx +7 -5
  361. package/src/download/ui/FigureDownloadPanel.tsx +31 -25
  362. package/src/ecosystem/core/sites.ts +4 -2
  363. package/src/ecosystem/ui/EcosystemButton.tsx +5 -3
  364. package/src/ecosystem/ui/EcosystemLinks.tsx +10 -10
  365. package/src/ecosystem/ui/EcosystemMenu.tsx +3 -1
  366. package/src/ecosystem/ui/SiteGroupSection.tsx +6 -2
  367. package/src/ecosystem/ui/SiteTile.tsx +6 -2
  368. package/src/ecosystem/ui/glyphs.tsx +16 -22
  369. package/src/error/ui/ErrorFallback.tsx +13 -12
  370. package/src/help/ui/HelpBody.tsx +4 -2
  371. package/src/help/ui/HelpIcon.tsx +6 -3
  372. package/src/help/ui/HelpToolbarButton.tsx +4 -1
  373. package/src/help/ui/helpName.ts +10 -2
  374. package/src/i18n/core/chromeCatalog.ts +35 -0
  375. package/src/i18n/core/index.ts +26 -0
  376. package/src/i18n/core/languages.ts +46 -0
  377. package/src/i18n/core/messageCatalog.ts +202 -0
  378. package/src/i18n/core/messageValues.ts +2 -0
  379. package/src/i18n/core/session.ts +82 -0
  380. package/src/i18n/core/translateSetup.ts +47 -0
  381. package/src/i18n/ui/LanguageSelect.tsx +72 -0
  382. package/src/i18n/ui/index.ts +9 -0
  383. package/src/i18n/ui/useLanguage.ts +48 -0
  384. package/src/i18n/ui/useT.ts +90 -0
  385. package/src/locales/de.json +442 -0
  386. package/src/locales/en.json +442 -0
  387. package/src/locales/es.json +442 -0
  388. package/src/locales/fr.json +442 -0
  389. package/src/molecule3d/core/gestures.ts +44 -7
  390. package/src/molecule3d/ui/Molecule3DExport.tsx +3 -1
  391. package/src/molecule3d/ui/Molecule3DHelp.tsx +17 -6
  392. package/src/molecule3d/ui/Molecule3DOptions.tsx +13 -13
  393. package/src/molecule3d/ui/Molecule3DSurfaceColors.tsx +16 -13
  394. package/src/molecule3d/ui/Molecule3DToolbar.tsx +29 -18
  395. package/src/molecule3d/ui/MoleculeViewer3D.tsx +13 -8
  396. package/src/orbital/ui/AtomicOrbitalCanvas.tsx +3 -1
  397. package/src/orbital/ui/AtomicOrbitalControls.tsx +15 -20
  398. package/src/orbital/ui/AtomicOrbitalViewer.tsx +13 -13
  399. package/src/orbital/ui/capability.ts +10 -0
  400. package/src/overlay/ui/OverlayBar.tsx +7 -4
  401. package/src/overlay/ui/OverlayInfo.tsx +6 -3
  402. package/src/overlay/ui/OverlayPanel.tsx +10 -7
  403. package/src/overlay/ui/OverlayReadout.tsx +3 -1
  404. package/src/pedagogy/ui/ExerciseActions.tsx +16 -6
  405. package/src/pedagogy/ui/ExerciseProgressHeader.tsx +13 -11
  406. package/src/pedagogy/ui/GlossaryIndex.tsx +11 -12
  407. package/src/pedagogy/ui/HintLadder.tsx +15 -12
  408. package/src/pedagogy/ui/SyntaxTooltip.tsx +9 -7
  409. package/src/pedagogy/ui/TutorialStepStrip.tsx +8 -3
  410. package/src/periodic/ui/CategoryLegend.tsx +6 -1
  411. package/src/periodic/ui/ElementCell.tsx +7 -1
  412. package/src/periodic/ui/PeriodicTable.tsx +3 -1
  413. package/src/periodic/ui/PeriodicTableChrome.tsx +4 -2
  414. package/src/share/ui/ShareButton.tsx +8 -5
  415. package/src/share/ui/ShareConfigOptions.tsx +6 -7
  416. package/src/share/ui/ShareDialog.tsx +3 -1
  417. package/src/share/ui/ShareDialogContent.tsx +20 -10
  418. package/src/share/ui/SharePresetTabs.tsx +3 -1
  419. package/src/slides/ui/BackToSlides.tsx +4 -2
  420. package/src/slides/ui/EmbedSlide.tsx +3 -3
  421. package/src/slides/ui/Slide.tsx +3 -1
  422. package/src/slides/ui/SlideshowBar.tsx +12 -4
  423. package/src/slides/ui/TalkList.tsx +8 -10
  424. package/src/structure/core/editorGuide.ts +126 -19
  425. package/src/structure/core/editorToolbar.ts +52 -24
  426. package/src/structure/ui/EditorHelpButton.tsx +9 -4
  427. package/src/structure/ui/StructureEditor.tsx +7 -1
  428. package/src/structure/ui/StructureEditorHelp.tsx +34 -11
  429. package/src/structure/ui/ToolbarTooltip.tsx +8 -4
  430. package/src/translate/core/index.ts +1 -1
  431. package/src/translate/core/start.ts +65 -3
  432. package/src/ui.ts +1 -0
@@ -16,7 +16,9 @@ export type EditorToolbarAvailability = 'always' | 'reaction' | 'never';
16
16
 
17
17
  /** One button of the toolbar. */
18
18
  export interface EditorToolbarButton {
19
- /** What the button is called. */
19
+ /** How the toolbar's catalog names the button. */
20
+ id: string;
21
+ /** What the button is called, in English. */
20
22
  name: string;
21
23
  /** What it does, in a sentence or two. */
22
24
  description: string;
@@ -38,62 +40,76 @@ export interface EditorToolbarButton {
38
40
  * then down the second.
39
41
  */
40
42
  export const EDITOR_TOOLBAR_BUTTONS: readonly EditorToolbarButton[] = [
41
- { name: 'Clear', description: 'Erase the whole drawing.' },
43
+ { id: 'clear', name: 'Clear', description: 'Erase the whole drawing.' },
42
44
  {
45
+ id: 'cleanUp',
43
46
  name: 'Clean up',
44
47
  description:
45
48
  'Redraw the structure with fresh 2D coordinates. With part of it selected, the rest keeps its layout.',
46
49
  },
47
50
  {
51
+ id: 'select',
48
52
  name: 'Select',
49
53
  description:
50
54
  'Drag around atoms to select them: hold Alt for a rectangle, Shift to add to the selection. Drag a selection to move it, Shift-drag to copy it.',
51
55
  keys: ['Space'],
52
56
  },
53
57
  {
58
+ id: 'unknownConfiguration',
54
59
  name: 'Unknown configuration',
55
60
  description:
56
61
  'Click a stereocentre to mark its configuration as unknown; click again to undo it.',
57
62
  },
58
63
  {
64
+ id: 'delete',
59
65
  name: 'Delete',
60
66
  description: 'Click an atom or a bond to delete it.',
61
67
  keys: ['0'],
62
68
  },
63
69
  {
70
+ id: 'singleBond',
64
71
  name: 'Single bond',
65
72
  description:
66
73
  'Click empty space for a new bond, or drag from an atom. Clicking a bond again makes it double, then triple.',
67
74
  keys: ['1'],
68
75
  },
69
76
  {
77
+ id: 'upBond',
70
78
  name: 'Up bond',
71
79
  description:
72
80
  'Wedged stereo bond, pointing toward the viewer. Its narrow end goes on the stereocentre.',
73
81
  keys: ['u'],
74
82
  },
75
- ring('3-membered ring', '3'),
76
- ring('5-membered ring', '5'),
77
- ring('7-membered ring', '7'),
83
+ ring('ring3', '3-membered ring', '3'),
84
+ ring('ring5', '5-membered ring', '5'),
85
+ ring('ring7', '7-membered ring', '7'),
78
86
  {
87
+ id: 'positiveCharge',
79
88
  name: 'Positive charge',
80
89
  description: 'Click an atom to raise its charge by one.',
81
90
  keys: ['+'],
82
91
  },
83
- atom('Carbon', 'C', 'c'),
84
- atom('Nitrogen', 'N', 'n'),
85
- atom('Oxygen', 'O', 'o'),
86
- atom('Fluorine', 'F', 'f'),
87
- atom('Bromine', 'Br', 'b'),
88
- atom('Hydrogen', 'H'),
89
- { name: 'Undo', description: 'Revert the last change.', keys: ['Mod', 'Z'] },
92
+ atom('carbon', 'Carbon', 'C', 'c'),
93
+ atom('nitrogen', 'Nitrogen', 'N', 'n'),
94
+ atom('oxygen', 'Oxygen', 'O', 'o'),
95
+ atom('fluorine', 'Fluorine', 'F', 'f'),
96
+ atom('bromine', 'Bromine', 'Br', 'b'),
97
+ atom('hydrogen', 'Hydrogen', 'H'),
90
98
  {
99
+ id: 'undo',
100
+ name: 'Undo',
101
+ description: 'Revert the last change.',
102
+ keys: ['Mod', 'Z'],
103
+ },
104
+ {
105
+ id: 'zoomAndRotate',
91
106
  name: 'Zoom and rotate',
92
107
  description:
93
108
  'Press where the centre should be, then drag up or down to zoom and sideways to rotate. With a selection, only that part moves.',
94
109
  keys: ['z'],
95
110
  },
96
111
  {
112
+ id: 'atomMapping',
97
113
  name: 'Atom mapping',
98
114
  description:
99
115
  'Drag from a reactant atom to the same atom in a product: both get the same number. Click a mapped atom to unmap it.',
@@ -101,41 +117,47 @@ export const EDITOR_TOOLBAR_BUTTONS: readonly EditorToolbarButton[] = [
101
117
  availability: 'reaction',
102
118
  },
103
119
  {
120
+ id: 'enhancedStereo',
104
121
  name: 'Enhanced stereo',
105
122
  description:
106
123
  'Click a stereo bond to say what its centre means: abs, this enantiomer; &, both (racemic); or, one of the two. Press the button again to switch between the three.',
107
124
  },
108
125
  {
126
+ id: 'text',
109
127
  name: 'Text',
110
128
  description: 'Place a text label in the drawing.',
111
129
  availability: 'never',
112
130
  },
113
131
  {
132
+ id: 'chain',
114
133
  name: 'Chain',
115
134
  description:
116
135
  'Drag from empty space or from an atom to draw a zigzag carbon chain.',
117
136
  keys: ['2'],
118
137
  },
119
138
  {
139
+ id: 'downBond',
120
140
  name: 'Down bond',
121
141
  description:
122
142
  'Hashed stereo bond, pointing away from the viewer. Its narrow end goes on the stereocentre.',
123
143
  keys: ['d'],
124
144
  },
125
- ring('4-membered ring', '4'),
126
- ring('6-membered ring', '6'),
127
- ring('Benzene ring', 'a'),
145
+ ring('ring4', '4-membered ring', '4'),
146
+ ring('ring6', '6-membered ring', '6'),
147
+ ring('benzene', 'Benzene ring', 'a'),
128
148
  {
149
+ id: 'negativeCharge',
129
150
  name: 'Negative charge',
130
151
  description: 'Click an atom to lower its charge by one.',
131
152
  keys: ['-'],
132
153
  },
133
- atom('Silicon', 'Si'),
134
- atom('Phosphorus', 'P', 'p'),
135
- atom('Sulfur', 'S', 's'),
136
- atom('Chlorine', 'Cl', 'l'),
137
- atom('Iodine', 'I', 'i'),
154
+ atom('silicon', 'Silicon', 'Si'),
155
+ atom('phosphorus', 'Phosphorus', 'P', 'p'),
156
+ atom('sulfur', 'Sulfur', 'S', 's'),
157
+ atom('chlorine', 'Chlorine', 'Cl', 'l'),
158
+ atom('iodine', 'Iodine', 'I', 'i'),
138
159
  {
160
+ id: 'anyAtom',
139
161
  name: 'Any atom',
140
162
  description:
141
163
  'Pick any element, isotope, valence or radical in a dialog, then click to place it or to change an atom. Alt-click an atom to edit its own properties.',
@@ -158,8 +180,9 @@ export function isEditorToolbarButtonAvailable(
158
180
  return availability === 'reaction' && mode === 'reaction';
159
181
  }
160
182
 
161
- function ring(name: string, key: string): EditorToolbarButton {
183
+ function ring(id: string, name: string, key: string): EditorToolbarButton {
162
184
  return {
185
+ id,
163
186
  name,
164
187
  description:
165
188
  'Click empty space for a new ring, a bond to fuse one onto it, or an atom for a spiro ring.',
@@ -167,9 +190,14 @@ function ring(name: string, key: string): EditorToolbarButton {
167
190
  };
168
191
  }
169
192
 
170
- function atom(name: string, symbol: string, key?: string): EditorToolbarButton {
193
+ function atom(
194
+ id: string,
195
+ name: string,
196
+ symbol: string,
197
+ key?: string,
198
+ ): EditorToolbarButton {
171
199
  const description = `Click empty space for a new ${symbol} atom, or an atom to turn it into ${symbol}.`;
172
200
  return key === undefined
173
- ? { name, description }
174
- : { name, description, keys: [key] };
201
+ ? { id, name, description }
202
+ : { id, name, description, keys: [key] };
175
203
  }
@@ -2,6 +2,8 @@ import { Button, PopoverNext, Tooltip } from '@blueprintjs/core';
2
2
  import type { CSSProperties, ReactElement, RefObject } from 'react';
3
3
  import { useEffect, useState } from 'react';
4
4
 
5
+ import { useChromeT } from '../../i18n/ui/useT.ts';
6
+
5
7
  import { StructureEditorHelp } from './StructureEditorHelp.tsx';
6
8
  import type { StructureEditorMode } from './editorChange.ts';
7
9
 
@@ -26,6 +28,7 @@ export interface EditorHelpButtonProps {
26
28
  */
27
29
  export function EditorHelpButton(props: EditorHelpButtonProps): ReactElement {
28
30
  const { containerRef, mode, fragment } = props;
31
+ const t = useChromeT();
29
32
  const [isOpen, setIsOpen] = useState(false);
30
33
 
31
34
  useEffect(() => {
@@ -48,12 +51,16 @@ export function EditorHelpButton(props: EditorHelpButtonProps): ReactElement {
48
51
  placement="left-start"
49
52
  content={<StructureEditorHelp mode={mode} fragment={fragment} />}
50
53
  >
51
- <Tooltip content={LABEL} placement="left" disabled={isOpen}>
54
+ <Tooltip
55
+ content={t('structure.mouseAndKeyboard')}
56
+ placement="left"
57
+ disabled={isOpen}
58
+ >
52
59
  <Button
53
60
  variant="minimal"
54
61
  size="small"
55
62
  icon="help"
56
- aria-label={LABEL}
63
+ aria-label={t('structure.mouseAndKeyboard')}
57
64
  />
58
65
  </Tooltip>
59
66
  </PopoverNext>
@@ -61,8 +68,6 @@ export function EditorHelpButton(props: EditorHelpButtonProps): ReactElement {
61
68
  );
62
69
  }
63
70
 
64
- const LABEL = 'Mouse and keyboard';
65
-
66
71
  const CORNER_STYLE: CSSProperties = {
67
72
  position: 'absolute',
68
73
  top: 4,
@@ -18,6 +18,7 @@ import {
18
18
  } from 'react';
19
19
  import type { CanvasEditorInputFormat } from 'react-ocl';
20
20
 
21
+ import { useChromeT } from '../../i18n/ui/useT.ts';
21
22
  import { TOKEN } from '../../tokens/core/familyTokens.ts';
22
23
  import { createPendingCall } from '../core/pendingCall.ts';
23
24
 
@@ -126,6 +127,7 @@ export function StructureEditor(props: StructureEditorProps): ReactElement {
126
127
  style,
127
128
  } = props;
128
129
 
130
+ const t = useChromeT();
129
131
  const containerRef = useToolbarFloor({ minHeight, revision });
130
132
  const handleChange = useDebounced(onChange, debounce, revision);
131
133
 
@@ -135,7 +137,11 @@ export function StructureEditor(props: StructureEditorProps): ReactElement {
135
137
  className={className}
136
138
  style={{ ...ROOT_STYLE, minHeight, ...style }}
137
139
  >
138
- <Suspense fallback={<div style={LOADING_STYLE}>Loading the editor…</div>}>
140
+ <Suspense
141
+ fallback={
142
+ <div style={LOADING_STYLE}>{t('structure.loadingEditor')}</div>
143
+ }
144
+ >
139
145
  <EditorCanvas
140
146
  key={revision}
141
147
  onChange={handleChange}
@@ -6,11 +6,15 @@
6
6
  import { Classes } from '@blueprintjs/core';
7
7
  import type { CSSProperties, ReactElement } from 'react';
8
8
 
9
+ import type { ChromeKey } from '../../i18n/core/chromeCatalog.ts';
10
+ import type { Translate } from '../../i18n/ui/useT.ts';
11
+ import { useChromeT } from '../../i18n/ui/useT.ts';
9
12
  import { TOKEN } from '../../tokens/core/familyTokens.ts';
10
13
  import type { EditorGesture, EditorGuideOptions } from '../core/editorGuide.ts';
11
14
  import {
12
15
  STRUCTURE_EDITOR_DOCS,
13
16
  editorGuideSections,
17
+ editorInputWordId,
14
18
  } from '../core/editorGuide.ts';
15
19
 
16
20
  import { KeyCaps } from './KeyCaps.tsx';
@@ -29,39 +33,47 @@ export type StructureEditorHelpProps = EditorGuideOptions;
29
33
  export function StructureEditorHelp(
30
34
  props: StructureEditorHelpProps,
31
35
  ): ReactElement {
36
+ const t = useChromeT();
32
37
  const sections = editorGuideSections(props);
33
38
 
34
39
  return (
35
40
  <div style={PANEL_STYLE} data-testid="structure-editor-help">
36
41
  <p className={Classes.TEXT_MUTED} style={PARAGRAPH_STYLE}>
37
- Hover a toolbar button to see what it does and its key.
42
+ {t('structure.help.hoverToolbar')}
38
43
  </p>
39
44
  {/* One grid for every section, so all the actions start on one edge. */}
40
45
  <div style={GRID_STYLE}>
41
46
  {sections.map((section) => (
42
- <section key={section.title} style={ROW_STYLE}>
43
- <h4 style={HEADING_STYLE}>{section.title}</h4>
47
+ <section key={section.id} style={ROW_STYLE}>
48
+ <h4 style={HEADING_STYLE}>
49
+ {t.or(`structure.guide.${section.id}.title`, section.title)}
50
+ </h4>
44
51
  {section.gestures.map((gesture) => (
45
52
  <div key={gestureKey(gesture)} style={ROW_STYLE}>
46
- <GestureInput input={gesture.input} />
47
- <span>{gesture.action}</span>
53
+ <GestureInput input={gesture.input} t={t} />
54
+ <span>
55
+ {t.or(
56
+ `structure.guide.${section.id}.${gesture.id}`,
57
+ gesture.action,
58
+ )}
59
+ </span>
48
60
  </div>
49
61
  ))}
50
62
  {section.note === undefined ? null : (
51
63
  <p className={Classes.TEXT_MUTED} style={NOTE_STYLE}>
52
- {section.note}
64
+ {t.or(`structure.guide.${section.id}.note`, section.note)}
53
65
  </p>
54
66
  )}
55
67
  </section>
56
68
  ))}
57
69
  </div>
58
70
  <p style={PARAGRAPH_STYLE}>
59
- Learn more:{' '}
71
+ {t('structure.help.learnMore')}{' '}
60
72
  {STRUCTURE_EDITOR_DOCS.map((link, index) => (
61
73
  <span key={link.url}>
62
74
  {index === 0 ? null : ' · '}
63
75
  <a href={link.url} target="_blank" rel="noopener noreferrer">
64
- {link.title}
76
+ {t.or(`structure.docs.${link.id}`, link.title)}
65
77
  </a>
66
78
  </span>
67
79
  ))}
@@ -70,12 +82,16 @@ export function StructureEditorHelp(
70
82
  );
71
83
  }
72
84
 
73
- function GestureInput(props: { input: EditorGesture['input'] }): ReactElement {
85
+ function GestureInput(props: {
86
+ input: EditorGesture['input'];
87
+ t: Translate<ChromeKey>;
88
+ }): ReactElement {
89
+ const { input, t } = props;
74
90
  return (
75
91
  <span style={INPUT_STYLE}>
76
- {props.input.map((part) =>
92
+ {input.map((part) =>
77
93
  typeof part === 'string' ? (
78
- <span key={part}>{part}</span>
94
+ <span key={part}>{word(part, t)}</span>
79
95
  ) : (
80
96
  <KeyCaps key={part.key} keys={[part.key]} />
81
97
  ),
@@ -84,6 +100,13 @@ function GestureInput(props: { input: EditorGesture['input'] }): ReactElement {
84
100
  );
85
101
  }
86
102
 
103
+ // A word between two key caps is one catalog entry, shared by every gesture
104
+ // that writes it; punctuation such as `…` is left exactly as it is.
105
+ function word(text: string, t: Translate<ChromeKey>): string {
106
+ const id = editorInputWordId(text);
107
+ return id === undefined ? text : t.or(`structure.input.${id}`, text);
108
+ }
109
+
87
110
  function gestureKey(gesture: EditorGesture): string {
88
111
  const input = gesture.input
89
112
  .map((part) => (typeof part === 'string' ? part : part.key))
@@ -1,6 +1,7 @@
1
1
  import { Classes, Tooltip } from '@blueprintjs/core';
2
2
  import type { CSSProperties, ReactElement, RefObject } from 'react';
3
3
 
4
+ import { useChromeT } from '../../i18n/ui/useT.ts';
4
5
  import type { EditorToolbarButton } from '../core/editorToolbar.ts';
5
6
  import {
6
7
  EDITOR_TOOLBAR_BUTTONS,
@@ -54,20 +55,23 @@ function ButtonTip(props: {
54
55
  mode: StructureEditorMode;
55
56
  }): ReactElement {
56
57
  const { button, mode } = props;
58
+ const t = useChromeT();
57
59
  const available = isEditorToolbarButtonAvailable(button, mode);
58
60
 
59
61
  return (
60
62
  <div style={TIP_STYLE} data-testid="structure-editor-tooltip">
61
63
  <div style={HEAD_STYLE}>
62
- <strong>{button.name}</strong>
64
+ <strong>{t.or(`structure.tool.${button.id}.name`, button.name)}</strong>
63
65
  {button.keys === undefined ? null : <KeyCaps keys={button.keys} />}
64
66
  </div>
65
- <div>{button.description}</div>
67
+ <div>
68
+ {t.or(`structure.tool.${button.id}.description`, button.description)}
69
+ </div>
66
70
  {available ? null : (
67
71
  <div className={Classes.TEXT_MUTED}>
68
72
  {button.availability === 'reaction'
69
- ? 'Only when drawing a reaction.'
70
- : 'Not available in this editor.'}
73
+ ? t('structure.tool.reactionOnly')
74
+ : t('structure.tool.unavailable')}
71
75
  </div>
72
76
  )}
73
77
  </div>
@@ -47,7 +47,7 @@ export type {
47
47
  TranslateSessionOptions,
48
48
  } from './session.ts';
49
49
  export { BRIDGE_GLOBAL, BRIDGE_PROTOCOL, TranslateSession } from './session.ts';
50
- export type { StartTranslatingOptions } from './start.ts';
50
+ export type { LoadOverlayOptions, StartTranslatingOptions } from './start.ts';
51
51
  export {
52
52
  TRANSLATE_ORIGIN,
53
53
  TRANSLATE_PARAM,
@@ -63,6 +63,21 @@ export interface StartTranslatingOptions {
63
63
  * @default globalThis.document
64
64
  */
65
65
  document?: Document;
66
+ /**
67
+ * Told when the overlay cannot be fetched — translate.cheminfo.org down, a
68
+ * network that blocks it, an address typed wrong. The site is expected to
69
+ * stop formatting through the session, so a page nobody can edit goes back
70
+ * to being an ordinary page rather than staying marked with no editor.
71
+ * @default undefined
72
+ */
73
+ onUnavailable?: () => void;
74
+ /**
75
+ * How long to wait for the overlay before giving up on it, in ms. A server
76
+ * that accepts the connection and then says nothing never fails the script,
77
+ * so waiting for `error` alone would wait for ever.
78
+ * @default 10000
79
+ */
80
+ timeout?: number;
66
81
  }
67
82
 
68
83
  /**
@@ -85,6 +100,8 @@ export function startTranslating(
85
100
  tables = [],
86
101
  origin = TRANSLATE_ORIGIN,
87
102
  document: target = globalThis.document,
103
+ onUnavailable,
104
+ timeout = OVERLAY_TIMEOUT,
88
105
  } = options;
89
106
 
90
107
  const session = new TranslateSession({
@@ -95,27 +112,72 @@ export function startTranslating(
95
112
  marked: true,
96
113
  });
97
114
  Object.assign(globalThis, { [BRIDGE_GLOBAL]: session });
98
- loadOverlay(origin, target);
115
+ loadOverlay(origin, { document: target, onUnavailable, timeout });
99
116
  return session;
100
117
  }
101
118
 
119
+ /** How long the overlay has to arrive before the page gives up on it. */
120
+ const OVERLAY_TIMEOUT = 10_000;
121
+
122
+ /** How the overlay script is added, and what happens when it does not come. */
123
+ export interface LoadOverlayOptions {
124
+ /**
125
+ * The document to add it to.
126
+ * @default globalThis.document
127
+ */
128
+ document?: Document;
129
+ /**
130
+ * Told when it cannot be fetched, or does not arrive in time.
131
+ * @default undefined
132
+ */
133
+ onUnavailable?: () => void;
134
+ /**
135
+ * How long to wait, in ms.
136
+ * @default 10000
137
+ */
138
+ timeout?: number;
139
+ }
140
+
102
141
  /**
103
142
  * Add the overlay script to the page, once.
104
143
  * @param origin - Where the overlay is served from.
105
- * @param target - The document to add it to.
144
+ * @param options - See {@link LoadOverlayOptions}.
106
145
  */
107
146
  export function loadOverlay(
108
147
  origin: string,
109
- target = globalThis.document,
148
+ options: LoadOverlayOptions = {},
110
149
  ): void {
150
+ const {
151
+ document: target = globalThis.document,
152
+ onUnavailable,
153
+ timeout = OVERLAY_TIMEOUT,
154
+ } = options;
111
155
  if (target === undefined) return;
112
156
  const src = `${origin.replace(/\/$/, '')}/overlay.js`;
113
157
  for (const loaded of target.querySelectorAll('script')) {
114
158
  if (loaded.src === src) return;
115
159
  }
160
+
116
161
  const script = target.createElement('script');
117
162
  script.type = 'module';
118
163
  script.src = src;
119
164
  script.async = true;
165
+
166
+ // The page is only worth marking while there is an editor to use the marks,
167
+ // so a script that never arrives takes translate mode down with it.
168
+ let settled = false;
169
+ const giveUp = () => {
170
+ if (settled) return;
171
+ settled = true;
172
+ script.remove();
173
+ onUnavailable?.();
174
+ };
175
+ const timer = globalThis.setTimeout(giveUp, timeout);
176
+ script.addEventListener('error', giveUp);
177
+ script.addEventListener('load', () => {
178
+ settled = true;
179
+ globalThis.clearTimeout(timer);
180
+ });
181
+
120
182
  target.head.append(script);
121
183
  }
package/src/ui.ts CHANGED
@@ -14,6 +14,7 @@ export * from './ecosystem/ui/index.ts';
14
14
  export * from './error/ui/index.ts';
15
15
  export * from './help/ui/index.ts';
16
16
  export * from './hooks/ui/index.ts';
17
+ export * from './i18n/ui/index.ts';
17
18
  export * from './language/ui/index.ts';
18
19
  export * from './overlay/ui/index.ts';
19
20
  export * from './parallel/ui/index.ts';