react-cheminfo 0.75.0 → 0.77.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 (342) hide show
  1. package/README.md +141 -31
  2. package/lib/card/core/cardAddress.d.ts +19 -2
  3. package/lib/card/core/cardAddress.d.ts.map +1 -1
  4. package/lib/card/core/cardAddress.js +35 -2
  5. package/lib/card/core/cardAddress.js.map +1 -1
  6. package/lib/card/core/cardPageUrl.d.ts +7 -1
  7. package/lib/card/core/cardPageUrl.d.ts.map +1 -1
  8. package/lib/card/core/cardPageUrl.js +4 -2
  9. package/lib/card/core/cardPageUrl.js.map +1 -1
  10. package/lib/card/core/index.d.ts +1 -1
  11. package/lib/card/core/index.d.ts.map +1 -1
  12. package/lib/card/core/index.js +1 -1
  13. package/lib/card/core/index.js.map +1 -1
  14. package/lib/credits/core/credits.d.ts +30 -0
  15. package/lib/credits/core/credits.d.ts.map +1 -1
  16. package/lib/credits/core/credits.js +35 -0
  17. package/lib/credits/core/credits.js.map +1 -1
  18. package/lib/download/core/copySvg.d.ts +12 -0
  19. package/lib/download/core/copySvg.d.ts.map +1 -0
  20. package/lib/download/core/copySvg.js +38 -0
  21. package/lib/download/core/copySvg.js.map +1 -0
  22. package/lib/download/core/downloadFigure.d.ts +12 -1
  23. package/lib/download/core/downloadFigure.d.ts.map +1 -1
  24. package/lib/download/core/downloadFigure.js +21 -0
  25. package/lib/download/core/downloadFigure.js.map +1 -1
  26. package/lib/download/core/figureDpi.d.ts +59 -0
  27. package/lib/download/core/figureDpi.d.ts.map +1 -0
  28. package/lib/download/core/figureDpi.js +75 -0
  29. package/lib/download/core/figureDpi.js.map +1 -0
  30. package/lib/download/core/figurePng.d.ts +4 -1
  31. package/lib/download/core/figurePng.d.ts.map +1 -1
  32. package/lib/download/core/figurePng.js +11 -2
  33. package/lib/download/core/figurePng.js.map +1 -1
  34. package/lib/download/core/index.d.ts +5 -1
  35. package/lib/download/core/index.d.ts.map +1 -1
  36. package/lib/download/core/index.js +4 -1
  37. package/lib/download/core/index.js.map +1 -1
  38. package/lib/download/core/pngDpi.d.ts +22 -0
  39. package/lib/download/core/pngDpi.d.ts.map +1 -0
  40. package/lib/download/core/pngDpi.js +79 -0
  41. package/lib/download/core/pngDpi.js.map +1 -0
  42. package/lib/download/ui/FigureDownloadPanel.d.ts +13 -0
  43. package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
  44. package/lib/download/ui/FigureDownloadPanel.js +18 -34
  45. package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
  46. package/lib/download/ui/figureDownloadHint.d.ts +5 -0
  47. package/lib/download/ui/figureDownloadHint.d.ts.map +1 -1
  48. package/lib/download/ui/figureDownloadHint.js +8 -0
  49. package/lib/download/ui/figureDownloadHint.js.map +1 -1
  50. package/lib/download/ui/figureDownloadOptions.d.ts +84 -0
  51. package/lib/download/ui/figureDownloadOptions.d.ts.map +1 -0
  52. package/lib/download/ui/figureDownloadOptions.js +2 -0
  53. package/lib/download/ui/figureDownloadOptions.js.map +1 -0
  54. package/lib/download/ui/resolutionChoices.d.ts +27 -0
  55. package/lib/download/ui/resolutionChoices.d.ts.map +1 -0
  56. package/lib/download/ui/resolutionChoices.js +48 -0
  57. package/lib/download/ui/resolutionChoices.js.map +1 -0
  58. package/lib/download/ui/useFigureActions.d.ts +4 -1
  59. package/lib/download/ui/useFigureActions.d.ts.map +1 -1
  60. package/lib/download/ui/useFigureActions.js +17 -8
  61. package/lib/download/ui/useFigureActions.js.map +1 -1
  62. package/lib/download/ui/useFigureDownload.d.ts +2 -55
  63. package/lib/download/ui/useFigureDownload.d.ts.map +1 -1
  64. package/lib/download/ui/useFigureDownload.js +45 -13
  65. package/lib/download/ui/useFigureDownload.js.map +1 -1
  66. package/lib/ecosystem/core/sites.d.ts.map +1 -1
  67. package/lib/ecosystem/core/sites.js +14 -0
  68. package/lib/ecosystem/core/sites.js.map +1 -1
  69. package/lib/ecosystem/core/types.d.ts +1 -1
  70. package/lib/ecosystem/core/types.d.ts.map +1 -1
  71. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  72. package/lib/ecosystem/ui/glyphs.js +3 -0
  73. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  74. package/lib/i18n/core/chromeCatalog.d.ts +1 -1
  75. package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
  76. package/lib/ir/core/bandAssignments.d.ts.map +1 -1
  77. package/lib/ir/core/bandAssignments.js +27 -0
  78. package/lib/ir/core/bandAssignments.js.map +1 -1
  79. package/lib/ir/ui/BandRow.d.ts +4 -4
  80. package/lib/ir/ui/BandRow.d.ts.map +1 -1
  81. package/lib/ir/ui/BandRow.js +41 -14
  82. package/lib/ir/ui/BandRow.js.map +1 -1
  83. package/lib/locales/de.json +32 -1
  84. package/lib/locales/en.json +32 -1
  85. package/lib/locales/es.json +32 -1
  86. package/lib/locales/fr.json +32 -1
  87. package/lib/locales/it.json +32 -1
  88. package/lib/molecule3d/ui/Molecule3DStage.d.ts +4 -33
  89. package/lib/molecule3d/ui/Molecule3DStage.d.ts.map +1 -1
  90. package/lib/molecule3d/ui/Molecule3DStage.js +3 -37
  91. package/lib/molecule3d/ui/Molecule3DStage.js.map +1 -1
  92. package/lib/osiris/core/barGeometry.d.ts +42 -0
  93. package/lib/osiris/core/barGeometry.d.ts.map +1 -0
  94. package/lib/osiris/core/barGeometry.js +46 -0
  95. package/lib/osiris/core/barGeometry.js.map +1 -0
  96. package/lib/osiris/core/computeProperties.d.ts +42 -0
  97. package/lib/osiris/core/computeProperties.d.ts.map +1 -0
  98. package/lib/osiris/core/computeProperties.js +115 -0
  99. package/lib/osiris/core/computeProperties.js.map +1 -0
  100. package/lib/osiris/core/constants.d.ts +70 -0
  101. package/lib/osiris/core/constants.d.ts.map +1 -0
  102. package/lib/osiris/core/constants.js +99 -0
  103. package/lib/osiris/core/constants.js.map +1 -0
  104. package/lib/osiris/core/fitness.d.ts +32 -0
  105. package/lib/osiris/core/fitness.d.ts.map +1 -0
  106. package/lib/osiris/core/fitness.js +48 -0
  107. package/lib/osiris/core/fitness.js.map +1 -0
  108. package/lib/osiris/core/index.d.ts +29 -0
  109. package/lib/osiris/core/index.d.ts.map +1 -0
  110. package/lib/osiris/core/index.js +19 -0
  111. package/lib/osiris/core/index.js.map +1 -0
  112. package/lib/osiris/core/poolSize.d.ts +17 -0
  113. package/lib/osiris/core/poolSize.d.ts.map +1 -0
  114. package/lib/osiris/core/poolSize.js +22 -0
  115. package/lib/osiris/core/poolSize.js.map +1 -0
  116. package/lib/osiris/core/poolTypes.d.ts +140 -0
  117. package/lib/osiris/core/poolTypes.d.ts.map +1 -0
  118. package/lib/osiris/core/poolTypes.js +12 -0
  119. package/lib/osiris/core/poolTypes.js.map +1 -0
  120. package/lib/osiris/core/predictIdCode.d.ts +39 -0
  121. package/lib/osiris/core/predictIdCode.d.ts.map +1 -0
  122. package/lib/osiris/core/predictIdCode.js +54 -0
  123. package/lib/osiris/core/predictIdCode.js.map +1 -0
  124. package/lib/osiris/core/predictProtocol.d.ts +67 -0
  125. package/lib/osiris/core/predictProtocol.d.ts.map +1 -0
  126. package/lib/osiris/core/predictProtocol.js +29 -0
  127. package/lib/osiris/core/predictProtocol.js.map +1 -0
  128. package/lib/osiris/core/predictionPool.d.ts +23 -0
  129. package/lib/osiris/core/predictionPool.d.ts.map +1 -0
  130. package/lib/osiris/core/predictionPool.js +186 -0
  131. package/lib/osiris/core/predictionPool.js.map +1 -0
  132. package/lib/osiris/core/predictionQueue.d.ts +46 -0
  133. package/lib/osiris/core/predictionQueue.d.ts.map +1 -0
  134. package/lib/osiris/core/predictionQueue.js +57 -0
  135. package/lib/osiris/core/predictionQueue.js.map +1 -0
  136. package/lib/osiris/core/predictors.d.ts +62 -0
  137. package/lib/osiris/core/predictors.d.ts.map +1 -0
  138. package/lib/osiris/core/predictors.js +100 -0
  139. package/lib/osiris/core/predictors.js.map +1 -0
  140. package/lib/osiris/core/propertyKeys.d.ts +32 -0
  141. package/lib/osiris/core/propertyKeys.d.ts.map +1 -0
  142. package/lib/osiris/core/propertyKeys.js +44 -0
  143. package/lib/osiris/core/propertyKeys.js.map +1 -0
  144. package/lib/osiris/core/riskAppearance.d.ts +60 -0
  145. package/lib/osiris/core/riskAppearance.d.ts.map +1 -0
  146. package/lib/osiris/core/riskAppearance.js +59 -0
  147. package/lib/osiris/core/riskAppearance.js.map +1 -0
  148. package/lib/osiris/core/riskDetail.d.ts +22 -0
  149. package/lib/osiris/core/riskDetail.d.ts.map +1 -0
  150. package/lib/osiris/core/riskDetail.js +86 -0
  151. package/lib/osiris/core/riskDetail.js.map +1 -0
  152. package/lib/osiris/core/riskDetailRequest.d.ts +31 -0
  153. package/lib/osiris/core/riskDetailRequest.d.ts.map +1 -0
  154. package/lib/osiris/core/riskDetailRequest.js +49 -0
  155. package/lib/osiris/core/riskDetailRequest.js.map +1 -0
  156. package/lib/osiris/core/riskFindings.d.ts +26 -0
  157. package/lib/osiris/core/riskFindings.d.ts.map +1 -0
  158. package/lib/osiris/core/riskFindings.js +79 -0
  159. package/lib/osiris/core/riskFindings.js.map +1 -0
  160. package/lib/osiris/core/runPredictionJob.d.ts +20 -0
  161. package/lib/osiris/core/runPredictionJob.d.ts.map +1 -0
  162. package/lib/osiris/core/runPredictionJob.js +43 -0
  163. package/lib/osiris/core/runPredictionJob.js.map +1 -0
  164. package/lib/osiris/core/scales.d.ts +70 -0
  165. package/lib/osiris/core/scales.d.ts.map +1 -0
  166. package/lib/osiris/core/scales.js +185 -0
  167. package/lib/osiris/core/scales.js.map +1 -0
  168. package/lib/osiris/core/types.d.ts +91 -0
  169. package/lib/osiris/core/types.d.ts.map +1 -0
  170. package/lib/osiris/core/types.js +19 -0
  171. package/lib/osiris/core/types.js.map +1 -0
  172. package/lib/osiris/core/valuation.d.ts +28 -0
  173. package/lib/osiris/core/valuation.d.ts.map +1 -0
  174. package/lib/osiris/core/valuation.js +39 -0
  175. package/lib/osiris/core/valuation.js.map +1 -0
  176. package/lib/osiris/ui/PropertyBar.d.ts +27 -0
  177. package/lib/osiris/ui/PropertyBar.d.ts.map +1 -0
  178. package/lib/osiris/ui/PropertyBar.js +27 -0
  179. package/lib/osiris/ui/PropertyBar.js.map +1 -0
  180. package/lib/osiris/ui/PropertyPanel.d.ts +91 -0
  181. package/lib/osiris/ui/PropertyPanel.d.ts.map +1 -0
  182. package/lib/osiris/ui/PropertyPanel.js +77 -0
  183. package/lib/osiris/ui/PropertyPanel.js.map +1 -0
  184. package/lib/osiris/ui/PropertyRows.d.ts +40 -0
  185. package/lib/osiris/ui/PropertyRows.d.ts.map +1 -0
  186. package/lib/osiris/ui/PropertyRows.js +23 -0
  187. package/lib/osiris/ui/PropertyRows.js.map +1 -0
  188. package/lib/osiris/ui/RiskFindings.d.ts +43 -0
  189. package/lib/osiris/ui/RiskFindings.d.ts.map +1 -0
  190. package/lib/osiris/ui/RiskFindings.js +51 -0
  191. package/lib/osiris/ui/RiskFindings.js.map +1 -0
  192. package/lib/osiris/ui/RiskPanel.d.ts +46 -0
  193. package/lib/osiris/ui/RiskPanel.d.ts.map +1 -0
  194. package/lib/osiris/ui/RiskPanel.js +32 -0
  195. package/lib/osiris/ui/RiskPanel.js.map +1 -0
  196. package/lib/osiris/ui/RiskSquare.d.ts +51 -0
  197. package/lib/osiris/ui/RiskSquare.d.ts.map +1 -0
  198. package/lib/osiris/ui/RiskSquare.js +23 -0
  199. package/lib/osiris/ui/RiskSquare.js.map +1 -0
  200. package/lib/osiris/ui/index.d.ts +15 -0
  201. package/lib/osiris/ui/index.d.ts.map +1 -0
  202. package/lib/osiris/ui/index.js +8 -0
  203. package/lib/osiris/ui/index.js.map +1 -0
  204. package/lib/osiris/ui/usePredictions.d.ts +81 -0
  205. package/lib/osiris/ui/usePredictions.d.ts.map +1 -0
  206. package/lib/osiris/ui/usePredictions.js +102 -0
  207. package/lib/osiris/ui/usePredictions.js.map +1 -0
  208. package/lib/osiris-ui.d.ts +11 -0
  209. package/lib/osiris-ui.d.ts.map +1 -0
  210. package/lib/osiris-ui.js +11 -0
  211. package/lib/osiris-ui.js.map +1 -0
  212. package/lib/osiris.d.ts +17 -0
  213. package/lib/osiris.d.ts.map +1 -0
  214. package/lib/osiris.js +17 -0
  215. package/lib/osiris.js.map +1 -0
  216. package/lib/panel/ui/FilterInput.d.ts.map +1 -1
  217. package/lib/panel/ui/FilterInput.js +3 -1
  218. package/lib/panel/ui/FilterInput.js.map +1 -1
  219. package/lib/panel/ui/SidePanelItem.d.ts +39 -0
  220. package/lib/panel/ui/SidePanelItem.d.ts.map +1 -0
  221. package/lib/panel/ui/SidePanelItem.js +63 -0
  222. package/lib/panel/ui/SidePanelItem.js.map +1 -0
  223. package/lib/panel/ui/SidePanelStack.d.ts +11 -10
  224. package/lib/panel/ui/SidePanelStack.d.ts.map +1 -1
  225. package/lib/panel/ui/SidePanelStack.js +22 -15
  226. package/lib/panel/ui/SidePanelStack.js.map +1 -1
  227. package/lib/panel/ui/SpectrumColorSwatch.d.ts.map +1 -1
  228. package/lib/panel/ui/SpectrumColorSwatch.js +4 -2
  229. package/lib/panel/ui/SpectrumColorSwatch.js.map +1 -1
  230. package/lib/panel/ui/usePanelFolds.d.ts +35 -0
  231. package/lib/panel/ui/usePanelFolds.d.ts.map +1 -0
  232. package/lib/panel/ui/usePanelFolds.js +73 -0
  233. package/lib/panel/ui/usePanelFolds.js.map +1 -0
  234. package/lib/shared/ui/FullscreenStage.d.ts +43 -0
  235. package/lib/shared/ui/FullscreenStage.d.ts.map +1 -0
  236. package/lib/shared/ui/FullscreenStage.js +38 -0
  237. package/lib/shared/ui/FullscreenStage.js.map +1 -0
  238. package/lib/shared/ui/canFillScreen.d.ts +7 -0
  239. package/lib/shared/ui/canFillScreen.d.ts.map +1 -0
  240. package/lib/shared/ui/canFillScreen.js +9 -0
  241. package/lib/shared/ui/canFillScreen.js.map +1 -0
  242. package/lib/shared/ui/index.d.ts +3 -0
  243. package/lib/shared/ui/index.d.ts.map +1 -1
  244. package/lib/shared/ui/index.js +2 -0
  245. package/lib/shared/ui/index.js.map +1 -1
  246. package/lib/split/ui/splitPanes.d.ts +3 -3
  247. package/lib/split/ui/splitPanes.js +1 -1
  248. package/lib/structure/core/structureNotations.d.ts +8 -1
  249. package/lib/structure/core/structureNotations.d.ts.map +1 -1
  250. package/lib/structure/core/structureNotations.js +14 -8
  251. package/lib/structure/core/structureNotations.js.map +1 -1
  252. package/lib/structure/ui/CardStructure.d.ts +43 -0
  253. package/lib/structure/ui/CardStructure.d.ts.map +1 -0
  254. package/lib/structure/ui/CardStructure.js +28 -0
  255. package/lib/structure/ui/CardStructure.js.map +1 -0
  256. package/lib/structure/ui/StructureExportPanel.d.ts +8 -0
  257. package/lib/structure/ui/StructureExportPanel.d.ts.map +1 -1
  258. package/lib/structure/ui/StructureExportPanel.js +9 -4
  259. package/lib/structure/ui/StructureExportPanel.js.map +1 -1
  260. package/lib/structure/ui/StructurePicturePane.d.ts +1 -1
  261. package/lib/structure/ui/StructurePicturePane.d.ts.map +1 -1
  262. package/lib/structure/ui/StructurePicturePane.js +5 -2
  263. package/lib/structure/ui/StructurePicturePane.js.map +1 -1
  264. package/lib/structure/ui/index.d.ts +3 -0
  265. package/lib/structure/ui/index.d.ts.map +1 -1
  266. package/lib/structure/ui/index.js +1 -0
  267. package/lib/structure/ui/index.js.map +1 -1
  268. package/package.json +4 -1
  269. package/src/card/core/cardAddress.ts +39 -3
  270. package/src/card/core/cardPageUrl.ts +10 -3
  271. package/src/card/core/index.ts +7 -1
  272. package/src/credits/core/credits.ts +40 -0
  273. package/src/download/core/copySvg.ts +40 -0
  274. package/src/download/core/downloadFigure.ts +26 -1
  275. package/src/download/core/figureDpi.ts +94 -0
  276. package/src/download/core/figurePng.ts +11 -2
  277. package/src/download/core/index.ts +14 -1
  278. package/src/download/core/pngDpi.ts +84 -0
  279. package/src/download/ui/FigureDownloadPanel.tsx +41 -51
  280. package/src/download/ui/figureDownloadHint.ts +13 -0
  281. package/src/download/ui/figureDownloadOptions.ts +85 -0
  282. package/src/download/ui/resolutionChoices.ts +67 -0
  283. package/src/download/ui/useFigureActions.ts +24 -9
  284. package/src/download/ui/useFigureDownload.tsx +57 -71
  285. package/src/ecosystem/core/sites.ts +14 -0
  286. package/src/ecosystem/core/types.ts +2 -1
  287. package/src/ecosystem/ui/glyphs.tsx +20 -0
  288. package/src/ir/core/bandAssignments.ts +27 -0
  289. package/src/ir/ui/BandRow.tsx +84 -26
  290. package/src/locales/de.json +32 -1
  291. package/src/locales/en.json +32 -1
  292. package/src/locales/es.json +32 -1
  293. package/src/locales/fr.json +32 -1
  294. package/src/locales/it.json +32 -1
  295. package/src/molecule3d/ui/Molecule3DStage.tsx +4 -88
  296. package/src/osiris/core/barGeometry.ts +74 -0
  297. package/src/osiris/core/computeProperties.ts +175 -0
  298. package/src/osiris/core/constants.ts +110 -0
  299. package/src/osiris/core/fitness.ts +59 -0
  300. package/src/osiris/core/index.ts +78 -0
  301. package/src/osiris/core/poolSize.ts +24 -0
  302. package/src/osiris/core/poolTypes.ts +140 -0
  303. package/src/osiris/core/predictIdCode.ts +69 -0
  304. package/src/osiris/core/predictProtocol.ts +78 -0
  305. package/src/osiris/core/predictionPool.ts +237 -0
  306. package/src/osiris/core/predictionQueue.ts +89 -0
  307. package/src/osiris/core/predictors.ts +142 -0
  308. package/src/osiris/core/propertyKeys.ts +54 -0
  309. package/src/osiris/core/riskAppearance.ts +86 -0
  310. package/src/osiris/core/riskDetail.ts +120 -0
  311. package/src/osiris/core/riskDetailRequest.ts +64 -0
  312. package/src/osiris/core/riskFindings.ts +92 -0
  313. package/src/osiris/core/runPredictionJob.ts +49 -0
  314. package/src/osiris/core/scales.ts +236 -0
  315. package/src/osiris/core/types.ts +103 -0
  316. package/src/osiris/core/valuation.ts +44 -0
  317. package/src/osiris/ui/PropertyBar.tsx +77 -0
  318. package/src/osiris/ui/PropertyPanel.tsx +227 -0
  319. package/src/osiris/ui/PropertyRows.tsx +92 -0
  320. package/src/osiris/ui/RiskFindings.tsx +137 -0
  321. package/src/osiris/ui/RiskPanel.tsx +81 -0
  322. package/src/osiris/ui/RiskSquare.tsx +108 -0
  323. package/src/osiris/ui/index.ts +17 -0
  324. package/src/osiris/ui/usePredictions.ts +194 -0
  325. package/src/osiris-ui.ts +11 -0
  326. package/src/osiris.ts +17 -0
  327. package/src/panel/ui/FilterInput.tsx +4 -1
  328. package/src/panel/ui/SidePanelItem.tsx +162 -0
  329. package/src/panel/ui/SidePanelStack.tsx +29 -36
  330. package/src/panel/ui/SpectrumColorSwatch.tsx +5 -3
  331. package/src/panel/ui/usePanelFolds.ts +103 -0
  332. package/src/shared/ui/FullscreenStage.tsx +96 -0
  333. package/src/shared/ui/canFillScreen.ts +8 -0
  334. package/src/shared/ui/index.ts +6 -0
  335. package/src/split/ui/splitPanes.tsx +4 -4
  336. package/src/structure/core/structureNotations.ts +25 -8
  337. package/src/structure/ui/CardStructure.tsx +76 -0
  338. package/src/structure/ui/StructureExportPanel.tsx +23 -4
  339. package/src/structure/ui/StructurePicturePane.tsx +14 -1
  340. package/src/structure/ui/index.ts +6 -0
  341. package/styles/chrome.css +3 -3
  342. package/styles/osiris.css +339 -0
