react-cheminfo 0.64.1 → 0.66.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 (827) hide show
  1. package/README.md +293 -6
  2. package/lib/card/core/cardAddress.d.ts +70 -0
  3. package/lib/card/core/cardAddress.d.ts.map +1 -0
  4. package/lib/card/core/cardAddress.js +59 -0
  5. package/lib/card/core/cardAddress.js.map +1 -0
  6. package/lib/card/core/cardPageUrl.d.ts +49 -0
  7. package/lib/card/core/cardPageUrl.d.ts.map +1 -0
  8. package/lib/card/core/cardPageUrl.js +59 -0
  9. package/lib/card/core/cardPageUrl.js.map +1 -0
  10. package/lib/card/core/index.d.ts +7 -0
  11. package/lib/card/core/index.d.ts.map +1 -0
  12. package/lib/card/core/index.js +4 -0
  13. package/lib/card/core/index.js.map +1 -0
  14. package/lib/card/core/panelRoom.d.ts +40 -0
  15. package/lib/card/core/panelRoom.d.ts.map +1 -0
  16. package/lib/card/core/panelRoom.js +40 -0
  17. package/lib/card/core/panelRoom.js.map +1 -0
  18. package/lib/card/ui/CardDetailsButton.d.ts +38 -0
  19. package/lib/card/ui/CardDetailsButton.d.ts.map +1 -0
  20. package/lib/card/ui/CardDetailsButton.js +50 -0
  21. package/lib/card/ui/CardDetailsButton.js.map +1 -0
  22. package/lib/card/ui/CardFigure.d.ts +51 -0
  23. package/lib/card/ui/CardFigure.d.ts.map +1 -0
  24. package/lib/card/ui/CardFigure.js +27 -0
  25. package/lib/card/ui/CardFigure.js.map +1 -0
  26. package/lib/card/ui/CardFrame.d.ts +30 -0
  27. package/lib/card/ui/CardFrame.d.ts.map +1 -0
  28. package/lib/card/ui/CardFrame.js +20 -0
  29. package/lib/card/ui/CardFrame.js.map +1 -0
  30. package/lib/card/ui/CopyTableButton.d.ts +37 -0
  31. package/lib/card/ui/CopyTableButton.d.ts.map +1 -0
  32. package/lib/card/ui/CopyTableButton.js +19 -0
  33. package/lib/card/ui/CopyTableButton.js.map +1 -0
  34. package/lib/card/ui/cardTooltip.d.ts +14 -0
  35. package/lib/card/ui/cardTooltip.d.ts.map +1 -0
  36. package/lib/card/ui/cardTooltip.js +15 -0
  37. package/lib/card/ui/cardTooltip.js.map +1 -0
  38. package/lib/card/ui/embed.d.ts +15 -0
  39. package/lib/card/ui/embed.d.ts.map +1 -0
  40. package/lib/card/ui/embed.js +24 -0
  41. package/lib/card/ui/embed.js.map +1 -0
  42. package/lib/card/ui/fitCardToFrame.d.ts +31 -0
  43. package/lib/card/ui/fitCardToFrame.d.ts.map +1 -0
  44. package/lib/card/ui/fitCardToFrame.js +66 -0
  45. package/lib/card/ui/fitCardToFrame.js.map +1 -0
  46. package/lib/card/ui/holdRoomForPanels.d.ts +16 -0
  47. package/lib/card/ui/holdRoomForPanels.d.ts.map +1 -0
  48. package/lib/card/ui/holdRoomForPanels.js +76 -0
  49. package/lib/card/ui/holdRoomForPanels.js.map +1 -0
  50. package/lib/card/ui/index.d.ts +11 -0
  51. package/lib/card/ui/index.d.ts.map +1 -0
  52. package/lib/card/ui/index.js +7 -0
  53. package/lib/card/ui/index.js.map +1 -0
  54. package/lib/card/ui/openPanels.d.ts +25 -0
  55. package/lib/card/ui/openPanels.d.ts.map +1 -0
  56. package/lib/card/ui/openPanels.js +85 -0
  57. package/lib/card/ui/openPanels.js.map +1 -0
  58. package/lib/card.d.ts +13 -0
  59. package/lib/card.d.ts.map +1 -0
  60. package/lib/card.js +13 -0
  61. package/lib/card.js.map +1 -0
  62. package/lib/conformers.d.ts +1 -0
  63. package/lib/conformers.d.ts.map +1 -1
  64. package/lib/conformers.js +1 -0
  65. package/lib/conformers.js.map +1 -1
  66. package/lib/core.d.ts +4 -0
  67. package/lib/core.d.ts.map +1 -1
  68. package/lib/core.js +5 -0
  69. package/lib/core.js.map +1 -1
  70. package/lib/fetch/core/apiError.d.ts +56 -0
  71. package/lib/fetch/core/apiError.d.ts.map +1 -0
  72. package/lib/fetch/core/apiError.js +43 -0
  73. package/lib/fetch/core/apiError.js.map +1 -0
  74. package/lib/fetch/core/fetchJson.d.ts +47 -0
  75. package/lib/fetch/core/fetchJson.d.ts.map +1 -0
  76. package/lib/fetch/core/fetchJson.js +109 -0
  77. package/lib/fetch/core/fetchJson.js.map +1 -0
  78. package/lib/fetch/core/index.d.ts +5 -0
  79. package/lib/fetch/core/index.d.ts.map +1 -0
  80. package/lib/fetch/core/index.js +3 -0
  81. package/lib/fetch/core/index.js.map +1 -0
  82. package/lib/formula/core/formulaText.d.ts +46 -0
  83. package/lib/formula/core/formulaText.d.ts.map +1 -0
  84. package/lib/formula/core/formulaText.js +74 -0
  85. package/lib/formula/core/formulaText.js.map +1 -0
  86. package/lib/formula/core/index.d.ts +6 -0
  87. package/lib/formula/core/index.d.ts.map +1 -0
  88. package/lib/formula/core/index.js +4 -0
  89. package/lib/formula/core/index.js.map +1 -0
  90. package/lib/formula/core/normalizeFormula.d.ts +22 -0
  91. package/lib/formula/core/normalizeFormula.d.ts.map +1 -0
  92. package/lib/formula/core/normalizeFormula.js +46 -0
  93. package/lib/formula/core/normalizeFormula.js.map +1 -0
  94. package/lib/formula/core/readFormula.d.ts +73 -0
  95. package/lib/formula/core/readFormula.d.ts.map +1 -0
  96. package/lib/formula/core/readFormula.js +132 -0
  97. package/lib/formula/core/readFormula.js.map +1 -0
  98. package/lib/formula/ui/CopyableFormula.d.ts +31 -0
  99. package/lib/formula/ui/CopyableFormula.d.ts.map +1 -0
  100. package/lib/formula/ui/CopyableFormula.js +19 -0
  101. package/lib/formula/ui/CopyableFormula.js.map +1 -0
  102. package/lib/formula/ui/FormulaInput.d.ts +29 -0
  103. package/lib/formula/ui/FormulaInput.d.ts.map +1 -0
  104. package/lib/formula/ui/FormulaInput.js +16 -0
  105. package/lib/formula/ui/FormulaInput.js.map +1 -0
  106. package/lib/formula/ui/QuestionFormula.d.ts +14 -0
  107. package/lib/formula/ui/QuestionFormula.d.ts.map +1 -0
  108. package/lib/formula/ui/QuestionFormula.js +13 -0
  109. package/lib/formula/ui/QuestionFormula.js.map +1 -0
  110. package/lib/formula/ui/index.d.ts +7 -0
  111. package/lib/formula/ui/index.d.ts.map +1 -0
  112. package/lib/formula/ui/index.js +4 -0
  113. package/lib/formula/ui/index.js.map +1 -0
  114. package/lib/formula.d.ts +11 -0
  115. package/lib/formula.d.ts.map +1 -0
  116. package/lib/formula.js +11 -0
  117. package/lib/formula.js.map +1 -0
  118. package/lib/hooks/ui/index.d.ts +1 -0
  119. package/lib/hooks/ui/index.d.ts.map +1 -1
  120. package/lib/hooks/ui/index.js.map +1 -1
  121. package/lib/hooks/ui/keyTargets.d.ts +4 -2
  122. package/lib/hooks/ui/keyTargets.d.ts.map +1 -1
  123. package/lib/hooks/ui/keyTargets.js +5 -3
  124. package/lib/hooks/ui/keyTargets.js.map +1 -1
  125. package/lib/hooks/ui/useAsync.d.ts +20 -5
  126. package/lib/hooks/ui/useAsync.d.ts.map +1 -1
  127. package/lib/hooks/ui/useAsync.js +29 -14
  128. package/lib/hooks/ui/useAsync.js.map +1 -1
  129. package/lib/i18n/core/chromeCatalog.d.ts +1 -1
  130. package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
  131. package/lib/ir/core/analysisSpectra.d.ts +23 -6
  132. package/lib/ir/core/analysisSpectra.d.ts.map +1 -1
  133. package/lib/ir/core/analysisSpectra.js.map +1 -1
  134. package/lib/ir/core/bandLabelPlan.d.ts.map +1 -1
  135. package/lib/ir/core/bandLabelPlan.js +11 -6
  136. package/lib/ir/core/bandLabelPlan.js.map +1 -1
  137. package/lib/ir/core/index.d.ts +13 -9
  138. package/lib/ir/core/index.d.ts.map +1 -1
  139. package/lib/ir/core/index.js +9 -6
  140. package/lib/ir/core/index.js.map +1 -1
  141. package/lib/ir/core/irBand.d.ts +45 -14
  142. package/lib/ir/core/irBand.d.ts.map +1 -1
  143. package/lib/ir/core/irBand.js +28 -6
  144. package/lib/ir/core/irBand.js.map +1 -1
  145. package/lib/ir/core/irCommands.d.ts +11 -0
  146. package/lib/ir/core/irCommands.d.ts.map +1 -1
  147. package/lib/ir/core/irCommands.js +11 -1
  148. package/lib/ir/core/irCommands.js.map +1 -1
  149. package/lib/ir/core/irDomain.d.ts +4 -3
  150. package/lib/ir/core/irDomain.d.ts.map +1 -1
  151. package/lib/ir/core/irDomain.js +10 -7
  152. package/lib/ir/core/irDomain.js.map +1 -1
  153. package/lib/ir/core/irFormat.d.ts +14 -2
  154. package/lib/ir/core/irFormat.d.ts.map +1 -1
  155. package/lib/ir/core/irFormat.js +33 -4
  156. package/lib/ir/core/irFormat.js.map +1 -1
  157. package/lib/ir/core/irMode.d.ts +35 -8
  158. package/lib/ir/core/irMode.d.ts.map +1 -1
  159. package/lib/ir/core/irMode.js +38 -10
  160. package/lib/ir/core/irMode.js.map +1 -1
  161. package/lib/ir/core/irReducer.d.ts +0 -28
  162. package/lib/ir/core/irReducer.d.ts.map +1 -1
  163. package/lib/ir/core/irReducer.js +1 -24
  164. package/lib/ir/core/irReducer.js.map +1 -1
  165. package/lib/ir/core/irSpectrum.d.ts +52 -26
  166. package/lib/ir/core/irSpectrum.d.ts.map +1 -1
  167. package/lib/ir/core/irSpectrum.js +21 -15
  168. package/lib/ir/core/irSpectrum.js.map +1 -1
  169. package/lib/ir/core/irState.d.ts +40 -2
  170. package/lib/ir/core/irState.d.ts.map +1 -1
  171. package/lib/ir/core/irState.js +38 -1
  172. package/lib/ir/core/irState.js.map +1 -1
  173. package/lib/ir/core/irTechnique.d.ts +94 -0
  174. package/lib/ir/core/irTechnique.d.ts.map +1 -0
  175. package/lib/ir/core/irTechnique.js +87 -0
  176. package/lib/ir/core/irTechnique.js.map +1 -0
  177. package/lib/ir/core/irTechniqueCommands.d.ts +26 -0
  178. package/lib/ir/core/irTechniqueCommands.d.ts.map +1 -0
  179. package/lib/ir/core/irTechniqueCommands.js +68 -0
  180. package/lib/ir/core/irTechniqueCommands.js.map +1 -0
  181. package/lib/ir/core/pickBands.d.ts +6 -5
  182. package/lib/ir/core/pickBands.d.ts.map +1 -1
  183. package/lib/ir/core/pickBands.js +49 -26
  184. package/lib/ir/core/pickBands.js.map +1 -1
  185. package/lib/ir/core/ramanBands.d.ts +30 -0
  186. package/lib/ir/core/ramanBands.d.ts.map +1 -0
  187. package/lib/ir/core/ramanBands.js +83 -0
  188. package/lib/ir/core/ramanBands.js.map +1 -0
  189. package/lib/ir/core/spectrumJcamp.d.ts +10 -5
  190. package/lib/ir/core/spectrumJcamp.d.ts.map +1 -1
  191. package/lib/ir/core/spectrumJcamp.js +63 -15
  192. package/lib/ir/core/spectrumJcamp.js.map +1 -1
  193. package/lib/ir/core/toIrSpectrum.d.ts.map +1 -1
  194. package/lib/ir/core/toIrSpectrum.js +17 -2
  195. package/lib/ir/core/toIrSpectrum.js.map +1 -1
  196. package/lib/ir/ui/BandRow.d.ts +30 -0
  197. package/lib/ir/ui/BandRow.d.ts.map +1 -0
  198. package/lib/ir/ui/BandRow.js +42 -0
  199. package/lib/ir/ui/BandRow.js.map +1 -0
  200. package/lib/ir/ui/BandsPanel.d.ts +4 -0
  201. package/lib/ir/ui/BandsPanel.d.ts.map +1 -1
  202. package/lib/ir/ui/BandsPanel.js +14 -59
  203. package/lib/ir/ui/BandsPanel.js.map +1 -1
  204. package/lib/ir/ui/IrAboutDialog.d.ts +7 -0
  205. package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -1
  206. package/lib/ir/ui/IrAboutDialog.js +16 -3
  207. package/lib/ir/ui/IrAboutDialog.js.map +1 -1
  208. package/lib/ir/ui/IrCanvas.d.ts.map +1 -1
  209. package/lib/ir/ui/IrCanvas.js +2 -2
  210. package/lib/ir/ui/IrCanvas.js.map +1 -1
  211. package/lib/ir/ui/IrChart.d.ts +2 -1
  212. package/lib/ir/ui/IrChart.d.ts.map +1 -1
  213. package/lib/ir/ui/IrChart.js +18 -21
  214. package/lib/ir/ui/IrChart.js.map +1 -1
  215. package/lib/ir/ui/IrCommandProvider.d.ts +7 -0
  216. package/lib/ir/ui/IrCommandProvider.d.ts.map +1 -1
  217. package/lib/ir/ui/IrCommandProvider.js +2 -2
  218. package/lib/ir/ui/IrCommandProvider.js.map +1 -1
  219. package/lib/ir/ui/IrCommandTooltip.d.ts +7 -0
  220. package/lib/ir/ui/IrCommandTooltip.d.ts.map +1 -1
  221. package/lib/ir/ui/IrCommandTooltip.js +3 -2
  222. package/lib/ir/ui/IrCommandTooltip.js.map +1 -1
  223. package/lib/ir/ui/IrDocumentationDialog.d.ts +8 -1
  224. package/lib/ir/ui/IrDocumentationDialog.d.ts.map +1 -1
  225. package/lib/ir/ui/IrDocumentationDialog.js +30 -7
  226. package/lib/ir/ui/IrDocumentationDialog.js.map +1 -1
  227. package/lib/ir/ui/IrEditor.d.ts +3 -1
  228. package/lib/ir/ui/IrEditor.d.ts.map +1 -1
  229. package/lib/ir/ui/IrEditor.js +3 -20
  230. package/lib/ir/ui/IrEditor.js.map +1 -1
  231. package/lib/ir/ui/IrHeader.d.ts.map +1 -1
  232. package/lib/ir/ui/IrHeader.js +5 -1
  233. package/lib/ir/ui/IrHeader.js.map +1 -1
  234. package/lib/ir/ui/IrLogo.d.ts +11 -3
  235. package/lib/ir/ui/IrLogo.d.ts.map +1 -1
  236. package/lib/ir/ui/IrLogo.js +14 -5
  237. package/lib/ir/ui/IrLogo.js.map +1 -1
  238. package/lib/ir/ui/IrShell.d.ts.map +1 -1
  239. package/lib/ir/ui/IrShell.js +23 -56
  240. package/lib/ir/ui/IrShell.js.map +1 -1
  241. package/lib/ir/ui/IrStatusBar.d.ts +3 -2
  242. package/lib/ir/ui/IrStatusBar.d.ts.map +1 -1
  243. package/lib/ir/ui/IrStatusBar.js +14 -9
  244. package/lib/ir/ui/IrStatusBar.js.map +1 -1
  245. package/lib/ir/ui/IrToolbar.d.ts +3 -0
  246. package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
  247. package/lib/ir/ui/IrToolbar.js +10 -3
  248. package/lib/ir/ui/IrToolbar.js.map +1 -1
  249. package/lib/ir/ui/IrTraces.d.ts +4 -1
  250. package/lib/ir/ui/IrTraces.d.ts.map +1 -1
  251. package/lib/ir/ui/IrTraces.js +2 -0
  252. package/lib/ir/ui/IrTraces.js.map +1 -1
  253. package/lib/ir/ui/RamanEditor.d.ts +46 -0
  254. package/lib/ir/ui/RamanEditor.d.ts.map +1 -0
  255. package/lib/ir/ui/RamanEditor.js +17 -0
  256. package/lib/ir/ui/RamanEditor.js.map +1 -0
  257. package/lib/ir/ui/SpectraPanel.d.ts.map +1 -1
  258. package/lib/ir/ui/SpectraPanel.js +2 -2
  259. package/lib/ir/ui/SpectraPanel.js.map +1 -1
  260. package/lib/ir/ui/SpectrumRow.d.ts +7 -0
  261. package/lib/ir/ui/SpectrumRow.d.ts.map +1 -1
  262. package/lib/ir/ui/SpectrumRow.js +4 -5
  263. package/lib/ir/ui/SpectrumRow.js.map +1 -1
  264. package/lib/ir/ui/VibrationalEditor.d.ts +48 -0
  265. package/lib/ir/ui/VibrationalEditor.d.ts.map +1 -0
  266. package/lib/ir/ui/VibrationalEditor.js +31 -0
  267. package/lib/ir/ui/VibrationalEditor.js.map +1 -0
  268. package/lib/ir/ui/bandsTsv.d.ts +19 -0
  269. package/lib/ir/ui/bandsTsv.d.ts.map +1 -0
  270. package/lib/ir/ui/bandsTsv.js +38 -0
  271. package/lib/ir/ui/bandsTsv.js.map +1 -0
  272. package/lib/ir/ui/irChartProps.d.ts +14 -4
  273. package/lib/ir/ui/irChartProps.d.ts.map +1 -1
  274. package/lib/ir/ui/irChartProps.js +3 -2
  275. package/lib/ir/ui/irChartProps.js.map +1 -1
  276. package/lib/ir/ui/irCommandContext.d.ts +8 -0
  277. package/lib/ir/ui/irCommandContext.d.ts.map +1 -1
  278. package/lib/ir/ui/irCommandContext.js +14 -3
  279. package/lib/ir/ui/irCommandContext.js.map +1 -1
  280. package/lib/ir/ui/useIrEditor.d.ts +3 -3
  281. package/lib/ir/ui/useIrEditor.d.ts.map +1 -1
  282. package/lib/ir/ui/useIrEditor.js +13 -4
  283. package/lib/ir/ui/useIrEditor.js.map +1 -1
  284. package/lib/ir/ui/useIrHandle.d.ts +14 -0
  285. package/lib/ir/ui/useIrHandle.d.ts.map +1 -0
  286. package/lib/ir/ui/useIrHandle.js +39 -0
  287. package/lib/ir/ui/useIrHandle.js.map +1 -0
  288. package/lib/ir/ui/useIrText.d.ts +40 -0
  289. package/lib/ir/ui/useIrText.d.ts.map +1 -0
  290. package/lib/ir/ui/useIrText.js +118 -0
  291. package/lib/ir/ui/useIrText.js.map +1 -0
  292. package/lib/ir/ui/useIrZoom.d.ts +7 -0
  293. package/lib/ir/ui/useIrZoom.d.ts.map +1 -1
  294. package/lib/ir/ui/useIrZoom.js +5 -4
  295. package/lib/ir/ui/useIrZoom.js.map +1 -1
  296. package/lib/ir/ui/useValueAxisZoom.d.ts +20 -0
  297. package/lib/ir/ui/useValueAxisZoom.d.ts.map +1 -0
  298. package/lib/ir/ui/useValueAxisZoom.js +54 -0
  299. package/lib/ir/ui/useValueAxisZoom.js.map +1 -0
  300. package/lib/ir.d.ts +3 -0
  301. package/lib/ir.d.ts.map +1 -1
  302. package/lib/ir.js +3 -0
  303. package/lib/ir.js.map +1 -1
  304. package/lib/locales/de.json +57 -1
  305. package/lib/locales/en.json +57 -1
  306. package/lib/locales/es.json +57 -1
  307. package/lib/locales/fr.json +57 -1
  308. package/lib/locales/it.json +57 -1
  309. package/lib/moleculesClient/core/index.d.ts +5 -0
  310. package/lib/moleculesClient/core/index.d.ts.map +1 -0
  311. package/lib/moleculesClient/core/index.js +3 -0
  312. package/lib/moleculesClient/core/index.js.map +1 -0
  313. package/lib/moleculesClient/core/moleculesClient.d.ts +12 -0
  314. package/lib/moleculesClient/core/moleculesClient.d.ts.map +1 -0
  315. package/lib/moleculesClient/core/moleculesClient.js +105 -0
  316. package/lib/moleculesClient/core/moleculesClient.js.map +1 -0
  317. package/lib/moleculesClient/core/moleculesClientApi.d.ts +100 -0
  318. package/lib/moleculesClient/core/moleculesClientApi.d.ts.map +1 -0
  319. package/lib/moleculesClient/core/moleculesClientApi.js +20 -0
  320. package/lib/moleculesClient/core/moleculesClientApi.js.map +1 -0
  321. package/lib/moleculesClient/core/moleculesTypes.d.ts +154 -0
  322. package/lib/moleculesClient/core/moleculesTypes.d.ts.map +1 -0
  323. package/lib/moleculesClient/core/moleculesTypes.js +2 -0
  324. package/lib/moleculesClient/core/moleculesTypes.js.map +1 -0
  325. package/lib/moleculesClient/core/requestRetry.d.ts +50 -0
  326. package/lib/moleculesClient/core/requestRetry.d.ts.map +1 -0
  327. package/lib/moleculesClient/core/requestRetry.js +108 -0
  328. package/lib/moleculesClient/core/requestRetry.js.map +1 -0
  329. package/lib/molstar/core/camera.d.ts +2 -1
  330. package/lib/molstar/core/camera.d.ts.map +1 -1
  331. package/lib/molstar/core/camera.js +3 -2
  332. package/lib/molstar/core/camera.js.map +1 -1
  333. package/lib/molstar/core/framing.d.ts +102 -0
  334. package/lib/molstar/core/framing.d.ts.map +1 -0
  335. package/lib/molstar/core/framing.js +120 -0
  336. package/lib/molstar/core/framing.js.map +1 -0
  337. package/lib/molstar/core/hover.d.ts +16 -0
  338. package/lib/molstar/core/hover.d.ts.map +1 -1
  339. package/lib/molstar/core/hover.js +14 -0
  340. package/lib/molstar/core/hover.js.map +1 -1
  341. package/lib/molstar/core/index.d.ts +4 -1
  342. package/lib/molstar/core/index.d.ts.map +1 -1
  343. package/lib/molstar/core/index.js +2 -1
  344. package/lib/molstar/core/index.js.map +1 -1
  345. package/lib/pedagogy/core/answers.d.ts +46 -0
  346. package/lib/pedagogy/core/answers.d.ts.map +1 -0
  347. package/lib/pedagogy/core/answers.js +77 -0
  348. package/lib/pedagogy/core/answers.js.map +1 -0
  349. package/lib/pedagogy/core/attempts.d.ts +86 -0
  350. package/lib/pedagogy/core/attempts.d.ts.map +1 -0
  351. package/lib/pedagogy/core/attempts.js +117 -0
  352. package/lib/pedagogy/core/attempts.js.map +1 -0
  353. package/lib/pedagogy/core/index.d.ts +8 -0
  354. package/lib/pedagogy/core/index.d.ts.map +1 -1
  355. package/lib/pedagogy/core/index.js +4 -0
  356. package/lib/pedagogy/core/index.js.map +1 -1
  357. package/lib/pedagogy/core/progressController.d.ts +64 -0
  358. package/lib/pedagogy/core/progressController.d.ts.map +1 -0
  359. package/lib/pedagogy/core/progressController.js +56 -0
  360. package/lib/pedagogy/core/progressController.js.map +1 -0
  361. package/lib/pedagogy/core/seed.d.ts +96 -0
  362. package/lib/pedagogy/core/seed.d.ts.map +1 -0
  363. package/lib/pedagogy/core/seed.js +128 -0
  364. package/lib/pedagogy/core/seed.js.map +1 -0
  365. package/lib/pedagogy/core/series.d.ts +77 -0
  366. package/lib/pedagogy/core/series.d.ts.map +1 -0
  367. package/lib/pedagogy/core/series.js +10 -0
  368. package/lib/pedagogy/core/series.js.map +1 -0
  369. package/lib/pedagogy/ui/AnswerFields.d.ts +21 -0
  370. package/lib/pedagogy/ui/AnswerFields.d.ts.map +1 -0
  371. package/lib/pedagogy/ui/AnswerFields.js +24 -0
  372. package/lib/pedagogy/ui/AnswerFields.js.map +1 -0
  373. package/lib/pedagogy/ui/ExerciseList.d.ts +82 -0
  374. package/lib/pedagogy/ui/ExerciseList.d.ts.map +1 -0
  375. package/lib/pedagogy/ui/ExerciseList.js +53 -0
  376. package/lib/pedagogy/ui/ExerciseList.js.map +1 -0
  377. package/lib/pedagogy/ui/ExerciseSeries.d.ts +95 -0
  378. package/lib/pedagogy/ui/ExerciseSeries.d.ts.map +1 -0
  379. package/lib/pedagogy/ui/ExerciseSeries.js +74 -0
  380. package/lib/pedagogy/ui/ExerciseSeries.js.map +1 -0
  381. package/lib/pedagogy/ui/QuestionCard.d.ts +64 -0
  382. package/lib/pedagogy/ui/QuestionCard.d.ts.map +1 -0
  383. package/lib/pedagogy/ui/QuestionCard.js +73 -0
  384. package/lib/pedagogy/ui/QuestionCard.js.map +1 -0
  385. package/lib/pedagogy/ui/index.d.ts +10 -0
  386. package/lib/pedagogy/ui/index.d.ts.map +1 -1
  387. package/lib/pedagogy/ui/index.js +6 -0
  388. package/lib/pedagogy/ui/index.js.map +1 -1
  389. package/lib/pedagogy/ui/seriesCounts.d.ts +17 -0
  390. package/lib/pedagogy/ui/seriesCounts.d.ts.map +1 -0
  391. package/lib/pedagogy/ui/seriesCounts.js +27 -0
  392. package/lib/pedagogy/ui/seriesCounts.js.map +1 -0
  393. package/lib/pedagogy/ui/seriesParts.d.ts +55 -0
  394. package/lib/pedagogy/ui/seriesParts.d.ts.map +1 -0
  395. package/lib/pedagogy/ui/seriesParts.js +38 -0
  396. package/lib/pedagogy/ui/seriesParts.js.map +1 -0
  397. package/lib/pedagogy/ui/useAttemptRecords.d.ts +10 -0
  398. package/lib/pedagogy/ui/useAttemptRecords.d.ts.map +1 -0
  399. package/lib/pedagogy/ui/useAttemptRecords.js +11 -0
  400. package/lib/pedagogy/ui/useAttemptRecords.js.map +1 -0
  401. package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
  402. package/lib/periodic/ui/PeriodicTable.js +6 -3
  403. package/lib/periodic/ui/PeriodicTable.js.map +1 -1
  404. package/lib/property/core/copyableText.d.ts +14 -0
  405. package/lib/property/core/copyableText.d.ts.map +1 -0
  406. package/lib/property/core/copyableText.js +21 -0
  407. package/lib/property/core/copyableText.js.map +1 -0
  408. package/lib/property/core/index.d.ts +2 -0
  409. package/lib/property/core/index.d.ts.map +1 -0
  410. package/lib/property/core/index.js +2 -0
  411. package/lib/property/core/index.js.map +1 -0
  412. package/lib/property/ui/PropertyTable.d.ts +43 -0
  413. package/lib/property/ui/PropertyTable.d.ts.map +1 -0
  414. package/lib/property/ui/PropertyTable.js +19 -0
  415. package/lib/property/ui/PropertyTable.js.map +1 -0
  416. package/lib/property/ui/index.d.ts +3 -0
  417. package/lib/property/ui/index.d.ts.map +1 -0
  418. package/lib/property/ui/index.js +2 -0
  419. package/lib/property/ui/index.js.map +1 -0
  420. package/lib/raman.d.ts +16 -0
  421. package/lib/raman.d.ts.map +1 -0
  422. package/lib/raman.js +12 -0
  423. package/lib/raman.js.map +1 -0
  424. package/lib/router/core/history.d.ts +24 -3
  425. package/lib/router/core/history.d.ts.map +1 -1
  426. package/lib/router/core/history.js +55 -7
  427. package/lib/router/core/history.js.map +1 -1
  428. package/lib/router/core/index.d.ts +3 -3
  429. package/lib/router/core/index.d.ts.map +1 -1
  430. package/lib/router/core/index.js +2 -2
  431. package/lib/router/core/index.js.map +1 -1
  432. package/lib/router/core/languageRoute.d.ts +61 -0
  433. package/lib/router/core/languageRoute.d.ts.map +1 -0
  434. package/lib/router/core/languageRoute.js +96 -0
  435. package/lib/router/core/languageRoute.js.map +1 -0
  436. package/lib/router/core/siteAddresses.d.ts +23 -0
  437. package/lib/router/core/siteAddresses.d.ts.map +1 -1
  438. package/lib/router/core/siteAddresses.js +26 -0
  439. package/lib/router/core/siteAddresses.js.map +1 -1
  440. package/lib/router/core/tabRouter.d.ts +2 -108
  441. package/lib/router/core/tabRouter.d.ts.map +1 -1
  442. package/lib/router/core/tabRouter.js +38 -5
  443. package/lib/router/core/tabRouter.js.map +1 -1
  444. package/lib/router/core/tabRouterTypes.d.ts +154 -0
  445. package/lib/router/core/tabRouterTypes.d.ts.map +1 -0
  446. package/lib/router/core/tabRouterTypes.js +2 -0
  447. package/lib/router/core/tabRouterTypes.js.map +1 -0
  448. package/lib/seo/core/fitDescription.d.ts +40 -0
  449. package/lib/seo/core/fitDescription.d.ts.map +1 -0
  450. package/lib/seo/core/fitDescription.js +45 -0
  451. package/lib/seo/core/fitDescription.js.map +1 -0
  452. package/lib/seo/core/index.d.ts +7 -0
  453. package/lib/seo/core/index.d.ts.map +1 -1
  454. package/lib/seo/core/index.js +4 -0
  455. package/lib/seo/core/index.js.map +1 -1
  456. package/lib/seo/core/limits.d.ts +24 -0
  457. package/lib/seo/core/limits.d.ts.map +1 -0
  458. package/lib/seo/core/limits.js +24 -0
  459. package/lib/seo/core/limits.js.map +1 -0
  460. package/lib/seo/core/pageContent.d.ts +25 -0
  461. package/lib/seo/core/pageContent.d.ts.map +1 -0
  462. package/lib/seo/core/pageContent.js +25 -0
  463. package/lib/seo/core/pageContent.js.map +1 -0
  464. package/lib/seo/core/plainDescription.d.ts.map +1 -1
  465. package/lib/seo/core/plainDescription.js +3 -2
  466. package/lib/seo/core/plainDescription.js.map +1 -1
  467. package/lib/seo/core/routeProblems.d.ts.map +1 -1
  468. package/lib/seo/core/routeProblems.js +1 -6
  469. package/lib/seo/core/routeProblems.js.map +1 -1
  470. package/lib/seo/core/routeTable.d.ts +31 -0
  471. package/lib/seo/core/routeTable.d.ts.map +1 -0
  472. package/lib/seo/core/routeTable.js +96 -0
  473. package/lib/seo/core/routeTable.js.map +1 -0
  474. package/lib/seo/vite/index.d.ts +2 -0
  475. package/lib/seo/vite/index.d.ts.map +1 -1
  476. package/lib/seo/vite/index.js +1 -0
  477. package/lib/seo/vite/index.js.map +1 -1
  478. package/lib/seo/vite/prerender.d.ts +10 -0
  479. package/lib/seo/vite/prerender.d.ts.map +1 -1
  480. package/lib/seo/vite/prerender.js +12 -1
  481. package/lib/seo/vite/prerender.js.map +1 -1
  482. package/lib/seo/vite/routeTable.d.ts +40 -0
  483. package/lib/seo/vite/routeTable.d.ts.map +1 -0
  484. package/lib/seo/vite/routeTable.js +44 -0
  485. package/lib/seo/vite/routeTable.js.map +1 -0
  486. package/lib/server/answerAddresses.d.ts +51 -0
  487. package/lib/server/answerAddresses.d.ts.map +1 -0
  488. package/lib/server/answerAddresses.js +72 -0
  489. package/lib/server/answerAddresses.js.map +1 -0
  490. package/lib/server/cardMeta.d.ts +57 -0
  491. package/lib/server/cardMeta.d.ts.map +1 -0
  492. package/lib/server/cardMeta.js +52 -0
  493. package/lib/server/cardMeta.js.map +1 -0
  494. package/lib/server/config.d.ts +72 -0
  495. package/lib/server/config.d.ts.map +1 -0
  496. package/lib/server/config.js +67 -0
  497. package/lib/server/config.js.map +1 -0
  498. package/lib/server/envNumber.d.ts +35 -0
  499. package/lib/server/envNumber.d.ts.map +1 -0
  500. package/lib/server/envNumber.js +42 -0
  501. package/lib/server/envNumber.js.map +1 -0
  502. package/lib/server/healthRoute.d.ts +26 -0
  503. package/lib/server/healthRoute.d.ts.map +1 -0
  504. package/lib/server/healthRoute.js +22 -0
  505. package/lib/server/healthRoute.js.map +1 -0
  506. package/lib/server/listenSite.d.ts +38 -0
  507. package/lib/server/listenSite.d.ts.map +1 -0
  508. package/lib/server/listenSite.js +60 -0
  509. package/lib/server/listenSite.js.map +1 -0
  510. package/lib/server/mcpServer.d.ts +8 -0
  511. package/lib/server/mcpServer.d.ts.map +1 -0
  512. package/lib/server/mcpServer.js +11 -0
  513. package/lib/server/mcpServer.js.map +1 -0
  514. package/lib/server/repositoryVersion.d.ts +16 -0
  515. package/lib/server/repositoryVersion.d.ts.map +1 -0
  516. package/lib/server/repositoryVersion.js +33 -0
  517. package/lib/server/repositoryVersion.js.map +1 -0
  518. package/lib/server/routeOptions.d.ts +23 -0
  519. package/lib/server/routeOptions.d.ts.map +1 -0
  520. package/lib/server/routeOptions.js +20 -0
  521. package/lib/server/routeOptions.js.map +1 -0
  522. package/lib/server/routeTable.d.ts +14 -0
  523. package/lib/server/routeTable.d.ts.map +1 -0
  524. package/lib/server/routeTable.js +32 -0
  525. package/lib/server/routeTable.js.map +1 -0
  526. package/lib/server/siteView.d.ts +29 -0
  527. package/lib/server/siteView.d.ts.map +1 -0
  528. package/lib/server/siteView.js +21 -0
  529. package/lib/server/siteView.js.map +1 -0
  530. package/lib/server/spaPages.d.ts +32 -0
  531. package/lib/server/spaPages.d.ts.map +1 -0
  532. package/lib/server/spaPages.js +126 -0
  533. package/lib/server/spaPages.js.map +1 -0
  534. package/lib/server/spaSite.d.ts +30 -0
  535. package/lib/server/spaSite.d.ts.map +1 -0
  536. package/lib/server/spaSite.js +170 -0
  537. package/lib/server/spaSite.js.map +1 -0
  538. package/lib/server/spaSiteOptions.d.ts +126 -0
  539. package/lib/server/spaSiteOptions.d.ts.map +1 -0
  540. package/lib/server/spaSiteOptions.js +2 -0
  541. package/lib/server/spaSiteOptions.js.map +1 -0
  542. package/lib/server/staticSite.d.ts +9 -0
  543. package/lib/server/staticSite.d.ts.map +1 -1
  544. package/lib/server/staticSite.js +41 -19
  545. package/lib/server/staticSite.js.map +1 -1
  546. package/lib/server/toolSiteServer.d.ts +77 -0
  547. package/lib/server/toolSiteServer.d.ts.map +1 -0
  548. package/lib/server/toolSiteServer.js +58 -0
  549. package/lib/server/toolSiteServer.js.map +1 -0
  550. package/lib/server/trustProxy.d.ts +20 -0
  551. package/lib/server/trustProxy.d.ts.map +1 -0
  552. package/lib/server/trustProxy.js +32 -0
  553. package/lib/server/trustProxy.js.map +1 -0
  554. package/lib/server/types.d.ts +13 -0
  555. package/lib/server/types.d.ts.map +1 -0
  556. package/lib/server/types.js +2 -0
  557. package/lib/server/types.js.map +1 -0
  558. package/lib/server.d.ts +22 -0
  559. package/lib/server.d.ts.map +1 -1
  560. package/lib/server.js +12 -0
  561. package/lib/server.js.map +1 -1
  562. package/lib/share/core/config.d.ts +18 -0
  563. package/lib/share/core/config.d.ts.map +1 -1
  564. package/lib/share/core/config.js +33 -2
  565. package/lib/share/core/config.js.map +1 -1
  566. package/lib/share/core/index.d.ts +3 -1
  567. package/lib/share/core/index.d.ts.map +1 -1
  568. package/lib/share/core/index.js +2 -1
  569. package/lib/share/core/index.js.map +1 -1
  570. package/lib/share/core/keySetParam.d.ts +40 -0
  571. package/lib/share/core/keySetParam.d.ts.map +1 -0
  572. package/lib/share/core/keySetParam.js +60 -0
  573. package/lib/share/core/keySetParam.js.map +1 -0
  574. package/lib/share/core/vocabulary.d.ts +8 -0
  575. package/lib/share/core/vocabulary.d.ts.map +1 -1
  576. package/lib/shell/ui/ShareControl.d.ts +75 -0
  577. package/lib/shell/ui/ShareControl.d.ts.map +1 -0
  578. package/lib/shell/ui/ShareControl.js +40 -0
  579. package/lib/shell/ui/ShareControl.js.map +1 -0
  580. package/lib/shell/ui/ShellFrame.d.ts +14 -0
  581. package/lib/shell/ui/ShellFrame.d.ts.map +1 -0
  582. package/lib/shell/ui/ShellFrame.js +45 -0
  583. package/lib/shell/ui/ShellFrame.js.map +1 -0
  584. package/lib/shell/ui/SiteShell.d.ts +251 -0
  585. package/lib/shell/ui/SiteShell.d.ts.map +1 -0
  586. package/lib/shell/ui/SiteShell.js +39 -0
  587. package/lib/shell/ui/SiteShell.js.map +1 -0
  588. package/lib/shell/ui/index.d.ts +5 -0
  589. package/lib/shell/ui/index.d.ts.map +1 -0
  590. package/lib/shell/ui/index.js +3 -0
  591. package/lib/shell/ui/index.js.map +1 -0
  592. package/lib/state/core/index.d.ts +1 -0
  593. package/lib/state/core/index.d.ts.map +1 -1
  594. package/lib/state/core/index.js.map +1 -1
  595. package/lib/state/core/legacyEntries.d.ts +30 -0
  596. package/lib/state/core/legacyEntries.d.ts.map +1 -0
  597. package/lib/state/core/legacyEntries.js +51 -0
  598. package/lib/state/core/legacyEntries.js.map +1 -0
  599. package/lib/state/core/persistBucket.d.ts +26 -2
  600. package/lib/state/core/persistBucket.d.ts.map +1 -1
  601. package/lib/state/core/persistBucket.js +26 -9
  602. package/lib/state/core/persistBucket.js.map +1 -1
  603. package/lib/state/core/persistSignalBucket.d.ts +26 -0
  604. package/lib/state/core/persistSignalBucket.d.ts.map +1 -1
  605. package/lib/state/core/persistSignalBucket.js +31 -0
  606. package/lib/state/core/persistSignalBucket.js.map +1 -1
  607. package/lib/state/core/storageEntry.d.ts +15 -0
  608. package/lib/state/core/storageEntry.d.ts.map +1 -1
  609. package/lib/state/core/storageEntry.js +33 -0
  610. package/lib/state/core/storageEntry.js.map +1 -1
  611. package/lib/structure/ui/StructureExportButton.d.ts +27 -0
  612. package/lib/structure/ui/StructureExportButton.d.ts.map +1 -0
  613. package/lib/structure/ui/StructureExportButton.js +21 -0
  614. package/lib/structure/ui/StructureExportButton.js.map +1 -0
  615. package/lib/structure/ui/index.d.ts +4 -0
  616. package/lib/structure/ui/index.d.ts.map +1 -1
  617. package/lib/structure/ui/index.js +2 -0
  618. package/lib/structure/ui/index.js.map +1 -1
  619. package/lib/structure/ui/useStructureDraft.d.ts +32 -0
  620. package/lib/structure/ui/useStructureDraft.d.ts.map +1 -0
  621. package/lib/structure/ui/useStructureDraft.js +20 -0
  622. package/lib/structure/ui/useStructureDraft.js.map +1 -0
  623. package/lib/ui.d.ts +2 -0
  624. package/lib/ui.d.ts.map +1 -1
  625. package/lib/ui.js +2 -0
  626. package/lib/ui.js.map +1 -1
  627. package/lib/worker/core/index.d.ts +1 -1
  628. package/lib/worker/core/index.d.ts.map +1 -1
  629. package/lib/worker/core/messages.d.ts +4 -2
  630. package/lib/worker/core/messages.d.ts.map +1 -1
  631. package/lib/worker/core/messages.js.map +1 -1
  632. package/lib/worker/core/oclResourcesUrl.d.ts +16 -0
  633. package/lib/worker/core/oclResourcesUrl.d.ts.map +1 -0
  634. package/lib/worker/core/oclResourcesUrl.js +19 -0
  635. package/lib/worker/core/oclResourcesUrl.js.map +1 -0
  636. package/lib/worker/core/serveWorkerRequests.d.ts +8 -0
  637. package/lib/worker/core/serveWorkerRequests.d.ts.map +1 -1
  638. package/lib/worker/core/serveWorkerRequests.js +15 -2
  639. package/lib/worker/core/serveWorkerRequests.js.map +1 -1
  640. package/lib/worker/core/workerChannel.d.ts +3 -4
  641. package/lib/worker/core/workerChannel.d.ts.map +1 -1
  642. package/lib/worker/core/workerChannel.js +72 -67
  643. package/lib/worker/core/workerChannel.js.map +1 -1
  644. package/lib/worker/core/workerChannelParts.d.ts +17 -6
  645. package/lib/worker/core/workerChannelParts.d.ts.map +1 -1
  646. package/lib/worker/core/workerChannelParts.js +20 -4
  647. package/lib/worker/core/workerChannelParts.js.map +1 -1
  648. package/lib/worker/core/workerChannelTypes.d.ts +46 -2
  649. package/lib/worker/core/workerChannelTypes.d.ts.map +1 -1
  650. package/lib/worker/core/workerSlot.d.ts +66 -0
  651. package/lib/worker/core/workerSlot.d.ts.map +1 -0
  652. package/lib/worker/core/workerSlot.js +107 -0
  653. package/lib/worker/core/workerSlot.js.map +1 -0
  654. package/package.json +17 -1
  655. package/src/card/core/cardAddress.ts +100 -0
  656. package/src/card/core/cardPageUrl.ts +97 -0
  657. package/src/card/core/index.ts +6 -0
  658. package/src/card/core/panelRoom.ts +66 -0
  659. package/src/card/ui/CardDetailsButton.tsx +104 -0
  660. package/src/card/ui/CardFigure.tsx +86 -0
  661. package/src/card/ui/CardFrame.tsx +46 -0
  662. package/src/card/ui/CopyTableButton.tsx +81 -0
  663. package/src/card/ui/cardTooltip.ts +18 -0
  664. package/src/card/ui/embed.ts +27 -0
  665. package/src/card/ui/fitCardToFrame.ts +76 -0
  666. package/src/card/ui/holdRoomForPanels.ts +83 -0
  667. package/src/card/ui/index.ts +14 -0
  668. package/src/card/ui/openPanels.ts +106 -0
  669. package/src/card.ts +13 -0
  670. package/src/conformers.ts +4 -0
  671. package/src/core.ts +5 -0
  672. package/src/fetch/core/apiError.ts +65 -0
  673. package/src/fetch/core/fetchJson.ts +129 -0
  674. package/src/fetch/core/index.ts +4 -0
  675. package/src/formula/core/formulaText.ts +96 -0
  676. package/src/formula/core/index.ts +20 -0
  677. package/src/formula/core/normalizeFormula.ts +50 -0
  678. package/src/formula/core/readFormula.ts +211 -0
  679. package/src/formula/ui/CopyableFormula.tsx +51 -0
  680. package/src/formula/ui/FormulaInput.tsx +50 -0
  681. package/src/formula/ui/QuestionFormula.tsx +20 -0
  682. package/src/formula/ui/index.ts +6 -0
  683. package/src/formula.ts +11 -0
  684. package/src/hooks/ui/index.ts +1 -0
  685. package/src/hooks/ui/keyTargets.ts +5 -3
  686. package/src/hooks/ui/useAsync.ts +50 -14
  687. package/src/ir/core/analysisSpectra.ts +26 -10
  688. package/src/ir/core/bandLabelPlan.ts +21 -10
  689. package/src/ir/core/index.ts +25 -5
  690. package/src/ir/core/irBand.ts +52 -14
  691. package/src/ir/core/irCommands.ts +15 -1
  692. package/src/ir/core/irDomain.ts +9 -7
  693. package/src/ir/core/irFormat.ts +39 -6
  694. package/src/ir/core/irMode.ts +42 -10
  695. package/src/ir/core/irReducer.ts +1 -49
  696. package/src/ir/core/irSpectrum.ts +59 -30
  697. package/src/ir/core/irState.ts +67 -2
  698. package/src/ir/core/irTechnique.ts +115 -0
  699. package/src/ir/core/irTechniqueCommands.ts +82 -0
  700. package/src/ir/core/pickBands.ts +63 -28
  701. package/src/ir/core/ramanBands.ts +105 -0
  702. package/src/ir/core/spectrumJcamp.ts +65 -16
  703. package/src/ir/core/toIrSpectrum.ts +20 -2
  704. package/src/ir/ui/BandRow.tsx +107 -0
  705. package/src/ir/ui/BandsPanel.tsx +32 -125
  706. package/src/ir/ui/IrAboutDialog.tsx +69 -28
  707. package/src/ir/ui/IrCanvas.tsx +2 -1
  708. package/src/ir/ui/IrChart.tsx +20 -24
  709. package/src/ir/ui/IrCommandProvider.tsx +10 -3
  710. package/src/ir/ui/IrCommandTooltip.tsx +11 -2
  711. package/src/ir/ui/IrDocumentationDialog.tsx +99 -55
  712. package/src/ir/ui/IrEditor.tsx +5 -36
  713. package/src/ir/ui/IrHeader.tsx +10 -3
  714. package/src/ir/ui/IrLogo.tsx +28 -9
  715. package/src/ir/ui/IrShell.tsx +27 -75
  716. package/src/ir/ui/IrStatusBar.tsx +17 -12
  717. package/src/ir/ui/IrToolbar.tsx +26 -15
  718. package/src/ir/ui/IrTraces.tsx +5 -1
  719. package/src/ir/ui/RamanEditor.tsx +53 -0
  720. package/src/ir/ui/SpectraPanel.tsx +2 -1
  721. package/src/ir/ui/SpectrumRow.tsx +14 -5
  722. package/src/ir/ui/VibrationalEditor.tsx +94 -0
  723. package/src/ir/ui/bandsTsv.ts +46 -0
  724. package/src/ir/ui/irChartProps.ts +14 -4
  725. package/src/ir/ui/irCommandContext.tsx +18 -3
  726. package/src/ir/ui/useIrEditor.ts +20 -8
  727. package/src/ir/ui/useIrHandle.ts +51 -0
  728. package/src/ir/ui/useIrText.ts +170 -0
  729. package/src/ir/ui/useIrZoom.ts +12 -3
  730. package/src/ir/ui/useValueAxisZoom.ts +67 -0
  731. package/src/ir.ts +3 -0
  732. package/src/locales/de.json +57 -1
  733. package/src/locales/en.json +57 -1
  734. package/src/locales/es.json +57 -1
  735. package/src/locales/fr.json +57 -1
  736. package/src/locales/it.json +57 -1
  737. package/src/moleculesClient/core/index.ts +19 -0
  738. package/src/moleculesClient/core/moleculesClient.ts +175 -0
  739. package/src/moleculesClient/core/moleculesClientApi.ts +120 -0
  740. package/src/moleculesClient/core/moleculesTypes.ts +163 -0
  741. package/src/moleculesClient/core/requestRetry.ts +118 -0
  742. package/src/molstar/core/camera.ts +3 -2
  743. package/src/molstar/core/framing.ts +200 -0
  744. package/src/molstar/core/hover.ts +26 -0
  745. package/src/molstar/core/index.ts +21 -1
  746. package/src/pedagogy/core/answers.ts +94 -0
  747. package/src/pedagogy/core/attempts.ts +205 -0
  748. package/src/pedagogy/core/index.ts +36 -0
  749. package/src/pedagogy/core/progressController.ts +116 -0
  750. package/src/pedagogy/core/seed.ts +177 -0
  751. package/src/pedagogy/core/series.ts +82 -0
  752. package/src/pedagogy/ui/AnswerFields.tsx +63 -0
  753. package/src/pedagogy/ui/ExerciseList.tsx +202 -0
  754. package/src/pedagogy/ui/ExerciseSeries.tsx +250 -0
  755. package/src/pedagogy/ui/QuestionCard.tsx +231 -0
  756. package/src/pedagogy/ui/index.ts +18 -0
  757. package/src/pedagogy/ui/seriesCounts.ts +34 -0
  758. package/src/pedagogy/ui/seriesParts.tsx +127 -0
  759. package/src/pedagogy/ui/useAttemptRecords.ts +16 -0
  760. package/src/periodic/ui/PeriodicTable.tsx +6 -3
  761. package/src/property/core/copyableText.ts +20 -0
  762. package/src/property/core/index.ts +1 -0
  763. package/src/property/ui/PropertyTable.tsx +83 -0
  764. package/src/property/ui/index.ts +2 -0
  765. package/src/raman.ts +19 -0
  766. package/src/router/core/history.ts +61 -7
  767. package/src/router/core/index.ts +3 -2
  768. package/src/router/core/languageRoute.ts +136 -0
  769. package/src/router/core/siteAddresses.ts +38 -0
  770. package/src/router/core/tabRouter.ts +59 -117
  771. package/src/router/core/tabRouterTypes.ts +158 -0
  772. package/src/seo/core/fitDescription.ts +74 -0
  773. package/src/seo/core/index.ts +17 -0
  774. package/src/seo/core/limits.ts +27 -0
  775. package/src/seo/core/pageContent.ts +42 -0
  776. package/src/seo/core/plainDescription.ts +4 -2
  777. package/src/seo/core/routeProblems.ts +1 -7
  778. package/src/seo/core/routeTable.ts +103 -0
  779. package/src/seo/vite/index.ts +2 -0
  780. package/src/seo/vite/prerender.ts +26 -1
  781. package/src/seo/vite/routeTable.ts +79 -0
  782. package/src/server/answerAddresses.ts +92 -0
  783. package/src/server/cardMeta.ts +88 -0
  784. package/src/server/config.ts +125 -0
  785. package/src/server/envNumber.ts +65 -0
  786. package/src/server/healthRoute.ts +42 -0
  787. package/src/server/listenSite.ts +90 -0
  788. package/src/server/mcpServer.ts +14 -0
  789. package/src/server/repositoryVersion.ts +33 -0
  790. package/src/server/routeOptions.ts +26 -0
  791. package/src/server/routeTable.ts +35 -0
  792. package/src/server/siteView.ts +42 -0
  793. package/src/server/spaPages.ts +179 -0
  794. package/src/server/spaSite.ts +216 -0
  795. package/src/server/spaSiteOptions.ts +133 -0
  796. package/src/server/staticSite.ts +65 -35
  797. package/src/server/toolSiteServer.ts +127 -0
  798. package/src/server/trustProxy.ts +32 -0
  799. package/src/server/types.ts +25 -0
  800. package/src/server.ts +40 -0
  801. package/src/share/core/config.ts +45 -2
  802. package/src/share/core/index.ts +4 -0
  803. package/src/share/core/keySetParam.ts +92 -0
  804. package/src/share/core/vocabulary.ts +8 -0
  805. package/src/shell/ui/ShareControl.tsx +150 -0
  806. package/src/shell/ui/ShellFrame.tsx +180 -0
  807. package/src/shell/ui/SiteShell.tsx +297 -0
  808. package/src/shell/ui/index.ts +9 -0
  809. package/src/state/core/index.ts +1 -0
  810. package/src/state/core/legacyEntries.ts +76 -0
  811. package/src/state/core/persistBucket.ts +50 -10
  812. package/src/state/core/persistSignalBucket.ts +52 -0
  813. package/src/state/core/storageEntry.ts +32 -0
  814. package/src/structure/ui/StructureExportButton.tsx +57 -0
  815. package/src/structure/ui/index.ts +4 -0
  816. package/src/structure/ui/useStructureDraft.ts +47 -0
  817. package/src/ui.ts +2 -0
  818. package/src/worker/core/index.ts +1 -0
  819. package/src/worker/core/messages.ts +4 -3
  820. package/src/worker/core/oclResourcesUrl.ts +21 -0
  821. package/src/worker/core/serveWorkerRequests.ts +30 -2
  822. package/src/worker/core/workerChannel.ts +74 -74
  823. package/src/worker/core/workerChannelParts.ts +33 -13
  824. package/src/worker/core/workerChannelTypes.ts +47 -2
  825. package/src/worker/core/workerSlot.ts +181 -0
  826. package/styles/card.css +145 -0
  827. package/styles/chrome.css +248 -0