@@ -0,0 +1,81 @@
1
+ /**
2
+ * The prediction pool, handed to a page.
3
+ *
4
+ * The only React in the domain. Results arrive one at a time and are kept in a
5
+ * map the page reads by row key, so a table draws every row immediately and
6
+ * fills each one in as its worker answers — nothing waits for the set.
7
+ *
8
+ * The two maps are created once and mutated, and a counter beside them changes
9
+ * to say so. Building a new map per answer would copy a growing map once per
10
+ * molecule, which on a set of two thousand costs more than the predictions do.
11
+ */
12
+ import type { WorkerLike } from '../../worker/core/messages.ts';
13
+ import type { PredictionInput, PredictionProgress } from '../core/poolTypes.ts';
14
+ import type { ResourceSource } from '../core/predictors.ts';
15
+ import type { OsirisProperties, RiskDetail, RiskType } from '../core/types.ts';
16
+ /** What a page gives the hook. */
17
+ export interface UsePredictionsOptions {
18
+ /**
19
+ * The molecules to predict. One already answered is never asked for again,
20
+ * so a page may pass its whole set on every render — though memoising it
21
+ * saves the filtering pass.
22
+ */
23
+ molecules: readonly PredictionInput[];
24
+ /**
25
+ * The keys of the rows the reader can see, most wanted first. They are
26
+ * answered before the rest.
27
+ * @default undefined — the reading order is kept
28
+ */
29
+ visibleKeys?: readonly string[];
30
+ /**
31
+ * Whether to predict at all. Off while a file is still being read, so the
32
+ * pool is not asked for half a set.
33
+ * @default true
34
+ */
35
+ enabled?: boolean;
36
+ /**
37
+ * Where the workers register OpenChemLib's resources from: the absolute URL
38
+ * of the site's own `openchemlib-resources.json`, resolved on the main thread
39
+ * — a worker has no `document` to read the deployment's mount path off, and
40
+ * a relative address would resolve against its hashed chunk.
41
+ */
42
+ resources: ResourceSource;
43
+ /**
44
+ * Makes one prediction worker: a module worker of the site's own, serving
45
+ * `runPredictionJob` for the requests `isPredictRequest` accepts. It may be
46
+ * a new function on every render — it is read only when a worker is made.
47
+ */
48
+ createWorker: () => WorkerLike;
49
+ /**
50
+ * How many workers to run.
51
+ * @default one fewer than the machine's cores, clamped to 1 to 8
52
+ */
53
+ size?: number;
54
+ }
55
+ /** What the hook gives a page back. */
56
+ export interface UsePredictionsResult {
57
+ /** What each answered row was predicted to be, by row key. */
58
+ results: ReadonlyMap<string, OsirisProperties>;
59
+ /** Why each refused row was refused, by row key. */
60
+ failures: ReadonlyMap<string, string>;
61
+ /** How far the pool has got. */
62
+ progress: PredictionProgress;
63
+ /** Why no prediction can be made at all, or `null`. */
64
+ error: string | null;
65
+ /** Drop everything still queued. */
66
+ cancel: () => void;
67
+ /**
68
+ * Why one risk came back as it did.
69
+ * @param idCode - The molecule, coordinates included or not.
70
+ * @param risk - Which of the four risks to explain.
71
+ * @returns The findings, with the matched atoms and bonds of every fragment.
72
+ */
73
+ riskDetail: (idCode: string, risk: RiskType) => Promise<RiskDetail>;
74
+ }
75
+ /**
76
+ * Predict a set of molecules on a pool of workers, streaming the answers back.
77
+ * @param options - See {@link UsePredictionsOptions}.
78
+ * @returns The answers so far, the progress, and the controls.
79
+ */
80
+ export declare function usePredictions(options: UsePredictionsOptions): UsePredictionsResult;
81
+ //# sourceMappingURL=usePredictions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePredictions.d.ts","sourceRoot":"","sources":["../../../src/osiris/ui/usePredictions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EACV,eAAe,EAEf,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE/E,kCAAkC;AAClC,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IACtC;;;;OAIG;IACH,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,SAAS,EAAE,cAAc,CAAC;IAC1B;;;;OAIG;IACH,YAAY,EAAE,MAAM,UAAU,CAAC;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,uCAAuC;AACvC,MAAM,WAAW,oBAAoB;IACnC,8DAA8D;IAC9D,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC/C,oDAAoD;IACpD,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gCAAgC;IAChC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,uDAAuD;IACvD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,oCAAoC;IACpC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;;;;OAKG;IACH,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACrE;AAoBD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,qBAAqB,GAC7B,oBAAoB,CAmFtB"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The prediction pool, handed to a page.
3
+ *
4
+ * The only React in the domain. Results arrive one at a time and are kept in a
5
+ * map the page reads by row key, so a table draws every row immediately and
6
+ * fills each one in as its worker answers — nothing waits for the set.
7
+ *
8
+ * The two maps are created once and mutated, and a counter beside them changes
9
+ * to say so. Building a new map per answer would copy a growing map once per
10
+ * molecule, which on a set of two thousand costs more than the predictions do.
11
+ */
12
+ import { useCallback, useEffect, useRef, useState } from 'react';
13
+ import { createPredictionPool } from "../core/predictionPool.js";
14
+ const IDLE = {
15
+ done: 0,
16
+ total: 0,
17
+ pending: 0,
18
+ running: false,
19
+ };
20
+ /**
21
+ * Predict a set of molecules on a pool of workers, streaming the answers back.
22
+ * @param options - See {@link UsePredictionsOptions}.
23
+ * @returns The answers so far, the progress, and the controls.
24
+ */
25
+ export function usePredictions(options) {
26
+ const { molecules, visibleKeys, enabled = true, size } = options;
27
+ const { resources, createWorker } = options;
28
+ // Read when the pool and its workers are made rather than listed as a
29
+ // dependency: a factory written inline is a new function on every render,
30
+ // and the progress the pool reports causes one.
31
+ const source = useRef({ resources, createWorker });
32
+ useEffect(() => {
33
+ source.current = { resources, createWorker };
34
+ }, [resources, createWorker]);
35
+ const [answered] = useState(() => ({
36
+ results: new Map(),
37
+ failures: new Map(),
38
+ }));
39
+ const [view, setView] = useState({
40
+ progress: IDLE,
41
+ error: null,
42
+ answers: 0,
43
+ });
44
+ const pool = useRef(null);
45
+ const open = useCallback(() => {
46
+ pool.current ??= createPredictionPool({
47
+ resources: source.current.resources,
48
+ createWorker: () => source.current.createWorker(),
49
+ ...(size === undefined ? {} : { size }),
50
+ onResult(outcome) {
51
+ if (outcome.ok)
52
+ answered.results.set(outcome.key, outcome.properties);
53
+ else
54
+ answered.failures.set(outcome.key, outcome.message);
55
+ setView((previous) => ({ ...previous, answers: previous.answers + 1 }));
56
+ },
57
+ onProgress(progress) {
58
+ setView((previous) => ({ ...previous, progress }));
59
+ },
60
+ onUnavailable(message) {
61
+ setView((previous) => ({ ...previous, error: message }));
62
+ },
63
+ });
64
+ return pool.current;
65
+ }, [answered, size]);
66
+ const unavailable = view.error;
67
+ useEffect(() => {
68
+ if (!enabled || unavailable !== null)
69
+ return;
70
+ const waiting = [];
71
+ for (const molecule of molecules) {
72
+ if (answered.results.has(molecule.key))
73
+ continue;
74
+ if (answered.failures.has(molecule.key))
75
+ continue;
76
+ waiting.push(molecule);
77
+ }
78
+ if (waiting.length > 0)
79
+ open().submit(waiting);
80
+ }, [answered, molecules, enabled, open, unavailable]);
81
+ useEffect(() => {
82
+ if (visibleKeys !== undefined)
83
+ pool.current?.prioritize(visibleKeys);
84
+ }, [visibleKeys]);
85
+ useEffect(() => () => {
86
+ pool.current?.terminate();
87
+ pool.current = null;
88
+ }, []);
89
+ const cancel = useCallback(() => {
90
+ pool.current?.cancel();
91
+ }, []);
92
+ const riskDetail = useCallback((idCode, risk) => open().riskDetail(idCode, risk), [open]);
93
+ return {
94
+ results: answered.results,
95
+ failures: answered.failures,
96
+ progress: view.progress,
97
+ error: view.error,
98
+ cancel,
99
+ riskDetail,
100
+ };
101
+ }
102
+ //# sourceMappingURL=usePredictions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePredictions.js","sourceRoot":"","sources":["../../../src/osiris/ui/usePredictions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAiEjE,MAAM,IAAI,GAAuB;IAC/B,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and the
3
+ * explanation a square opens — and `usePredictions`, which drives a pool of
4
+ * prediction workers from a page.
5
+ *
6
+ * Kept apart from `react-cheminfo/osiris` so the worker that predicts loads no
7
+ * React and no Blueprint; everything the panel draws from is imported from
8
+ * there. The stylesheet is `react-cheminfo/styles/osiris.css`.
9
+ */
10
+ export * from './osiris/ui/index.ts';
11
+ //# sourceMappingURL=osiris-ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"osiris-ui.d.ts","sourceRoot":"","sources":["../src/osiris-ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The OSIRIS property panel — the four risk squares, the ten bars and the
3
+ * explanation a square opens — and `usePredictions`, which drives a pool of
4
+ * prediction workers from a page.
5
+ *
6
+ * Kept apart from `react-cheminfo/osiris` so the worker that predicts loads no
7
+ * React and no Blueprint; everything the panel draws from is imported from
8
+ * there. The stylesheet is `react-cheminfo/styles/osiris.css`.
9
+ */
10
+ export * from "./osiris/ui/index.js";
11
+ //# sourceMappingURL=osiris-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"osiris-ui.js","sourceRoot":"","sources":["../src/osiris-ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * What OSIRIS predicts about a molecule — the four toxicity risks, cLogP,
3
+ * solubility, drug-likeness and the drug score — and the pool of workers that
4
+ * predicts a whole set of them.
5
+ *
6
+ * Framework-free on purpose, and its own door for two reasons. A prediction
7
+ * worker imports `runPredictionJob` and `isPredictRequest` from here, and a dev
8
+ * server hands a worker its dependencies unbundled, so anything React-shaped
9
+ * behind this door would be evaluated in every worker. And a server answering
10
+ * predictions over an API loads it in Node, where nothing is tree-shaken.
11
+ * `openchemlib` is imported on the first prediction, never on import.
12
+ *
13
+ * The panel that draws the answer, and the hook that drives the pool from a
14
+ * page, are `react-cheminfo/osiris-ui`.
15
+ */
16
+ export * from './osiris/core/index.ts';
17
+ //# sourceMappingURL=osiris.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"osiris.d.ts","sourceRoot":"","sources":["../src/osiris.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC"}
package/lib/osiris.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * What OSIRIS predicts about a molecule — the four toxicity risks, cLogP,
3
+ * solubility, drug-likeness and the drug score — and the pool of workers that
4
+ * predicts a whole set of them.
5
+ *
6
+ * Framework-free on purpose, and its own door for two reasons. A prediction
7
+ * worker imports `runPredictionJob` and `isPredictRequest` from here, and a dev
8
+ * server hands a worker its dependencies unbundled, so anything React-shaped
9
+ * behind this door would be evaluated in every worker. And a server answering
10
+ * predictions over an API loads it in Node, where nothing is tree-shaken.
11
+ * `openchemlib` is imported on the first prediction, never on import.
12
+ *
13
+ * The panel that draws the answer, and the hook that drives the pool from a
14
+ * page, are `react-cheminfo/osiris-ui`.
15
+ */
16
+ export * from "./osiris/core/index.js";
17
+ //# sourceMappingURL=osiris.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"osiris.js","sourceRoot":"","sources":["../src/osiris.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,wBAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FilterInput.d.ts","sourceRoot":"","sources":["../../../src/panel/ui/FilterInput.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAyBlD"}
1
+ {"version":3,"file":"FilterInput.d.ts","sourceRoot":"","sources":["../../../src/panel/ui/FilterInput.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA0BlD"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { InputGroup } from '@blueprintjs/core';
3
+ import { useChromeT } from "../../i18n/ui/useT.js";
3
4
  import { ClearButton } from "./ClearButton.js";
4
5
  /**
5
6
  * The box a list is filtered through, with a cross to empty it again.
@@ -18,6 +19,7 @@ import { ClearButton } from "./ClearButton.js";
18
19
  */
19
20
  export function FilterInput(props) {
20
21
  const { value, onValueChange, placeholder, autoFocus = false } = props;
21
- return (_jsx(InputGroup, { autoFocus: autoFocus, leftIcon: "search", size: "small", value: value, placeholder: placeholder, spellCheck: false, autoCapitalize: "off", autoCorrect: "off", autoComplete: "off", rightElement: value.length > 0 ? (_jsx(ClearButton, { label: "Clear the filter", onClick: () => onValueChange('') })) : undefined, onValueChange: onValueChange }));
22
+ const t = useChromeT();
23
+ return (_jsx(InputGroup, { autoFocus: autoFocus, leftIcon: "search", size: "small", value: value, placeholder: placeholder, spellCheck: false, autoCapitalize: "off", autoCorrect: "off", autoComplete: "off", rightElement: value.length > 0 ? (_jsx(ClearButton, { label: t('panel.clearFilter'), onClick: () => onValueChange('') })) : undefined, onValueChange: onValueChange }));
22
24
  }
23
25
  //# sourceMappingURL=FilterInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilterInput.js","sourceRoot":"","sources":["../../../src/panel/ui/FilterInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAC;AAiBhD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IAEvE,OAAO,CACL,KAAC,UAAU,IACT,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAC,QAAQ,EACjB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,KAAK,EACjB,cAAc,EAAC,KAAK,EACpB,WAAW,EAAC,KAAK,EACjB,YAAY,EAAC,KAAK,EAClB,YAAY,EACV,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACjB,KAAC,WAAW,IACV,KAAK,EAAC,kBAAkB,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,GAChC,CACH,CAAC,CAAC,CAAC,SAAS,EAEf,aAAa,EAAE,aAAa,GAC5B,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"FilterInput.js","sourceRoot":"","sources":["../../../src/panel/ui/FilterInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAC;AAiBhD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IACvE,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IAEvB,OAAO,CACL,KAAC,UAAU,IACT,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAC,QAAQ,EACjB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,KAAK,EACjB,cAAc,EAAC,KAAK,EACpB,WAAW,EAAC,KAAK,EACjB,YAAY,EAAC,KAAK,EAClB,YAAY,EACV,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACjB,KAAC,WAAW,IACV,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,GAChC,CACH,CAAC,CAAC,CAAC,SAAS,EAEf,aAAa,EAAE,aAAa,GAC5B,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { ReactNode } from 'react';
2
+ /** Props of {@link SidePanelItem}. */
3
+ export interface SidePanelItemProps {
4
+ /** Identity of the panel in the stack. */
5
+ id: string;
6
+ /** What the header says. */
7
+ title: string;
8
+ /** Whether the panel shows its body. */
9
+ isOpen: boolean;
10
+ /**
11
+ * Called when the chevron, the header or a shift-click on another header
12
+ * folds or unfolds the panel.
13
+ * @param isOpen - Whether it shows its body.
14
+ */
15
+ onOpenChange: (isOpen: boolean) => void;
16
+ /**
17
+ * Whether the panel is the one in focus, and the toggle; `undefined` while it
18
+ * is alone in the stack, where there is nothing to fold.
19
+ */
20
+ focus: {
21
+ active: boolean;
22
+ toggle: () => void;
23
+ } | undefined;
24
+ /** Called when the close cross is pressed. */
25
+ onClose: () => void;
26
+ /** The body. */
27
+ children: ReactNode;
28
+ }
29
+ /**
30
+ * One panel of the stack: the header with the shell's gestures, and the body,
31
+ * which is also the box that fills the screen.
32
+ *
33
+ * The header is not part of what fills the screen, so a body that does carries
34
+ * a bar of its own with the title and the way back.
35
+ * @param props - See {@link SidePanelItemProps}.
36
+ * @returns The accordion item.
37
+ */
38
+ export declare function SidePanelItem(props: SidePanelItemProps): import("react").JSX.Element;
39
+ //# sourceMappingURL=SidePanelItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidePanelItem.d.ts","sourceRoot":"","sources":["../../../src/panel/ui/SidePanelItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAYtD,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,KAAK,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,SAAS,CAAC;IAC3D,8CAA8C;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB;IAChB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAwFtD"}
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCallback, useRef, useState } from 'react';
3
+ import { Accordion, Button } from 'react-science/ui';
4
+ import { useLanguage } from "../../i18n/ui/useLanguage.js";
5
+ import { useChromeT } from "../../i18n/ui/useT.js";
6
+ import { FullscreenStage } from "../../shared/ui/FullscreenStage.js";
7
+ import { canFillScreen } from "../../shared/ui/canFillScreen.js";
8
+ import { TOKEN } from "../../tokens/core/familyTokens.js";
9
+ import { panelStyle, panelToolbarStyle } from "../core/panelStyles.js";
10
+ /**
11
+ * One panel of the stack: the header with the shell's gestures, and the body,
12
+ * which is also the box that fills the screen.
13
+ *
14
+ * The header is not part of what fills the screen, so a body that does carries
15
+ * a bar of its own with the title and the way back.
16
+ * @param props - See {@link SidePanelItemProps}.
17
+ * @returns The accordion item.
18
+ */
19
+ export function SidePanelItem(props) {
20
+ const { id, title, isOpen, onOpenChange, focus, onClose, children } = props;
21
+ const t = useChromeT();
22
+ const panel = inSentence(title, useLanguage());
23
+ const [canFill] = useState(canFillScreen);
24
+ const body = useRef(null);
25
+ const onStage = useCallback((element) => {
26
+ body.current = element;
27
+ }, []);
28
+ function fillScreen() {
29
+ if (!isOpen)
30
+ onOpenChange(true);
31
+ void body.current?.requestFullscreen().catch(() => undefined);
32
+ }
33
+ return (_jsx(Accordion.Item, { id: id, title: title, open: isOpen, onOpenChange: onOpenChange, renderToolbar: () => (_jsxs(_Fragment, { children: [focus !== undefined && (_jsx(Button, { variant: "minimal", icon: focus.active ? 'expand-all' : 'collapse-all', "aria-pressed": focus.active, "aria-label": t('panel.focus', { panel }), tooltipProps: {
34
+ content: focus.active
35
+ ? t('panel.unfocusTooltip')
36
+ : t('panel.focusTooltip'),
37
+ }, onClick: focus.toggle })), canFill && (_jsx(Button, { variant: "minimal", icon: "fullscreen", "aria-label": t('panel.fillScreen', { panel }), tooltipProps: { content: t('panel.fillScreenTooltip') }, onClick: fillScreen })), _jsx(Button, { variant: "minimal", icon: isOpen ? 'chevron-down' : 'chevron-right', "data-panel-open": isOpen, "aria-expanded": isOpen, "aria-label": t(isOpen ? 'panel.fold' : 'panel.unfold', { panel }), tooltipProps: {
38
+ content: t(isOpen ? 'panel.foldTooltip' : 'panel.unfoldTooltip'),
39
+ }, onClick: () => onOpenChange(!isOpen) }), _jsx(Button, { variant: "minimal", icon: "cross", tooltipProps: { content: t('panel.closeTooltip') }, "aria-label": t('panel.close', { panel }), onClick: onClose })] })), children: _jsx(FullscreenStage, { style: bodyStyle, onStage: onStage, children: (fullscreen) => (_jsxs(_Fragment, { children: [fullscreen?.active === true && (_jsxs("div", { style: fullscreenBarStyle, children: [_jsx("span", { style: fullscreenTitleStyle, children: title }), _jsx(Button, { variant: "minimal", icon: "minimize", "aria-label": t('panel.leaveFullScreen'), tooltipProps: { content: t('panel.leaveFullScreenTooltip') }, onClick: fullscreen.toggle })] })), children] })) }) }));
40
+ }
41
+ /**
42
+ * The title as it reads inside a sentence: lowercased, except in German, where
43
+ * every noun keeps its capital.
44
+ * @param title - The panel's title.
45
+ * @param language - The language of the sentence.
46
+ * @returns The title to write into it.
47
+ */
48
+ function inSentence(title, language) {
49
+ return language === 'de' ? title : title.toLocaleLowerCase(language);
50
+ }
51
+ /** A box filling the screen shows the backdrop through it unless painted. */
52
+ const filledStyle = { ...panelStyle, background: TOKEN.surface };
53
+ function bodyStyle(fillsScreen) {
54
+ return fillsScreen ? filledStyle : panelStyle;
55
+ }
56
+ const fullscreenBarStyle = {
57
+ ...panelToolbarStyle,
58
+ alignItems: 'center',
59
+ justifyContent: 'space-between',
60
+ paddingLeft: 12,
61
+ };
62
+ const fullscreenTitleStyle = { fontWeight: 'bold' };
63
+ //# sourceMappingURL=SidePanelItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidePanelItem.js","sourceRoot":"","sources":["../../../src/panel/ui/SidePanelItem.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAqC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAA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EAAE,EAAE,CAAC,CACf,8BACG,UAAU,EAAE,MAAM,KAAK,IAAI,IAAI,CAC9B,eAAK,KAAK,EAAE,kBAAkB,aAC5B,eAAM,KAAK,EAAE,oBAAoB,YAAG,KAAK,GAAQ,EACjD,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,UAAU,gBACH,CAAC,CAAC,uBAAuB,CAAC,EACtC,YAAY,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,8BAA8B,CAAC,EAAE,EAC5D,OAAO,EAAE,UAAU,CAAC,MAAM,GAC1B,IACE,CACP,EACA,QAAQ,IACR,CACJ,GACe,GACH,CAClB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,KAAa,EAAE,QAAkB;IACnD,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACvE,CAAC;AAED,6EAA6E;AAC7E,MAAM,WAAW,GAAkB,EAAE,GAAG,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;AAEhF,SAAS,SAAS,CAAC,WAAoB;IACrC,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;AAChD,CAAC;AAED,MAAM,kBAAkB,GAAkB;IACxC,GAAG,iBAAiB;IACpB,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,eAAe;IAC/B,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF,MAAM,oBAAoB,GAAkB,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC"}
@@ -40,21 +40,22 @@ export interface SidePanelStackProps<TPanel extends PanelDescriptor> {
40
40
  * They are drawn in the order the rail stacks their icons rather than the order
41
41
  * they were switched on, so a panel always comes back where it was.
42
42
  *
43
- * The header carries the shell's own two gestures and nothing about what the
44
- * panel holds: the chevron that folds it away and the cross that closes it.
45
- * What a panel switches on and off is a toolbar at the top of its own body, so
46
- * it travels with the panel when it is folded, reordered or lent to another
47
- * editor, and every header in every editor reads the same — which is the reason
48
- * this is one component rather than one per editor.
43
+ * The header carries the shell's own gestures and nothing about what the panel
44
+ * holds: focus, which folds every other panel away and unfolds them again;
45
+ * filling the screen with the panel, where the browser can; the chevron that
46
+ * folds it away; and the cross that closes it. What a panel switches on and off
47
+ * is a toolbar at the top of its own body, so it travels with the panel when it
48
+ * is folded, reordered or lent to another editor, and every header in every
49
+ * editor reads the same — which is the reason this is one component rather
50
+ * than one per editor.
49
51
  *
50
52
  * The chevron is there because nothing else says which panels are folded. The
51
53
  * accordion draws every header identically and hides only the body, so a side
52
54
  * of four closed panels and a side of four open ones differ by white space, and
53
55
  * a reader looking for a panel that is already open reaches for its icon and
54
- * closes it. It is a real button rather than a glyph because the header's own
55
- * click never reaches the toolbar — clicks there are stopped so the close cross
56
- * does not also fold the panel — so a chevron that did nothing when pressed
57
- * would be an affordance that lies.
56
+ * closes it. Focus is a button as well as a shift-click because a modifier on a
57
+ * header is a gesture nobody finds, and it undoes itself, which a shift-click
58
+ * does not.
58
59
  * @param props - Component props.
59
60
  * @returns The stack.
60
61
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanelStack.d.ts","sourceRoot":"","sources":["../../../src/panel/ui/SidePanelStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB,CAAC,MAAM,SAAS,eAAe;IACjE,kEAAkE;I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,CAAC,MAAM,SAAS,eAAe,EAC3D,KAAK,EAAE,mBAAmB,CAAC,MAAM,CAAC,+BAgCnC"}
@@ -1,5 +1,7 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Accordion, AccordionProvider, Button } from 'react-science/ui';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Accordion, AccordionProvider } from 'react-science/ui';
3
+ import { SidePanelItem } from "./SidePanelItem.js";
4
+ import { usePanelFolds } from "./usePanelFolds.js";
3
5
  /**
4
6
  * The panels that are open, stacked one under the other down the side.
5
7
  *
@@ -12,29 +14,34 @@ import { Accordion, AccordionProvider, Button } from 'react-science/ui';
12
14
  * They are drawn in the order the rail stacks their icons rather than the order
13
15
  * they were switched on, so a panel always comes back where it was.
14
16
  *
15
- * The header carries the shell's own two gestures and nothing about what the
16
- * panel holds: the chevron that folds it away and the cross that closes it.
17
- * What a panel switches on and off is a toolbar at the top of its own body, so
18
- * it travels with the panel when it is folded, reordered or lent to another
19
- * editor, and every header in every editor reads the same — which is the reason
20
- * this is one component rather than one per editor.
17
+ * The header carries the shell's own gestures and nothing about what the panel
18
+ * holds: focus, which folds every other panel away and unfolds them again;
19
+ * filling the screen with the panel, where the browser can; the chevron that
20
+ * folds it away; and the cross that closes it. What a panel switches on and off
21
+ * is a toolbar at the top of its own body, so it travels with the panel when it
22
+ * is folded, reordered or lent to another editor, and every header in every
23
+ * editor reads the same — which is the reason this is one component rather
24
+ * than one per editor.
21
25
  *
22
26
  * The chevron is there because nothing else says which panels are folded. The
23
27
  * accordion draws every header identically and hides only the body, so a side
24
28
  * of four closed panels and a side of four open ones differ by white space, and
25
29
  * a reader looking for a panel that is already open reaches for its icon and
26
- * closes it. It is a real button rather than a glyph because the header's own
27
- * click never reaches the toolbar — clicks there are stopped so the close cross
28
- * does not also fold the panel — so a chevron that did nothing when pressed
29
- * would be an affordance that lies.
30
+ * closes it. Focus is a button as well as a shift-click because a modifier on a
31
+ * header is a gesture nobody finds, and it undoes itself, which a shift-click
32
+ * does not.
30
33
  * @param props - Component props.
31
34
  * @returns The stack.
32
35
  */