@@ -0,0 +1,109 @@
1
+ /**
2
+ * One JSON request to one of our backends, and its refusal as an error a page
3
+ * can show.
4
+ *
5
+ * Our backends are Fastify, and a refusal comes back as `{ statusCode, error,
6
+ * message }`: the message is written for the reader, so it is what the error
7
+ * says. Nothing here needs more than `fetch`, so it runs in a page, a worker
8
+ * and Node alike.
9
+ */
10
+ import { ApiError } from "./apiError.js";
11
+ /**
12
+ * Ask a backend one question and read its JSON answer.
13
+ *
14
+ * A refusal rejects with an {@link ApiError} carrying the server's own words
15
+ * and its status; a server that cannot be reached rejects with one of status
16
+ * 0. An abort is passed on untouched, so a caller tells "nobody asked any
17
+ * more" from a failure by the signal it aborted. A `204`, or an empty body,
18
+ * answers `undefined`.
19
+ * @param url - The address, absolute or relative to the page.
20
+ * @param options - The request, plus a `json` body and the `fetch` to use.
21
+ * @returns The parsed answer.
22
+ * @throws {ApiError} When the server refuses, cannot be reached, or answers
23
+ * something that is not JSON.
24
+ */
25
+ export async function fetchJson(url, options = {}) {
26
+ const { json, fetch: send = globalThis.fetch, ...init } = options;
27
+ const headers = new Headers(init.headers);
28
+ if (!headers.has('Accept'))
29
+ headers.set('Accept', 'application/json');
30
+ if (json !== undefined && !headers.has('Content-Type')) {
31
+ headers.set('Content-Type', 'application/json');
32
+ }
33
+ const body = json === undefined ? init.body : JSON.stringify(json);
34
+ let response;
35
+ try {
36
+ response = await send(url, { ...init, headers, body });
37
+ }
38
+ catch (error) {
39
+ if (init.signal?.aborted === true)
40
+ throw error;
41
+ throw new ApiError('the server could not be reached', {
42
+ status: 0,
43
+ error: 'Network Error',
44
+ cause: error,
45
+ });
46
+ }
47
+ if (!response.ok)
48
+ throw await readApiError(response);
49
+ const text = await response.text();
50
+ if (response.status === 204 || text === '')
51
+ return undefined;
52
+ try {
53
+ return JSON.parse(text);
54
+ }
55
+ catch (error) {
56
+ throw new ApiError('the server answered with something that is not JSON', {
57
+ status: response.status,
58
+ body: text,
59
+ cause: error,
60
+ });
61
+ }
62
+ }
63
+ /**
64
+ * The error a refusal stands for, in the server's words when it gave any: the
65
+ * `message` of a Fastify envelope, else a FastAPI `detail`, else the status.
66
+ * @param response - The response that was not ok.
67
+ * @returns The error, its body read.
68
+ */
69
+ export async function readApiError(response) {
70
+ let body;
71
+ try {
72
+ const text = await response.text();
73
+ body = text === '' ? undefined : parseOrKeep(text);
74
+ }
75
+ catch {
76
+ body = undefined;
77
+ }
78
+ const envelope = isRecord(body) ? body : {};
79
+ const status = typeof envelope.statusCode === 'number'
80
+ ? envelope.statusCode
81
+ : response.status;
82
+ const error = typeof envelope.error === 'string' ? envelope.error : response.statusText;
83
+ return new ApiError(refusalMessage(envelope, response), {
84
+ status,
85
+ error,
86
+ body,
87
+ });
88
+ }
89
+ function refusalMessage(envelope, response) {
90
+ const { message, detail } = envelope;
91
+ if (typeof message === 'string' && message !== '')
92
+ return message;
93
+ if (typeof detail === 'string' && detail !== '')
94
+ return detail;
95
+ const text = response.statusText === '' ? '' : ` ${response.statusText}`;
96
+ return `the server answered ${response.status}${text}`;
97
+ }
98
+ function parseOrKeep(text) {
99
+ try {
100
+ return JSON.parse(text);
101
+ }
102
+ catch {
103
+ return text;
104
+ }
105
+ }
106
+ function isRecord(value) {
107
+ return typeof value === 'object' && value !== null && !Array.isArray(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OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;IAC5E,OAAO,IAAI,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE;QACtD,MAAM;QACN,KAAK;QACL,IAAI;KACL,CAAC,CAAC;AACL,CAAC;AAiBD,SAAS,cAAc,CACrB,QAAiC,EACjC,QAAkB;IAElB,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;IACrC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,OAAO,CAAC;IAClE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC;IAC/D,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;IACzE,OAAO,uBAAuB,QAAQ,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;AACzD,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type { ApiErrorOptions } from './apiError.ts';
2
+ export { ApiError } from './apiError.ts';
3
+ export type { FetchJsonOptions } from './fetchJson.ts';
4
+ export { fetchJson, readApiError } from './fetchJson.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fetch/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ApiError } from "./apiError.js";
2
+ export { fetchJson, readApiError } from "./fetchJson.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fetch/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * One formula written several ways: canonically, so two spellings compare
3
+ * equal; as HTML, so a paste keeps its subscripts; in Unicode, for prose.
4
+ */
5
+ import type { FormulaOptions, ParsedFormula } from './readFormula.ts';
6
+ /** What {@link canonicalFormula} is told beyond the text. */
7
+ export interface CanonicalFormulaOptions extends FormulaOptions {
8
+ /**
9
+ * Whether a formula typed in the wrong case is fixed first, so `c9h6n4`
10
+ * reads as `C9H6N4`. A tool reading exact isotopes and charges leaves it
11
+ * off: case is what tells `Co` from `CO`.
12
+ * @default false
13
+ */
14
+ fixCase?: boolean;
15
+ }
16
+ /**
17
+ * The canonical spelling of a formula, so two spellings of one compound
18
+ * compare equal: `NaOH`, `HONa` and `NaHO` all give the same string.
19
+ * @param text - A formula as typed.
20
+ * @param options - Whether the case is fixed, and the language of a failure.
21
+ * @returns The canonical formula.
22
+ * @throws {FormulaError} When the text is not a formula.
23
+ */
24
+ export declare function canonicalFormula(text: string, options?: CanonicalFormulaOptions): string;
25
+ /**
26
+ * Atom counts per element over a whole formula, isotopes folded into their
27
+ * element and every part added up.
28
+ * @param parsed - A formula as `readFormula` read it.
29
+ * @returns Symbol → count, in the order the formula first names each element.
30
+ */
31
+ export declare function atomCounts(parsed: ParsedFormula): Map<string, number>;
32
+ /**
33
+ * A formula as HTML, its subscripts and its charge marked up, so a value
34
+ * copied from the page keeps them when it is pasted into a document.
35
+ * @param text - A formula as typed.
36
+ * @returns The markup, or the text itself when it is not a formula.
37
+ */
38
+ export declare function formulaHtml(text: string): string;
39
+ /**
40
+ * A formula written for prose, with true subscripts and superscripts and its
41
+ * charge the way a chemist writes it: `NO₃⁻`, `Fe³⁺`, `²³⁸U¹⁹F₆`.
42
+ * @param text - A formula as typed.
43
+ * @returns The formula in Unicode, or the text itself when it is not one.
44
+ */
45
+ export declare function formulaText(text: string): string;
46
+ //# sourceMappingURL=formulaText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formulaText.d.ts","sourceRoot":"","sources":["../../../src/formula/core/formulaText.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtE,6DAA6D;AAC7D,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC7D;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,uBAA4B,GACpC,MAAM,CAQR;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAQrE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAchD"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * One formula written several ways: canonically, so two spellings compare
3
+ * equal; as HTML, so a paste keeps its subscripts; in Unicode, for prose.
4
+ */
5
+ import { MF, ensureCase } from 'mf-parser';
6
+ import { DEFAULT_LANGUAGE } from "../../i18n/core/languages.js";
7
+ import { normalizeFormula } from "./normalizeFormula.js";
8
+ import { FormulaError, parserMessage } from "./readFormula.js";
9
+ /**
10
+ * The canonical spelling of a formula, so two spellings of one compound
11
+ * compare equal: `NaOH`, `HONa` and `NaHO` all give the same string.
12
+ * @param text - A formula as typed.
13
+ * @param options - Whether the case is fixed, and the language of a failure.
14
+ * @returns The canonical formula.
15
+ * @throws {FormulaError} When the text is not a formula.
16
+ */
17
+ export function canonicalFormula(text, options = {}) {
18
+ const { fixCase = false, language = DEFAULT_LANGUAGE } = options;
19
+ const normalized = normalizeFormula(text);
20
+ try {
21
+ return new MF(fixCase ? ensureCase(normalized) : normalized).toMF();
22
+ }
23
+ catch (error) {
24
+ throw new FormulaError(parserMessage(text, error, language));
25
+ }
26
+ }
27
+ /**
28
+ * Atom counts per element over a whole formula, isotopes folded into their
29
+ * element and every part added up.
30
+ * @param parsed - A formula as `readFormula` read it.
31
+ * @returns Symbol → count, in the order the formula first names each element.
32
+ */
33
+ export function atomCounts(parsed) {
34
+ const counts = new Map();
35
+ for (const part of parsed.parts) {
36
+ for (const atom of part.atoms) {
37
+ counts.set(atom.symbol, (counts.get(atom.symbol) ?? 0) + atom.count);
38
+ }
39
+ }
40
+ return counts;
41
+ }
42
+ /**
43
+ * A formula as HTML, its subscripts and its charge marked up, so a value
44
+ * copied from the page keeps them when it is pasted into a document.
45
+ * @param text - A formula as typed.
46
+ * @returns The markup, or the text itself when it is not a formula.
47
+ */
48
+ export function formulaHtml(text) {
49
+ try {
50
+ return new MF(normalizeFormula(text)).toHtml();
51
+ }
52
+ catch {
53
+ return text.trim();
54
+ }
55
+ }
56
+ /**
57
+ * A formula written for prose, with true subscripts and superscripts and its
58
+ * charge the way a chemist writes it: `NO₃⁻`, `Fe³⁺`, `²³⁸U¹⁹F₆`.
59
+ * @param text - A formula as typed.
60
+ * @returns The formula in Unicode, or the text itself when it is not one.
61
+ */
62
+ export function formulaText(text) {
63
+ let written;
64
+ try {
65
+ written = new MF(normalizeFormula(text)).toText();
66
+ }
67
+ catch {
68
+ return text.trim();
69
+ }
70
+ return written
71
+ .replaceAll(/\s+•\s+/gu, '·')
72
+ .replace(/(?<sign>[⁺⁻])(?<digits>[⁰¹²³⁴⁵⁶⁷⁸⁹]+)$/u, (_match, sign, digits) => `${digits === '¹' ? '' : digits}${sign}`);
73
+ }
74
+ //# sourceMappingURL=formulaText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formulaText.js","sourceRoot":"","sources":["../../../src/formula/core/formulaText.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAa/D;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,UAAmC,EAAE;IAErC,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,GAAG,gBAAgB,EAAE,GAAG,OAAO,CAAC;IACjE,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAI,CAAC;QACH,OAAO,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;IACtE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,YAAY,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AAC,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,EAAE,CAC3C,CAAC;AACN,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type { CanonicalFormulaOptions } from './formulaText.ts';
2
+ export { atomCounts, canonicalFormula, formulaHtml, formulaText, } from './formulaText.ts';
3
+ export { normalizeFormula } from './normalizeFormula.ts';
4
+ export type { FormulaAtom, FormulaOptions, FormulaPart, ParsedFormula, } from './readFormula.ts';
5
+ export { FormulaError, atomicNumber, elementName, readFormula, } from './readFormula.ts';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/formula/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EACV,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { atomCounts, canonicalFormula, formulaHtml, formulaText, } from "./formulaText.js";
2
+ export { normalizeFormula } from "./normalizeFormula.js";
3
+ export { FormulaError, atomicNumber, elementName, readFormula, } from "./readFormula.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formula/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The ways a student types a charge or a hydrate, rewritten into the syntax
3
+ * `mf-parser` reads.
4
+ *
5
+ * The parser silently drops a trailing minus — `NO3-` would be read as neutral
6
+ * nitrate and `SO4--` as neutral sulfate — and reads the dot of `CuSO4.5H2O` as
7
+ * a decimal, giving `H2CuO5.5S`. Both are rewritten here, before the parser
8
+ * ever sees the text, rather than by every site that reads a formula.
9
+ */
10
+ /**
11
+ * Rewrite the ways a charge and a hydrate are commonly typed into the syntax
12
+ * the parser reads.
13
+ *
14
+ * - `NO3-`, `SO4--`, `S2O3-2`, `CO3 2-`, `CO3^2-` → `NO3(-1)`, `SO4(-2)`, …
15
+ * - `CuSO4.5H2O`, `CuSO4·5H2O`, `CuSO4*5H2O` → `CuSO4 . 5H2O`
16
+ *
17
+ * A charge already written in parentheses, `Fe(3+)`, is left as it is.
18
+ * @param text - The formula as typed.
19
+ * @returns The formula the parser is given.
20
+ */
21
+ export declare function normalizeFormula(text: string): string;
22
+ //# sourceMappingURL=normalizeFormula.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeFormula.d.ts","sourceRoot":"","sources":["../../../src/formula/core/normalizeFormula.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAsBrD"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The ways a student types a charge or a hydrate, rewritten into the syntax
3
+ * `mf-parser` reads.
4
+ *
5
+ * The parser silently drops a trailing minus — `NO3-` would be read as neutral
6
+ * nitrate and `SO4--` as neutral sulfate — and reads the dot of `CuSO4.5H2O` as
7
+ * a decimal, giving `H2CuO5.5S`. Both are rewritten here, before the parser
8
+ * ever sees the text, rather than by every site that reads a formula.
9
+ */
10
+ /**
11
+ * Rewrite the ways a charge and a hydrate are commonly typed into the syntax
12
+ * the parser reads.
13
+ *
14
+ * - `NO3-`, `SO4--`, `S2O3-2`, `CO3 2-`, `CO3^2-` → `NO3(-1)`, `SO4(-2)`, …
15
+ * - `CuSO4.5H2O`, `CuSO4·5H2O`, `CuSO4*5H2O` → `CuSO4 . 5H2O`
16
+ *
17
+ * A charge already written in parentheses, `Fe(3+)`, is left as it is.
18
+ * @param text - The formula as typed.
19
+ * @returns The formula the parser is given.
20
+ */
21
+ export function normalizeFormula(text) {
22
+ let formula = text.trim().replaceAll(/[·•*]/g, '.');
23
+ formula = formula.replaceAll(/\s*\.\s*/g, ' . ');
24
+ const separated = /^(?<body>.*?\S)(?:\s+|\^)(?<digits>\d*)(?<signs>[+-]+)$/u.exec(formula);
25
+ if (separated?.groups) {
26
+ const { body = '', digits = '', signs = '' } = separated.groups;
27
+ return withCharge(body, signs, digits);
28
+ }
29
+ const signThenDigits = /^(?<body>.*?[^\s(])(?<sign>[+-])(?<digits>\d+)$/u.exec(formula);
30
+ if (signThenDigits?.groups) {
31
+ const { body = '', sign = '', digits = '' } = signThenDigits.groups;
32
+ return withCharge(body, sign, digits);
33
+ }
34
+ const trailingSigns = /^(?<body>.*?[^\s+-])(?<signs>[+-]+)$/u.exec(formula);
35
+ if (trailingSigns?.groups) {
36
+ const { body = '', signs = '' } = trailingSigns.groups;
37
+ return withCharge(body, signs, '');
38
+ }
39
+ return formula;
40
+ }
41
+ function withCharge(body, signs, digits) {
42
+ const sign = signs.startsWith('-') ? '-' : '+';
43
+ const magnitude = digits === '' ? signs.length : Number(digits);
44
+ return `${body.trim()}(${sign}${magnitude})`;
45
+ }
46
+ //# sourceMappingURL=normalizeFormula.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeFormula.js","sourceRoot":"","sources":["../../../src/formula/core/normalizeFormula.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,C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AAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAChE,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,GAAG,SAAS,GAAG,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * A formula read into its parts, atoms and charges, with every failure
3
+ * explained in a sentence written for a student rather than for a parser.
4
+ */
5
+ import type { Language } from '../../i18n/core/languages.ts';
6
+ /** One kind of atom in one part of a formula. */
7
+ export interface FormulaAtom {
8
+ /** Element symbol, e.g. `Fe`. */
9
+ symbol: string;
10
+ /** Mass number when the formula names the isotope, e.g. 56 in `[56Fe]`. */
11
+ massNumber: number | null;
12
+ /** How many of them the part holds. */
13
+ count: number;
14
+ }
15
+ /** One `.`-separated part of a formula: its atoms and its charge. */
16
+ export interface FormulaPart {
17
+ /** The atoms of the part, in the order the formula first names them. */
18
+ atoms: FormulaAtom[];
19
+ /** The charge of the part. */
20
+ charge: number;
21
+ }
22
+ /** A formula as {@link readFormula} reads it. */
23
+ export interface ParsedFormula {
24
+ /** What was handed to the parser, after {@link normalizeFormula}. */
25
+ formula: string;
26
+ /** Its `.`-separated parts. */
27
+ parts: FormulaPart[];
28
+ /** Sum of the charges of every part. */
29
+ charge: number;
30
+ }
31
+ /** What the formula readers are told beyond the text. */
32
+ export interface FormulaOptions {
33
+ /**
34
+ * The language a failure is explained in.
35
+ * @default 'en'
36
+ */
37
+ language?: Language;
38
+ }
39
+ /** A formula that cannot be read, with a message written for a student. */
40
+ export declare class FormulaError extends Error {
41
+ name: string;
42
+ }
43
+ /**
44
+ * Read a formula into its parts, atoms and charges.
45
+ * @param text - A formula as typed, e.g. `Fe(3+)`, `NO3-` or `[238U][19F]6`.
46
+ * @param options - The language a failure is explained in.
47
+ * @returns The parsed formula.
48
+ * @throws {FormulaError} When the text is empty or is not a formula.
49
+ */
50
+ export declare function readFormula(text: string, options?: FormulaOptions): ParsedFormula;
51
+ /**
52
+ * The atomic number of an element.
53
+ * @param symbol - Its symbol.
54
+ * @param options - The language a failure is explained in.
55
+ * @returns Z.
56
+ * @throws {FormulaError} When the symbol is not an element.
57
+ */
58
+ export declare function atomicNumber(symbol: string, options?: FormulaOptions): number;
59
+ /**
60
+ * The name of an element, as the periodic table writes it.
61
+ * @param symbol - Its symbol.
62
+ * @returns The English name, or the symbol itself for an unknown one.
63
+ */
64
+ export declare function elementName(symbol: string): string;
65
+ /**
66
+ * Explain a failure of the parser in a student's terms.
67
+ * @param text - The formula as typed.
68
+ * @param error - What the parser threw.
69
+ * @param language - The language of the sentence.
70
+ * @returns The sentence.
71
+ */
72
+ export declare function parserMessage(text: string, error: unknown, language: Language): string;
73
+ //# sourceMappingURL=readFormula.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readFormula.d.ts","sourceRoot":"","sources":["../../../src/formula/core/readFormula.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAO7D,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,iDAAiD;AACjD,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,2EAA2E;AAC3E,qBAAa,YAAa,SAAQ,KAAK;IAC5B,IAAI,SAAkB;CAChC;AAQD;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC3B,aAAa,CA8Bf;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,cAAmB,GAC3B,MAAM,CAUR;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,QAAQ,GACjB,MAAM,CASR"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * A formula read into its parts, atoms and charges, with every failure
3
+ * explained in a sentence written for a student rather than for a parser.
4
+ */
5
+ import { MF } from 'mf-parser';
6
+ import { CHROME_CATALOG } from "../../i18n/core/chromeCatalog.js";
7
+ import { DEFAULT_LANGUAGE } from "../../i18n/core/languages.js";
8
+ import { catalogTranslate } from "../../i18n/core/translate.js";
9
+ import { elementBySymbol } from "../../periodic/core/elements.js";
10
+ import { normalizeFormula } from "./normalizeFormula.js";
11
+ /** A formula that cannot be read, with a message written for a student. */
12
+ export class FormulaError extends Error {
13
+ name = 'FormulaError';
14
+ }
15
+ /**
16
+ * Read a formula into its parts, atoms and charges.
17
+ * @param text - A formula as typed, e.g. `Fe(3+)`, `NO3-` or `[238U][19F]6`.
18
+ * @param options - The language a failure is explained in.
19
+ * @returns The parsed formula.
20
+ * @throws {FormulaError} When the text is empty or is not a formula.
21
+ */
22
+ export function readFormula(text, options = {}) {
23
+ const { language = DEFAULT_LANGUAGE } = options;
24
+ const t = catalogTranslate(CHROME_CATALOG, language);
25
+ const formula = normalizeFormula(text);
26
+ if (formula === '')
27
+ throw new FormulaError(t('formula.typeFirst'));
28
+ let rawParts;
29
+ try {
30
+ rawParts = new MF(formula).toParts();
31
+ }
32
+ catch (error) {
33
+ throw new FormulaError(parserMessage(text, error, language));
34
+ }
35
+ const order = writtenOrder(formula);
36
+ const parts = [];
37
+ let total = 0;
38
+ for (const rawPart of rawParts) {
39
+ const part = readPart(text, rawPart, language);
40
+ part.atoms.sort((a, b) => (order.get(a.symbol) ?? order.size) -
41
+ (order.get(b.symbol) ?? order.size));
42
+ total += part.charge;
43
+ parts.push(part);
44
+ }
45
+ if (parts.every((part) => part.atoms.length === 0)) {
46
+ throw new FormulaError(t('formula.noAtom', { formula: text.trim() }));
47
+ }
48
+ return { formula, parts, charge: total };
49
+ }
50
+ /**
51
+ * The atomic number of an element.
52
+ * @param symbol - Its symbol.
53
+ * @param options - The language a failure is explained in.
54
+ * @returns Z.
55
+ * @throws {FormulaError} When the symbol is not an element.
56
+ */
57
+ export function atomicNumber(symbol, options = {}) {
58
+ const element = elementBySymbol(symbol);
59
+ if (element === undefined) {
60
+ const t = catalogTranslate(CHROME_CATALOG, options.language ?? DEFAULT_LANGUAGE);
61
+ throw new FormulaError(t('formula.notElement', { symbol }));
62
+ }
63
+ return element.atomicNumber;
64
+ }
65
+ /**
66
+ * The name of an element, as the periodic table writes it.
67
+ * @param symbol - Its symbol.
68
+ * @returns The English name, or the symbol itself for an unknown one.
69
+ */
70
+ export function elementName(symbol) {
71
+ return elementBySymbol(symbol)?.name ?? symbol;
72
+ }
73
+ /**
74
+ * Explain a failure of the parser in a student's terms.
75
+ * @param text - The formula as typed.
76
+ * @param error - What the parser threw.
77
+ * @param language - The language of the sentence.
78
+ * @returns The sentence.
79
+ */
80
+ export function parserMessage(text, error, language) {
81
+ const t = catalogTranslate(CHROME_CATALOG, language);
82
+ const raw = error instanceof Error ? error.message : String(error);
83
+ const unknown = /element unknown: (?<symbol>\S+)/u.exec(raw);
84
+ if (unknown?.groups?.symbol) {
85
+ return t('formula.notElement', { symbol: unknown.groups.symbol });
86
+ }
87
+ const reason = raw.split('\n', 1)[0] ?? raw;
88
+ return t('formula.unreadable', { formula: text.trim(), reason });
89
+ }
90
+ /**
91
+ * Where each element first appears in a formula as it is written, so a table
92
+ * lists Sb before O for Sb2O5 rather than in the parser's canonical order.
93
+ * @param formula - The formula as given to the parser.
94
+ * @returns Symbol → position of its first appearance.
95
+ */
96
+ function writtenOrder(formula) {
97
+ const order = new Map();
98
+ for (const match of formula.matchAll(/[A-Z][a-z]*/gu)) {
99
+ if (!order.has(match[0]))
100
+ order.set(match[0], order.size);
101
+ }
102
+ return order;
103
+ }
104
+ function readPart(text, rawPart, language) {
105
+ const t = catalogTranslate(CHROME_CATALOG, language);
106
+ const atoms = [];
107
+ let charge = 0;
108
+ for (const entry of rawPart) {
109
+ if (entry.kind === 'charge') {
110
+ charge += Number(entry.value);
111
+ continue;
112
+ }
113
+ const count = entry.multiplier ?? 1;
114
+ if (!Number.isInteger(count) || count <= 0) {
115
+ throw new FormulaError(t('formula.wholeCounts', { formula: text.trim(), count }));
116
+ }
117
+ if (entry.kind === 'atom' && typeof entry.value === 'string') {
118
+ atomicNumber(entry.value, { language });
119
+ atoms.push({ symbol: entry.value, massNumber: null, count });
120
+ continue;
121
+ }
122
+ if (entry.kind === 'isotope') {
123
+ const { atom, isotope } = entry.value;
124
+ atomicNumber(atom, { language });
125
+ atoms.push({ symbol: atom, massNumber: isotope, count });
126
+ continue;
127
+ }
128
+ throw new FormulaError(t('formula.unknownNotation', { formula: text.trim() }));
129
+ }
130
+ return { atoms, charge };
131
+ }
132
+ //# sourceMappingURL=readFormula.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readFormula.js","sourceRoot":"","sources":["../../../src/formula/core/readFormula.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,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,KAAK,EAAE,CAAC,CAAC;YACzD,SAAS;QACX,CAAC;QACD,MAAM,IAAI,YAAY,CACpB,CAAC,CAAC,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CACvD,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { ClickToCopyElement } from '../../clipboard/ui/ClickToCopy.tsx';
3
+ /** What {@link CopyableFormula} draws and copies. */
4
+ export interface CopyableFormulaProps {
5
+ /** The formula, as the data writes it: `NO3-`, `CuSO4.5H2O`, `C6H12O6`. */
6
+ formula: string;
7
+ /**
8
+ * The element drawn: a cell of its own inside a table.
9
+ * @default 'span'
10
+ */
11
+ as?: Extract<ClickToCopyElement, 'span' | 'td'>;
12
+ /**
13
+ * What the value is called in the hover title.
14
+ * @default the chrome's own word for it, in the language of the page
15
+ */
16
+ label?: string;
17
+ /**
18
+ * Class the value carries, in addition to `click-to-copy`.
19
+ * @default undefined
20
+ */
21
+ className?: string;
22
+ }
23
+ /**
24
+ * A formula drawn with its subscripts and copied by a click: as text for
25
+ * another tool, and as HTML, so a paste into a document keeps the subscripts
26
+ * and the charge.
27
+ * @param props - The formula, the element it is drawn as, and its label.
28
+ * @returns The formula.
29
+ */
30
+ export declare function CopyableFormula(props: CopyableFormulaProps): ReactElement;
31
+ //# sourceMappingURL=CopyableFormula.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyableFormula.d.ts","sourceRoot":"","sources":["../../../src/formula/ui/CopyableFormula.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAM7E,qDAAqD;AACrD,MAAM,WAAW,oBAAoB;IACnC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAazE"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MF } from 'react-mf';
3
+ import { ClickToCopy } from "../../clipboard/ui/ClickToCopy.js";
4
+ import { useChromeT } from "../../i18n/ui/useT.js";
5
+ import { formulaHtml } from "../core/formulaText.js";
6
+ import { normalizeFormula } from "../core/normalizeFormula.js";
7
+ /**
8
+ * A formula drawn with its subscripts and copied by a click: as text for
9
+ * another tool, and as HTML, so a paste into a document keeps the subscripts
10
+ * and the charge.
11
+ * @param props - The formula, the element it is drawn as, and its label.
12
+ * @returns The formula.
13
+ */
14
+ export function CopyableFormula(props) {
15
+ const { formula, as = 'span', label, className } = props;
16
+ const t = useChromeT();
17
+ return (_jsx(ClickToCopy, { as: as, className: className, label: label ?? t('formula.copyLabel'), value: { text: formula, html: formulaHtml(formula) }, children: _jsx(MF, { mf: normalizeFormula(formula) }) }));
18
+ }
19
+ //# sourceMappingURL=CopyableFormula.js.map