33
36
  export function SidePanelStack(props) {
34
37
  const { panels, openPanelIds, onClose, children } = props;
35
38
  const open = panels.filter((panel) => openPanelIds.includes(panel.id));
36
- return (_jsx(AccordionProvider, { children: _jsx(Accordion, { children: open.map((panel) => (_jsx(Accordion.Item, { id: panel.id, title: panel.title, defaultOpen: true, renderToolbar: ({ isOpen, controls }) => (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "minimal", icon: isOpen ? 'chevron-down' : 'chevron-right', "data-panel-open": isOpen, "aria-expanded": isOpen, "aria-label": `${isOpen ? 'Fold' : 'Unfold'} the ${panel.title.toLowerCase()} panel`, tooltipProps: {
37
- content: isOpen ? 'Fold this panel away' : 'Unfold it',
38
- }, onClick: () => controls.toggle() }), _jsx(Button, { variant: "minimal", icon: "cross", tooltipProps: { content: 'Close this panel' }, "aria-label": `Close the ${panel.title.toLowerCase()} panel`, onClick: () => onClose(panel.id) })] })), children: children(panel) }, panel.id))) }) }));
39
+ const folds = usePanelFolds(open.map((panel) => panel.id));
40
+ return (_jsx(AccordionProvider, { children: _jsx(Accordion, { children: open.map((panel) => (_jsx(SidePanelItem, { id: panel.id, title: panel.title, isOpen: folds.isOpen(panel.id), onOpenChange: (isOpen) => folds.setOpen(panel.id, isOpen), focus: open.length > 1
41
+ ? {
42
+ active: folds.focused === panel.id,
43
+ toggle: () => folds.toggleFocus(panel.id),
44
+ }
45
+ : undefined, onClose: () => onClose(panel.id), children: children(panel) }, panel.id))) }) }));
39
46
  }
40
47
  //# sourceMappingURL=SidePanelStack.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanelStack.js","sourceRoot":"","sources":["../../../src/panel/ui/SidePanelStack.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAgCxE;;;;;;;;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AC,EACzD,KAAK,EACH,IAAI,CAAC,MAAM,GAAG,CAAC;oBACb,CAAC,CAAC;wBACE,MAAM,EAAE,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,EAAE;wBAClC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;qBAC1C;oBACH,CAAC,CAAC,SAAS,EAEf,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,YAE/B,QAAQ,CAAC,KAAK,CAAC,IAfX,KAAK,CAAC,EAAE,CAgBC,CACjB,CAAC,GACQ,GACM,CACrB,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SpectrumColorSwatch.d.ts","sourceRoot":"","sources":["../../../src/panel/ui/SpectrumColorSwatch.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,+BA8ClE"}
1
+ {"version":3,"file":"SpectrumColorSwatch.d.ts","sourceRoot":"","sources":["../../../src/panel/ui/SpectrumColorSwatch.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,+BA+ClE"}
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { PopoverNext } from '@blueprintjs/core';
3
3
  import { useState } from 'react';
4
4
  import { EXTRA_SPECTRUM_COLORS, SPECTRUM_COLORS, } from "../../chart/core/spectrumColor.js";
5
+ import { useChromeT } from "../../i18n/ui/useT.js";
5
6
  /**
6
7
  * The chip that says what colour a spectrum is drawn in, and changes it.
7
8
  *
@@ -28,8 +29,9 @@ import { EXTRA_SPECTRUM_COLORS, SPECTRUM_COLORS, } from "../../chart/core/spectr
28
29
  export function SpectrumColorSwatch(props) {
29
30
  const { color, name, onPick } = props;
30
31
  const [isOpen, setIsOpen] = useState(false);
32
+ const t = useChromeT();
31
33
  function offer(offered) {
32
- return (_jsx("button", { type: "button", title: offered, "aria-label": `Draw ${name} in ${offered}`, style: {
34
+ return (_jsx("button", { type: "button", title: offered, "aria-label": t('panel.drawIn', { name, color: offered }), style: {
33
35
  ...(offered === color ? activeSwatchStyle : swatchStyle),
34
36
  background: offered,
35
37
  }, onClick: () => {
@@ -43,7 +45,7 @@ export function SpectrumColorSwatch(props) {
43
45
  , {
44
46
  // A handful of chips need no arrow pointing back at a chip of the same
45
47
  // size.
46
- arrow: false, isOpen: isOpen, placement: "bottom-start", onInteraction: setIsOpen, content: _jsxs("div", { style: paletteStyle, children: [_jsx("div", { style: paletteRowStyle, children: SPECTRUM_COLORS.map(offer) }), _jsx("div", { style: paletteRowStyle, children: EXTRA_SPECTRUM_COLORS.map(offer) })] }), children: _jsx("button", { type: "button", title: "Draw this spectrum in another colour", "aria-label": `Colour of ${name}`, style: { ...swatchStyle, background: color } }) }));
48
+ arrow: false, isOpen: isOpen, placement: "bottom-start", onInteraction: setIsOpen, content: _jsxs("div", { style: paletteStyle, children: [_jsx("div", { style: paletteRowStyle, children: SPECTRUM_COLORS.map(offer) }), _jsx("div", { style: paletteRowStyle, children: EXTRA_SPECTRUM_COLORS.map(offer) })] }), children: _jsx("button", { type: "button", title: t('panel.changeColour'), "aria-label": t('panel.colourOf', { name }), style: { ...swatchStyle, background: color } }) }));
47
49
  }
48
50
  /**
49
51
  * A round chip rather than a square one: it is the mark the chart's own
@@ -1 +1 @@
1
- {"version":3,"file":"SpectrumColorSwatch.js","sourceRoot":"","sources":["../../../src/panel/ui/SpectrumColorSwatch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EACL,qBAAqB,EACrB,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAW3C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,SAAS,KAAK,CAAC,OAAe;QAC5B,OAAO,CACL,iBAEE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,OAAO,gBACF,QAAQ,IAAI,OAAO,OAAO,EAAE,EACxC,KAAK,EAAE;gBACL,GAAG,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAC;gBACxD,UAAU,EAAE,OAAO;aACpB,EACD,OAAO,EAAE,GAAG,EAAE;gBACZ,MAAM,CAAC,OAAO,CAAC,CAAC;gBAChB,SAAS,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC,IAXI,OAAO,CAYZ,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,WAAW;IACV,uEAAuE;IACvE,QAAQ;;QADR,uEAAuE;QACvE,QAAQ;QACR,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAC,cAAc,EACxB,aAAa,EAAE,SAAS,EAC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