react-cheminfo 0.27.0 → 0.29.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 (696) hide show
  1. package/README.md +38 -25
  2. package/lib/chart/core/axisLabels.d.ts +82 -0
  3. package/lib/chart/core/axisLabels.d.ts.map +1 -0
  4. package/lib/chart/core/axisLabels.js +111 -0
  5. package/lib/chart/core/axisLabels.js.map +1 -0
  6. package/lib/chart/core/boxLayout.d.ts +53 -0
  7. package/lib/chart/core/boxLayout.d.ts.map +1 -0
  8. package/lib/chart/core/boxLayout.js +112 -0
  9. package/lib/chart/core/boxLayout.js.map +1 -0
  10. package/lib/chart/core/chartAxisScale.d.ts +23 -2
  11. package/lib/chart/core/chartAxisScale.d.ts.map +1 -1
  12. package/lib/chart/core/chartAxisScale.js +64 -13
  13. package/lib/chart/core/chartAxisScale.js.map +1 -1
  14. package/lib/chart/core/chartDomain.d.ts +160 -0
  15. package/lib/chart/core/chartDomain.d.ts.map +1 -0
  16. package/lib/chart/core/chartDomain.js +46 -0
  17. package/lib/chart/core/chartDomain.js.map +1 -0
  18. package/lib/chart/core/chartGeometry.d.ts +131 -0
  19. package/lib/chart/core/chartGeometry.d.ts.map +1 -0
  20. package/lib/chart/core/chartGeometry.js +101 -0
  21. package/lib/chart/core/chartGeometry.js.map +1 -0
  22. package/lib/chart/core/chartPane.d.ts +11 -0
  23. package/lib/chart/core/chartPane.d.ts.map +1 -0
  24. package/lib/chart/core/chartPane.js +11 -0
  25. package/lib/chart/core/chartPane.js.map +1 -0
  26. package/lib/chart/core/chartScale.d.ts +4 -1
  27. package/lib/chart/core/chartScale.d.ts.map +1 -1
  28. package/lib/chart/core/chartScale.js +8 -4
  29. package/lib/chart/core/chartScale.js.map +1 -1
  30. package/lib/chart/core/chartTheme.d.ts +156 -0
  31. package/lib/chart/core/chartTheme.d.ts.map +1 -0
  32. package/lib/chart/core/chartTheme.js +156 -0
  33. package/lib/chart/core/chartTheme.js.map +1 -0
  34. package/lib/chart/core/chartViewport.d.ts +32 -5
  35. package/lib/chart/core/chartViewport.d.ts.map +1 -1
  36. package/lib/chart/core/chartViewport.js +40 -11
  37. package/lib/chart/core/chartViewport.js.map +1 -1
  38. package/lib/chart/core/guidePlacement.d.ts +52 -0
  39. package/lib/chart/core/guidePlacement.d.ts.map +1 -0
  40. package/lib/chart/core/guidePlacement.js +52 -0
  41. package/lib/chart/core/guidePlacement.js.map +1 -0
  42. package/lib/chart/core/index.d.ts +29 -2
  43. package/lib/chart/core/index.d.ts.map +1 -1
  44. package/lib/chart/core/index.js +19 -2
  45. package/lib/chart/core/index.js.map +1 -1
  46. package/lib/chart/core/labelStack.d.ts +27 -0
  47. package/lib/chart/core/labelStack.d.ts.map +1 -0
  48. package/lib/chart/core/labelStack.js +62 -0
  49. package/lib/chart/core/labelStack.js.map +1 -0
  50. package/lib/chart/core/legendBox.d.ts +152 -0
  51. package/lib/chart/core/legendBox.d.ts.map +1 -0
  52. package/lib/chart/core/legendBox.js +169 -0
  53. package/lib/chart/core/legendBox.js.map +1 -0
  54. package/lib/chart/core/selectionGeometry.d.ts +45 -0
  55. package/lib/chart/core/selectionGeometry.d.ts.map +1 -0
  56. package/lib/chart/core/selectionGeometry.js +49 -0
  57. package/lib/chart/core/selectionGeometry.js.map +1 -0
  58. package/lib/chart/core/spectrumColor.d.ts +80 -0
  59. package/lib/chart/core/spectrumColor.d.ts.map +1 -0
  60. package/lib/chart/core/spectrumColor.js +120 -0
  61. package/lib/chart/core/spectrumColor.js.map +1 -0
  62. package/lib/chart/core/stackCapacity.d.ts +136 -0
  63. package/lib/chart/core/stackCapacity.d.ts.map +1 -0
  64. package/lib/chart/core/stackCapacity.js +153 -0
  65. package/lib/chart/core/stackCapacity.js.map +1 -0
  66. package/lib/chart/core/svgPoint.d.ts +62 -0
  67. package/lib/chart/core/svgPoint.d.ts.map +1 -0
  68. package/lib/chart/core/svgPoint.js +43 -0
  69. package/lib/chart/core/svgPoint.js.map +1 -0
  70. package/lib/chart/core/tracePath.d.ts +94 -0
  71. package/lib/chart/core/tracePath.d.ts.map +1 -0
  72. package/lib/chart/core/tracePath.js +191 -0
  73. package/lib/chart/core/tracePath.js.map +1 -0
  74. package/lib/chart/core/trackerReadout.d.ts +55 -0
  75. package/lib/chart/core/trackerReadout.d.ts.map +1 -0
  76. package/lib/chart/core/trackerReadout.js +53 -0
  77. package/lib/chart/core/trackerReadout.js.map +1 -0
  78. package/lib/chart/core/viewTransform.d.ts +167 -0
  79. package/lib/chart/core/viewTransform.d.ts.map +1 -0
  80. package/lib/chart/core/viewTransform.js +188 -0
  81. package/lib/chart/core/viewTransform.js.map +1 -0
  82. package/lib/chart/core/zoomDomain.d.ts +127 -0
  83. package/lib/chart/core/zoomDomain.d.ts.map +1 -0
  84. package/lib/chart/core/zoomDomain.js +175 -0
  85. package/lib/chart/core/zoomDomain.js.map +1 -0
  86. package/lib/chart/ui/Axes.d.ts +104 -0
  87. package/lib/chart/ui/Axes.d.ts.map +1 -0
  88. package/lib/chart/ui/Axes.js +155 -0
  89. package/lib/chart/ui/Axes.js.map +1 -0
  90. package/lib/chart/ui/AxisGuide.d.ts +60 -0
  91. package/lib/chart/ui/AxisGuide.d.ts.map +1 -0
  92. package/lib/chart/ui/AxisGuide.js +111 -0
  93. package/lib/chart/ui/AxisGuide.js.map +1 -0
  94. package/lib/chart/ui/ChartStack.d.ts +81 -0
  95. package/lib/chart/ui/ChartStack.d.ts.map +1 -0
  96. package/lib/chart/ui/ChartStack.js +42 -0
  97. package/lib/chart/ui/ChartStack.js.map +1 -0
  98. package/lib/chart/ui/ChartTracker.d.ts +36 -0
  99. package/lib/chart/ui/ChartTracker.d.ts.map +1 -0
  100. package/lib/chart/ui/ChartTracker.js +27 -0
  101. package/lib/chart/ui/ChartTracker.js.map +1 -0
  102. package/lib/chart/ui/PlotCaption.d.ts +44 -0
  103. package/lib/chart/ui/PlotCaption.d.ts.map +1 -0
  104. package/lib/chart/ui/PlotCaption.js +68 -0
  105. package/lib/chart/ui/PlotCaption.js.map +1 -0
  106. package/lib/chart/ui/SelectionRect.d.ts +27 -0
  107. package/lib/chart/ui/SelectionRect.d.ts.map +1 -0
  108. package/lib/chart/ui/SelectionRect.js +31 -0
  109. package/lib/chart/ui/SelectionRect.js.map +1 -0
  110. package/lib/chart/ui/TraceLegend.d.ts +99 -0
  111. package/lib/chart/ui/TraceLegend.d.ts.map +1 -0
  112. package/lib/chart/ui/TraceLegend.js +45 -0
  113. package/lib/chart/ui/TraceLegend.js.map +1 -0
  114. package/lib/chart/ui/chartGestures.d.ts +158 -0
  115. package/lib/chart/ui/chartGestures.d.ts.map +1 -0
  116. package/lib/chart/ui/chartGestures.js +145 -0
  117. package/lib/chart/ui/chartGestures.js.map +1 -0
  118. package/lib/chart/ui/chartStackLevel.d.ts +115 -0
  119. package/lib/chart/ui/chartStackLevel.d.ts.map +1 -0
  120. package/lib/chart/ui/chartStackLevel.js +96 -0
  121. package/lib/chart/ui/chartStackLevel.js.map +1 -0
  122. package/lib/chart/ui/chartSurface.d.ts +35 -0
  123. package/lib/chart/ui/chartSurface.d.ts.map +1 -0
  124. package/lib/chart/ui/chartSurface.js +58 -0
  125. package/lib/chart/ui/chartSurface.js.map +1 -0
  126. package/lib/chart/ui/index.d.ts +24 -0
  127. package/lib/chart/ui/index.d.ts.map +1 -1
  128. package/lib/chart/ui/index.js +13 -0
  129. package/lib/chart/ui/index.js.map +1 -1
  130. package/lib/chart/ui/useChartPointer.d.ts +124 -0
  131. package/lib/chart/ui/useChartPointer.d.ts.map +1 -0
  132. package/lib/chart/ui/useChartPointer.js +152 -0
  133. package/lib/chart/ui/useChartPointer.js.map +1 -0
  134. package/lib/chart/ui/useChartSize.d.ts +49 -0
  135. package/lib/chart/ui/useChartSize.d.ts.map +1 -0
  136. package/lib/chart/ui/useChartSize.js +91 -0
  137. package/lib/chart/ui/useChartSize.js.map +1 -0
  138. package/lib/chart/ui/useChartWindow.d.ts +147 -0
  139. package/lib/chart/ui/useChartWindow.d.ts.map +1 -0
  140. package/lib/chart/ui/useChartWindow.js +135 -0
  141. package/lib/chart/ui/useChartWindow.js.map +1 -0
  142. package/lib/chart/ui/useChartZoom.d.ts +88 -0
  143. package/lib/chart/ui/useChartZoom.d.ts.map +1 -0
  144. package/lib/chart/ui/useChartZoom.js +142 -0
  145. package/lib/chart/ui/useChartZoom.js.map +1 -0
  146. package/lib/chart/ui/useWheelListener.d.ts +30 -0
  147. package/lib/chart/ui/useWheelListener.d.ts.map +1 -0
  148. package/lib/chart/ui/useWheelListener.js +57 -0
  149. package/lib/chart/ui/useWheelListener.js.map +1 -0
  150. package/lib/clipboard/core/copyPng.d.ts +13 -0
  151. package/lib/clipboard/core/copyPng.d.ts.map +1 -0
  152. package/lib/clipboard/core/copyPng.js +19 -0
  153. package/lib/clipboard/core/copyPng.js.map +1 -0
  154. package/lib/clipboard/core/index.d.ts +1 -0
  155. package/lib/clipboard/core/index.d.ts.map +1 -1
  156. package/lib/clipboard/core/index.js +1 -0
  157. package/lib/clipboard/core/index.js.map +1 -1
  158. package/lib/clipboard/ui/CopyableValue.d.ts +12 -9
  159. package/lib/clipboard/ui/CopyableValue.d.ts.map +1 -1
  160. package/lib/clipboard/ui/CopyableValue.js +11 -15
  161. package/lib/clipboard/ui/CopyableValue.js.map +1 -1
  162. package/lib/core.d.ts +1 -0
  163. package/lib/core.d.ts.map +1 -1
  164. package/lib/core.js +1 -0
  165. package/lib/core.js.map +1 -1
  166. package/lib/download/core/exportStyles.d.ts +22 -0
  167. package/lib/download/core/exportStyles.d.ts.map +1 -0
  168. package/lib/download/core/exportStyles.js +19 -0
  169. package/lib/download/core/exportStyles.js.map +1 -0
  170. package/lib/download/core/imageResolution.d.ts +88 -0
  171. package/lib/download/core/imageResolution.d.ts.map +1 -0
  172. package/lib/download/core/imageResolution.js +77 -0
  173. package/lib/download/core/imageResolution.js.map +1 -0
  174. package/lib/download/core/index.d.ts +13 -0
  175. package/lib/download/core/index.d.ts.map +1 -1
  176. package/lib/download/core/index.js +8 -0
  177. package/lib/download/core/index.js.map +1 -1
  178. package/lib/download/core/pictureExport.d.ts +93 -0
  179. package/lib/download/core/pictureExport.d.ts.map +1 -0
  180. package/lib/download/core/pictureExport.js +116 -0
  181. package/lib/download/core/pictureExport.js.map +1 -0
  182. package/lib/download/core/stackedDrawing.d.ts +36 -0
  183. package/lib/download/core/stackedDrawing.d.ts.map +1 -0
  184. package/lib/download/core/stackedDrawing.js +98 -0
  185. package/lib/download/core/stackedDrawing.js.map +1 -0
  186. package/lib/download/core/svgBounds.d.ts +44 -0
  187. package/lib/download/core/svgBounds.d.ts.map +1 -0
  188. package/lib/download/core/svgBounds.js +69 -0
  189. package/lib/download/core/svgBounds.js.map +1 -0
  190. package/lib/download/core/svgNamespace.d.ts +9 -0
  191. package/lib/download/core/svgNamespace.d.ts.map +1 -0
  192. package/lib/download/core/svgNamespace.js +10 -0
  193. package/lib/download/core/svgNamespace.js.map +1 -0
  194. package/lib/download/core/svgToPng.d.ts +43 -0
  195. package/lib/download/core/svgToPng.d.ts.map +1 -0
  196. package/lib/download/core/svgToPng.js +79 -0
  197. package/lib/download/core/svgToPng.js.map +1 -0
  198. package/lib/download/core/svgToString.d.ts +45 -0
  199. package/lib/download/core/svgToString.d.ts.map +1 -0
  200. package/lib/download/core/svgToString.js +58 -0
  201. package/lib/download/core/svgToString.js.map +1 -0
  202. package/lib/download/ui/ExportDialogFrame.d.ts +46 -0
  203. package/lib/download/ui/ExportDialogFrame.d.ts.map +1 -0
  204. package/lib/download/ui/ExportDialogFrame.js +24 -0
  205. package/lib/download/ui/ExportDialogFrame.js.map +1 -0
  206. package/lib/download/ui/ExportImageDialog.d.ts +47 -0
  207. package/lib/download/ui/ExportImageDialog.d.ts.map +1 -0
  208. package/lib/download/ui/ExportImageDialog.js +25 -0
  209. package/lib/download/ui/ExportImageDialog.js.map +1 -0
  210. package/lib/download/ui/ExportNameField.d.ts +29 -0
  211. package/lib/download/ui/ExportNameField.d.ts.map +1 -0
  212. package/lib/download/ui/ExportNameField.js +99 -0
  213. package/lib/download/ui/ExportNameField.js.map +1 -0
  214. package/lib/download/ui/ExportPictureSection.d.ts +38 -0
  215. package/lib/download/ui/ExportPictureSection.d.ts.map +1 -0
  216. package/lib/download/ui/ExportPictureSection.js +48 -0
  217. package/lib/download/ui/ExportPictureSection.js.map +1 -0
  218. package/lib/download/ui/index.d.ts +10 -0
  219. package/lib/download/ui/index.d.ts.map +1 -1
  220. package/lib/download/ui/index.js +5 -0
  221. package/lib/download/ui/index.js.map +1 -1
  222. package/lib/download/ui/useDrawingBox.d.ts +23 -0
  223. package/lib/download/ui/useDrawingBox.d.ts.map +1 -0
  224. package/lib/download/ui/useDrawingBox.js +21 -0
  225. package/lib/download/ui/useDrawingBox.js.map +1 -0
  226. package/lib/error/core/describeSource.d.ts +17 -0
  227. package/lib/error/core/describeSource.d.ts.map +1 -0
  228. package/lib/error/core/describeSource.js +19 -0
  229. package/lib/error/core/describeSource.js.map +1 -0
  230. package/lib/error/core/index.d.ts +1 -0
  231. package/lib/error/core/index.d.ts.map +1 -1
  232. package/lib/error/core/index.js +1 -0
  233. package/lib/error/core/index.js.map +1 -1
  234. package/lib/help/ui/HelpBody.d.ts +10 -1
  235. package/lib/help/ui/HelpBody.d.ts.map +1 -1
  236. package/lib/help/ui/HelpBody.js +24 -1
  237. package/lib/help/ui/HelpBody.js.map +1 -1
  238. package/lib/help/ui/index.d.ts +1 -1
  239. package/lib/help/ui/index.d.ts.map +1 -1
  240. package/lib/help/ui/index.js.map +1 -1
  241. package/lib/ir/core/analysisSpectra.d.ts +46 -0
  242. package/lib/ir/core/analysisSpectra.d.ts.map +1 -0
  243. package/lib/ir/core/analysisSpectra.js +187 -0
  244. package/lib/ir/core/analysisSpectra.js.map +1 -0
  245. package/lib/ir/core/assignBands.d.ts +83 -0
  246. package/lib/ir/core/assignBands.d.ts.map +1 -0
  247. package/lib/ir/core/assignBands.js +83 -0
  248. package/lib/ir/core/assignBands.js.map +1 -0
  249. package/lib/ir/core/bandAssignments.d.ts +47 -0
  250. package/lib/ir/core/bandAssignments.d.ts.map +1 -0
  251. package/lib/ir/core/bandAssignments.js +305 -0
  252. package/lib/ir/core/bandAssignments.js.map +1 -0
  253. package/lib/ir/core/bandLabelPlan.d.ts +93 -0
  254. package/lib/ir/core/bandLabelPlan.d.ts.map +1 -0
  255. package/lib/ir/core/bandLabelPlan.js +104 -0
  256. package/lib/ir/core/bandLabelPlan.js.map +1 -0
  257. package/lib/ir/core/detectIrFormat.d.ts +23 -0
  258. package/lib/ir/core/detectIrFormat.d.ts.map +1 -0
  259. package/lib/ir/core/detectIrFormat.js +133 -0
  260. package/lib/ir/core/detectIrFormat.js.map +1 -0
  261. package/lib/ir/core/downloadSpectra.d.ts +26 -0
  262. package/lib/ir/core/downloadSpectra.d.ts.map +1 -0
  263. package/lib/ir/core/downloadSpectra.js +37 -0
  264. package/lib/ir/core/downloadSpectra.js.map +1 -0
  265. package/lib/ir/core/fromJcamp.d.ts +35 -0
  266. package/lib/ir/core/fromJcamp.d.ts.map +1 -0
  267. package/lib/ir/core/fromJcamp.js +48 -0
  268. package/lib/ir/core/fromJcamp.js.map +1 -0
  269. package/lib/ir/core/fromSpc.d.ts +30 -0
  270. package/lib/ir/core/fromSpc.d.ts.map +1 -0
  271. package/lib/ir/core/fromSpc.js +40 -0
  272. package/lib/ir/core/fromSpc.js.map +1 -0
  273. package/lib/ir/core/index.d.ts +51 -0
  274. package/lib/ir/core/index.d.ts.map +1 -0
  275. package/lib/ir/core/index.js +35 -0
  276. package/lib/ir/core/index.js.map +1 -0
  277. package/lib/ir/core/irBand.d.ts +45 -0
  278. package/lib/ir/core/irBand.d.ts.map +1 -0
  279. package/lib/ir/core/irBand.js +30 -0
  280. package/lib/ir/core/irBand.js.map +1 -0
  281. package/lib/ir/core/irCommands.d.ts +168 -0
  282. package/lib/ir/core/irCommands.d.ts.map +1 -0
  283. package/lib/ir/core/irCommands.js +94 -0
  284. package/lib/ir/core/irCommands.js.map +1 -0
  285. package/lib/ir/core/irDomain.d.ts +63 -0
  286. package/lib/ir/core/irDomain.d.ts.map +1 -0
  287. package/lib/ir/core/irDomain.js +136 -0
  288. package/lib/ir/core/irDomain.js.map +1 -0
  289. package/lib/ir/core/irEditorApi.d.ts +42 -0
  290. package/lib/ir/core/irEditorApi.d.ts.map +1 -0
  291. package/lib/ir/core/irEditorApi.js +10 -0
  292. package/lib/ir/core/irEditorApi.js.map +1 -0
  293. package/lib/ir/core/irFormat.d.ts +42 -0
  294. package/lib/ir/core/irFormat.d.ts.map +1 -0
  295. package/lib/ir/core/irFormat.js +51 -0
  296. package/lib/ir/core/irFormat.js.map +1 -0
  297. package/lib/ir/core/irMode.d.ts +160 -0
  298. package/lib/ir/core/irMode.d.ts.map +1 -0
  299. package/lib/ir/core/irMode.js +175 -0
  300. package/lib/ir/core/irMode.js.map +1 -0
  301. package/lib/ir/core/irReducer.d.ts +101 -0
  302. package/lib/ir/core/irReducer.d.ts.map +1 -0
  303. package/lib/ir/core/irReducer.js +207 -0
  304. package/lib/ir/core/irReducer.js.map +1 -0
  305. package/lib/ir/core/irSidePanels.d.ts +22 -0
  306. package/lib/ir/core/irSidePanels.d.ts.map +1 -0
  307. package/lib/ir/core/irSidePanels.js +12 -0
  308. package/lib/ir/core/irSidePanels.js.map +1 -0
  309. package/lib/ir/core/irSpectrum.d.ts +140 -0
  310. package/lib/ir/core/irSpectrum.d.ts.map +1 -0
  311. package/lib/ir/core/irSpectrum.js +34 -0
  312. package/lib/ir/core/irSpectrum.js.map +1 -0
  313. package/lib/ir/core/irState.d.ts +119 -0
  314. package/lib/ir/core/irState.d.ts.map +1 -0
  315. package/lib/ir/core/irState.js +92 -0
  316. package/lib/ir/core/irState.js.map +1 -0
  317. package/lib/ir/core/loadIrSpectra.d.ts +36 -0
  318. package/lib/ir/core/loadIrSpectra.d.ts.map +1 -0
  319. package/lib/ir/core/loadIrSpectra.js +44 -0
  320. package/lib/ir/core/loadIrSpectra.js.map +1 -0
  321. package/lib/ir/core/nearestBand.d.ts +35 -0
  322. package/lib/ir/core/nearestBand.d.ts.map +1 -0
  323. package/lib/ir/core/nearestBand.js +47 -0
  324. package/lib/ir/core/nearestBand.js.map +1 -0
  325. package/lib/ir/core/pickBands.d.ts +70 -0
  326. package/lib/ir/core/pickBands.d.ts.map +1 -0
  327. package/lib/ir/core/pickBands.js +125 -0
  328. package/lib/ir/core/pickBands.js.map +1 -0
  329. package/lib/ir/core/spectrumJcamp.d.ts +58 -0
  330. package/lib/ir/core/spectrumJcamp.d.ts.map +1 -0
  331. package/lib/ir/core/spectrumJcamp.js +156 -0
  332. package/lib/ir/core/spectrumJcamp.js.map +1 -0
  333. package/lib/ir/core/toIrSpectrum.d.ts +59 -0
  334. package/lib/ir/core/toIrSpectrum.d.ts.map +1 -0
  335. package/lib/ir/core/toIrSpectrum.js +56 -0
  336. package/lib/ir/core/toIrSpectrum.js.map +1 -0
  337. package/lib/ir/ui/BandMarks.d.ts +52 -0
  338. package/lib/ir/ui/BandMarks.d.ts.map +1 -0
  339. package/lib/ir/ui/BandMarks.js +71 -0
  340. package/lib/ir/ui/BandMarks.js.map +1 -0
  341. package/lib/ir/ui/BandsPanel.d.ts +31 -0
  342. package/lib/ir/ui/BandsPanel.d.ts.map +1 -0
  343. package/lib/ir/ui/BandsPanel.js +94 -0
  344. package/lib/ir/ui/BandsPanel.js.map +1 -0
  345. package/lib/ir/ui/IrAboutDialog.d.ts +18 -0
  346. package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -0
  347. package/lib/ir/ui/IrAboutDialog.js +32 -0
  348. package/lib/ir/ui/IrAboutDialog.js.map +1 -0
  349. package/lib/ir/ui/IrCanvas.d.ts +38 -0
  350. package/lib/ir/ui/IrCanvas.d.ts.map +1 -0
  351. package/lib/ir/ui/IrCanvas.js +41 -0
  352. package/lib/ir/ui/IrCanvas.js.map +1 -0
  353. package/lib/ir/ui/IrChart.d.ts +28 -0
  354. package/lib/ir/ui/IrChart.d.ts.map +1 -0
  355. package/lib/ir/ui/IrChart.js +114 -0
  356. package/lib/ir/ui/IrChart.js.map +1 -0
  357. package/lib/ir/ui/IrCommandProvider.d.ts +15 -0
  358. package/lib/ir/ui/IrCommandProvider.d.ts.map +1 -0
  359. package/lib/ir/ui/IrCommandProvider.js +14 -0
  360. package/lib/ir/ui/IrCommandProvider.js.map +1 -0
  361. package/lib/ir/ui/IrCommandTooltip.d.ts +16 -0
  362. package/lib/ir/ui/IrCommandTooltip.d.ts.map +1 -0
  363. package/lib/ir/ui/IrCommandTooltip.js +22 -0
  364. package/lib/ir/ui/IrCommandTooltip.js.map +1 -0
  365. package/lib/ir/ui/IrDocumentationDialog.d.ts +18 -0
  366. package/lib/ir/ui/IrDocumentationDialog.d.ts.map +1 -0
  367. package/lib/ir/ui/IrDocumentationDialog.js +68 -0
  368. package/lib/ir/ui/IrDocumentationDialog.js.map +1 -0
  369. package/lib/ir/ui/IrEditor.d.ts +60 -0
  370. package/lib/ir/ui/IrEditor.d.ts.map +1 -0
  371. package/lib/ir/ui/IrEditor.js +42 -0
  372. package/lib/ir/ui/IrEditor.js.map +1 -0
  373. package/lib/ir/ui/IrHeader.d.ts +13 -0
  374. package/lib/ir/ui/IrHeader.d.ts.map +1 -0
  375. package/lib/ir/ui/IrHeader.js +21 -0
  376. package/lib/ir/ui/IrHeader.js.map +1 -0
  377. package/lib/ir/ui/IrLogo.d.ts +20 -0
  378. package/lib/ir/ui/IrLogo.d.ts.map +1 -0
  379. package/lib/ir/ui/IrLogo.js +17 -0
  380. package/lib/ir/ui/IrLogo.js.map +1 -0
  381. package/lib/ir/ui/IrPointerTracker.d.ts +29 -0
  382. package/lib/ir/ui/IrPointerTracker.d.ts.map +1 -0
  383. package/lib/ir/ui/IrPointerTracker.js +47 -0
  384. package/lib/ir/ui/IrPointerTracker.js.map +1 -0
  385. package/lib/ir/ui/IrShell.d.ts +25 -0
  386. package/lib/ir/ui/IrShell.d.ts.map +1 -0
  387. package/lib/ir/ui/IrShell.js +178 -0
  388. package/lib/ir/ui/IrShell.js.map +1 -0
  389. package/lib/ir/ui/IrSidePanel.d.ts +26 -0
  390. package/lib/ir/ui/IrSidePanel.d.ts.map +1 -0
  391. package/lib/ir/ui/IrSidePanel.js +39 -0
  392. package/lib/ir/ui/IrSidePanel.js.map +1 -0
  393. package/lib/ir/ui/IrStateProvider.d.ts +19 -0
  394. package/lib/ir/ui/IrStateProvider.d.ts.map +1 -0
  395. package/lib/ir/ui/IrStateProvider.js +16 -0
  396. package/lib/ir/ui/IrStateProvider.js.map +1 -0
  397. package/lib/ir/ui/IrStatusBar.d.ts +14 -0
  398. package/lib/ir/ui/IrStatusBar.d.ts.map +1 -0
  399. package/lib/ir/ui/IrStatusBar.js +48 -0
  400. package/lib/ir/ui/IrStatusBar.js.map +1 -0
  401. package/lib/ir/ui/IrToolbar.d.ts +18 -0
  402. package/lib/ir/ui/IrToolbar.d.ts.map +1 -0
  403. package/lib/ir/ui/IrToolbar.js +32 -0
  404. package/lib/ir/ui/IrToolbar.js.map +1 -0
  405. package/lib/ir/ui/IrTraces.d.ts +63 -0
  406. package/lib/ir/ui/IrTraces.d.ts.map +1 -0
  407. package/lib/ir/ui/IrTraces.js +72 -0
  408. package/lib/ir/ui/IrTraces.js.map +1 -0
  409. package/lib/ir/ui/MetadataPanel.d.ts +15 -0
  410. package/lib/ir/ui/MetadataPanel.d.ts.map +1 -0
  411. package/lib/ir/ui/MetadataPanel.js +49 -0
  412. package/lib/ir/ui/MetadataPanel.js.map +1 -0
  413. package/lib/ir/ui/SpectraPanel.d.ts +20 -0
  414. package/lib/ir/ui/SpectraPanel.d.ts.map +1 -0
  415. package/lib/ir/ui/SpectraPanel.js +42 -0
  416. package/lib/ir/ui/SpectraPanel.js.map +1 -0
  417. package/lib/ir/ui/SpectrumRow.d.ts +26 -0
  418. package/lib/ir/ui/SpectrumRow.d.ts.map +1 -0
  419. package/lib/ir/ui/SpectrumRow.js +41 -0
  420. package/lib/ir/ui/SpectrumRow.js.map +1 -0
  421. package/lib/ir/ui/index.d.ts +56 -0
  422. package/lib/ir/ui/index.d.ts.map +1 -0
  423. package/lib/ir/ui/index.js +36 -0
  424. package/lib/ir/ui/index.js.map +1 -0
  425. package/lib/ir/ui/irActions.d.ts +52 -0
  426. package/lib/ir/ui/irActions.d.ts.map +1 -0
  427. package/lib/ir/ui/irActions.js +62 -0
  428. package/lib/ir/ui/irActions.js.map +1 -0
  429. package/lib/ir/ui/irChartProps.d.ts +116 -0
  430. package/lib/ir/ui/irChartProps.d.ts.map +1 -0
  431. package/lib/ir/ui/irChartProps.js +14 -0
  432. package/lib/ir/ui/irChartProps.js.map +1 -0
  433. package/lib/ir/ui/irCommandContext.d.ts +35 -0
  434. package/lib/ir/ui/irCommandContext.d.ts.map +1 -0
  435. package/lib/ir/ui/irCommandContext.js +44 -0
  436. package/lib/ir/ui/irCommandContext.js.map +1 -0
  437. package/lib/ir/ui/irStateContext.d.ts +26 -0
  438. package/lib/ir/ui/irStateContext.d.ts.map +1 -0
  439. package/lib/ir/ui/irStateContext.js +37 -0
  440. package/lib/ir/ui/irStateContext.js.map +1 -0
  441. package/lib/ir/ui/useIrEditor.d.ts +51 -0
  442. package/lib/ir/ui/useIrEditor.d.ts.map +1 -0
  443. package/lib/ir/ui/useIrEditor.js +88 -0
  444. package/lib/ir/ui/useIrEditor.js.map +1 -0
  445. package/lib/ir/ui/useIrPointer.d.ts +66 -0
  446. package/lib/ir/ui/useIrPointer.d.ts.map +1 -0
  447. package/lib/ir/ui/useIrPointer.js +53 -0
  448. package/lib/ir/ui/useIrPointer.js.map +1 -0
  449. package/lib/ir/ui/useIrShortcuts.d.ts +24 -0
  450. package/lib/ir/ui/useIrShortcuts.d.ts.map +1 -0
  451. package/lib/ir/ui/useIrShortcuts.js +73 -0
  452. package/lib/ir/ui/useIrShortcuts.js.map +1 -0
  453. package/lib/ir/ui/useIrZoom.d.ts +51 -0
  454. package/lib/ir/ui/useIrZoom.d.ts.map +1 -0
  455. package/lib/ir/ui/useIrZoom.js +46 -0
  456. package/lib/ir/ui/useIrZoom.js.map +1 -0
  457. package/lib/ir.d.ts +13 -0
  458. package/lib/ir.d.ts.map +1 -0
  459. package/lib/ir.js +13 -0
  460. package/lib/ir.js.map +1 -0
  461. package/lib/panel/core/dialogStyles.d.ts +13 -0
  462. package/lib/panel/core/dialogStyles.d.ts.map +1 -0
  463. package/lib/panel/core/dialogStyles.js +11 -0
  464. package/lib/panel/core/dialogStyles.js.map +1 -0
  465. package/lib/panel/core/index.d.ts +19 -0
  466. package/lib/panel/core/index.d.ts.map +1 -0
  467. package/lib/panel/core/index.js +18 -0
  468. package/lib/panel/core/index.js.map +1 -0
  469. package/lib/panel/core/isEditingField.d.ts +17 -0
  470. package/lib/panel/core/isEditingField.d.ts.map +1 -0
  471. package/lib/panel/core/isEditingField.js +25 -0
  472. package/lib/panel/core/isEditingField.js.map +1 -0
  473. package/lib/panel/core/panelStyles.d.ts +242 -0
  474. package/lib/panel/core/panelStyles.d.ts.map +1 -0
  475. package/lib/panel/core/panelStyles.js +228 -0
  476. package/lib/panel/core/panelStyles.js.map +1 -0
  477. package/lib/panel/core/rowSpacers.d.ts +38 -0
  478. package/lib/panel/core/rowSpacers.d.ts.map +1 -0
  479. package/lib/panel/core/rowSpacers.js +31 -0
  480. package/lib/panel/core/rowSpacers.js.map +1 -0
  481. package/lib/panel/core/statusBar.d.ts +44 -0
  482. package/lib/panel/core/statusBar.d.ts.map +1 -0
  483. package/lib/panel/core/statusBar.js +40 -0
  484. package/lib/panel/core/statusBar.js.map +1 -0
  485. package/lib/panel/core/textFilter.d.ts +22 -0
  486. package/lib/panel/core/textFilter.d.ts.map +1 -0
  487. package/lib/panel/core/textFilter.js +32 -0
  488. package/lib/panel/core/textFilter.js.map +1 -0
  489. package/lib/panel/core/yieldToPainting.d.ts +17 -0
  490. package/lib/panel/core/yieldToPainting.d.ts.map +1 -0
  491. package/lib/panel/core/yieldToPainting.js +21 -0
  492. package/lib/panel/core/yieldToPainting.js.map +1 -0
  493. package/lib/panel/ui/AboutDialogFrame.d.ts +36 -0
  494. package/lib/panel/ui/AboutDialogFrame.d.ts.map +1 -0
  495. package/lib/panel/ui/AboutDialogFrame.js +43 -0
  496. package/lib/panel/ui/AboutDialogFrame.js.map +1 -0
  497. package/lib/panel/ui/ClearButton.d.ts +28 -0
  498. package/lib/panel/ui/ClearButton.d.ts.map +1 -0
  499. package/lib/panel/ui/ClearButton.js +23 -0
  500. package/lib/panel/ui/ClearButton.js.map +1 -0
  501. package/lib/panel/ui/DocumentationDialogFrame.d.ts +39 -0
  502. package/lib/panel/ui/DocumentationDialogFrame.d.ts.map +1 -0
  503. package/lib/panel/ui/DocumentationDialogFrame.js +29 -0
  504. package/lib/panel/ui/DocumentationDialogFrame.js.map +1 -0
  505. package/lib/panel/ui/FilterInput.d.ts +31 -0
  506. package/lib/panel/ui/FilterInput.d.ts.map +1 -0
  507. package/lib/panel/ui/FilterInput.js +23 -0
  508. package/lib/panel/ui/FilterInput.js.map +1 -0
  509. package/lib/panel/ui/HelpLabel.d.ts +24 -0
  510. package/lib/panel/ui/HelpLabel.d.ts.map +1 -0
  511. package/lib/panel/ui/HelpLabel.js +23 -0
  512. package/lib/panel/ui/HelpLabel.js.map +1 -0
  513. package/lib/panel/ui/PanelMessage.d.ts +41 -0
  514. package/lib/panel/ui/PanelMessage.d.ts.map +1 -0
  515. package/lib/panel/ui/PanelMessage.js +30 -0
  516. package/lib/panel/ui/PanelMessage.js.map +1 -0
  517. package/lib/panel/ui/PanelRail.d.ts +41 -0
  518. package/lib/panel/ui/PanelRail.d.ts.map +1 -0
  519. package/lib/panel/ui/PanelRail.js +12 -0
  520. package/lib/panel/ui/PanelRail.js.map +1 -0
  521. package/lib/panel/ui/Section.d.ts +25 -0
  522. package/lib/panel/ui/Section.d.ts.map +1 -0
  523. package/lib/panel/ui/Section.js +41 -0
  524. package/lib/panel/ui/Section.js.map +1 -0
  525. package/lib/panel/ui/SidePanelStack.d.ts +62 -0
  526. package/lib/panel/ui/SidePanelStack.d.ts.map +1 -0
  527. package/lib/panel/ui/SidePanelStack.js +40 -0
  528. package/lib/panel/ui/SidePanelStack.js.map +1 -0
  529. package/lib/panel/ui/SpectrumColorSwatch.d.ts +33 -0
  530. package/lib/panel/ui/SpectrumColorSwatch.d.ts.map +1 -0
  531. package/lib/panel/ui/SpectrumColorSwatch.js +76 -0
  532. package/lib/panel/ui/SpectrumColorSwatch.js.map +1 -0
  533. package/lib/panel/ui/index.d.ts +37 -0
  534. package/lib/panel/ui/index.d.ts.map +1 -0
  535. package/lib/panel/ui/index.js +24 -0
  536. package/lib/panel/ui/index.js.map +1 -0
  537. package/lib/panel/ui/useConfirmOnEnter.d.ts +19 -0
  538. package/lib/panel/ui/useConfirmOnEnter.d.ts.map +1 -0
  539. package/lib/panel/ui/useConfirmOnEnter.js +64 -0
  540. package/lib/panel/ui/useConfirmOnEnter.js.map +1 -0
  541. package/lib/panel/ui/useFilterBox.d.ts +23 -0
  542. package/lib/panel/ui/useFilterBox.d.ts.map +1 -0
  543. package/lib/panel/ui/useFilterBox.js +22 -0
  544. package/lib/panel/ui/useFilterBox.js.map +1 -0
  545. package/lib/panel/ui/useVirtualRows.d.ts +46 -0
  546. package/lib/panel/ui/useVirtualRows.d.ts.map +1 -0
  547. package/lib/panel/ui/useVirtualRows.js +56 -0
  548. package/lib/panel/ui/useVirtualRows.js.map +1 -0
  549. package/lib/panel/ui/useVirtualWindowRows.d.ts +40 -0
  550. package/lib/panel/ui/useVirtualWindowRows.d.ts.map +1 -0
  551. package/lib/panel/ui/useVirtualWindowRows.js +65 -0
  552. package/lib/panel/ui/useVirtualWindowRows.js.map +1 -0
  553. package/lib/ui.d.ts +1 -0
  554. package/lib/ui.d.ts.map +1 -1
  555. package/lib/ui.js +1 -0
  556. package/lib/ui.js.map +1 -1
  557. package/package.json +8 -1
  558. package/src/chart/core/axisLabels.ts +117 -0
  559. package/src/chart/core/boxLayout.ts +126 -0
  560. package/src/chart/core/chartAxisScale.ts +92 -10
  561. package/src/chart/core/chartDomain.ts +185 -0
  562. package/src/chart/core/chartGeometry.ts +159 -0
  563. package/src/chart/core/chartPane.ts +10 -0
  564. package/src/chart/core/chartScale.ts +7 -4
  565. package/src/chart/core/chartTheme.ts +161 -0
  566. package/src/chart/core/chartViewport.ts +40 -13
  567. package/src/chart/core/guidePlacement.ts +66 -0
  568. package/src/chart/core/index.ts +121 -2
  569. package/src/chart/core/labelStack.ts +72 -0
  570. package/src/chart/core/legendBox.ts +263 -0
  571. package/src/chart/core/selectionGeometry.ts +68 -0
  572. package/src/chart/core/spectrumColor.ts +129 -0
  573. package/src/chart/core/stackCapacity.ts +162 -0
  574. package/src/chart/core/svgPoint.ts +77 -0
  575. package/src/chart/core/tracePath.ts +228 -0
  576. package/src/chart/core/trackerReadout.ts +78 -0
  577. package/src/chart/core/viewTransform.ts +287 -0
  578. package/src/chart/core/zoomDomain.ts +235 -0
  579. package/src/chart/ui/Axes.tsx +361 -0
  580. package/src/chart/ui/AxisGuide.tsx +187 -0
  581. package/src/chart/ui/ChartStack.tsx +130 -0
  582. package/src/chart/ui/ChartTracker.tsx +101 -0
  583. package/src/chart/ui/PlotCaption.tsx +108 -0
  584. package/src/chart/ui/SelectionRect.tsx +52 -0
  585. package/src/chart/ui/TraceLegend.tsx +193 -0
  586. package/src/chart/ui/chartGestures.ts +270 -0
  587. package/src/chart/ui/chartStackLevel.tsx +210 -0
  588. package/src/chart/ui/chartSurface.ts +66 -0
  589. package/src/chart/ui/index.ts +35 -0
  590. package/src/chart/ui/useChartPointer.ts +223 -0
  591. package/src/chart/ui/useChartSize.ts +115 -0
  592. package/src/chart/ui/useChartWindow.ts +240 -0
  593. package/src/chart/ui/useChartZoom.ts +255 -0
  594. package/src/chart/ui/useWheelListener.ts +62 -0
  595. package/src/clipboard/core/copyPng.ts +20 -0
  596. package/src/clipboard/core/index.ts +1 -0
  597. package/src/clipboard/ui/CopyableValue.tsx +22 -35
  598. package/src/core.ts +1 -0
  599. package/src/download/core/exportStyles.ts +20 -0
  600. package/src/download/core/imageResolution.ts +118 -0
  601. package/src/download/core/index.ts +34 -0
  602. package/src/download/core/pictureExport.ts +207 -0
  603. package/src/download/core/stackedDrawing.ts +108 -0
  604. package/src/download/core/svgBounds.ts +80 -0
  605. package/src/download/core/svgNamespace.ts +9 -0
  606. package/src/download/core/svgToPng.ts +121 -0
  607. package/src/download/core/svgToString.ts +95 -0
  608. package/src/download/ui/ExportDialogFrame.tsx +86 -0
  609. package/src/download/ui/ExportImageDialog.tsx +91 -0
  610. package/src/download/ui/ExportNameField.tsx +148 -0
  611. package/src/download/ui/ExportPictureSection.tsx +142 -0
  612. package/src/download/ui/index.ts +11 -0
  613. package/src/download/ui/useDrawingBox.ts +37 -0
  614. package/src/error/core/describeSource.ts +18 -0
  615. package/src/error/core/index.ts +1 -0
  616. package/src/help/ui/HelpBody.tsx +41 -2
  617. package/src/help/ui/index.ts +6 -1
  618. package/src/ir/core/analysisSpectra.ts +231 -0
  619. package/src/ir/core/assignBands.ts +144 -0
  620. package/src/ir/core/bandAssignments.ts +329 -0
  621. package/src/ir/core/bandLabelPlan.ts +194 -0
  622. package/src/ir/core/detectIrFormat.ts +139 -0
  623. package/src/ir/core/downloadSpectra.ts +57 -0
  624. package/src/ir/core/fromJcamp.ts +70 -0
  625. package/src/ir/core/fromSpc.ts +61 -0
  626. package/src/ir/core/index.ts +113 -0
  627. package/src/ir/core/irBand.ts +57 -0
  628. package/src/ir/core/irCommands.ts +154 -0
  629. package/src/ir/core/irDomain.ts +163 -0
  630. package/src/ir/core/irEditorApi.ts +44 -0
  631. package/src/ir/core/irFormat.ts +57 -0
  632. package/src/ir/core/irMode.ts +203 -0
  633. package/src/ir/core/irReducer.ts +273 -0
  634. package/src/ir/core/irSidePanels.ts +20 -0
  635. package/src/ir/core/irSpectrum.ts +155 -0
  636. package/src/ir/core/irState.ts +173 -0
  637. package/src/ir/core/loadIrSpectra.ts +79 -0
  638. package/src/ir/core/nearestBand.ts +57 -0
  639. package/src/ir/core/pickBands.ts +181 -0
  640. package/src/ir/core/spectrumJcamp.ts +178 -0
  641. package/src/ir/core/toIrSpectrum.ts +102 -0
  642. package/src/ir/ui/BandMarks.tsx +166 -0
  643. package/src/ir/ui/BandsPanel.tsx +271 -0
  644. package/src/ir/ui/IrAboutDialog.tsx +121 -0
  645. package/src/ir/ui/IrCanvas.tsx +91 -0
  646. package/src/ir/ui/IrChart.tsx +215 -0
  647. package/src/ir/ui/IrCommandProvider.tsx +32 -0
  648. package/src/ir/ui/IrCommandTooltip.tsx +36 -0
  649. package/src/ir/ui/IrDocumentationDialog.tsx +174 -0
  650. package/src/ir/ui/IrEditor.tsx +99 -0
  651. package/src/ir/ui/IrHeader.tsx +39 -0
  652. package/src/ir/ui/IrLogo.tsx +49 -0
  653. package/src/ir/ui/IrPointerTracker.tsx +102 -0
  654. package/src/ir/ui/IrShell.tsx +285 -0
  655. package/src/ir/ui/IrSidePanel.tsx +78 -0
  656. package/src/ir/ui/IrStateProvider.tsx +32 -0
  657. package/src/ir/ui/IrStatusBar.tsx +97 -0
  658. package/src/ir/ui/IrToolbar.tsx +102 -0
  659. package/src/ir/ui/IrTraces.tsx +134 -0
  660. package/src/ir/ui/MetadataPanel.tsx +88 -0
  661. package/src/ir/ui/SpectraPanel.tsx +114 -0
  662. package/src/ir/ui/SpectrumRow.tsx +127 -0
  663. package/src/ir/ui/index.ts +56 -0
  664. package/src/ir/ui/irActions.ts +103 -0
  665. package/src/ir/ui/irChartProps.ts +118 -0
  666. package/src/ir/ui/irCommandContext.tsx +62 -0
  667. package/src/ir/ui/irStateContext.ts +48 -0
  668. package/src/ir/ui/useIrEditor.ts +139 -0
  669. package/src/ir/ui/useIrPointer.ts +109 -0
  670. package/src/ir/ui/useIrShortcuts.ts +95 -0
  671. package/src/ir/ui/useIrZoom.ts +86 -0
  672. package/src/ir.ts +13 -0
  673. package/src/panel/core/dialogStyles.ts +11 -0
  674. package/src/panel/core/index.ts +47 -0
  675. package/src/panel/core/isEditingField.ts +23 -0
  676. package/src/panel/core/panelStyles.ts +248 -0
  677. package/src/panel/core/rowSpacers.ts +50 -0
  678. package/src/panel/core/statusBar.ts +48 -0
  679. package/src/panel/core/textFilter.ts +33 -0
  680. package/src/panel/core/yieldToPainting.ts +20 -0
  681. package/src/panel/ui/AboutDialogFrame.tsx +100 -0
  682. package/src/panel/ui/ClearButton.tsx +42 -0
  683. package/src/panel/ui/DocumentationDialogFrame.tsx +86 -0
  684. package/src/panel/ui/FilterInput.tsx +60 -0
  685. package/src/panel/ui/HelpLabel.tsx +43 -0
  686. package/src/panel/ui/PanelMessage.tsx +64 -0
  687. package/src/panel/ui/PanelRail.tsx +64 -0
  688. package/src/panel/ui/Section.tsx +66 -0
  689. package/src/panel/ui/SidePanelStack.tsx +109 -0
  690. package/src/panel/ui/SpectrumColorSwatch.tsx +119 -0
  691. package/src/panel/ui/index.ts +47 -0
  692. package/src/panel/ui/useConfirmOnEnter.ts +68 -0
  693. package/src/panel/ui/useFilterBox.ts +35 -0
  694. package/src/panel/ui/useVirtualRows.ts +82 -0
  695. package/src/panel/ui/useVirtualWindowRows.ts +86 -0
  696. package/src/ui.ts +1 -0
@@ -0,0 +1,69 @@
1
+ /** Marks the group holding what a drawing is of, as opposed to its canvas. */
2
+ export const CONTENT_ATTRIBUTE = 'data-export-content';
3
+ /**
4
+ * The rectangle the drawing itself occupies, rather than the one on screen.
5
+ *
6
+ * A canvas is mostly empty space to draw into: what is on screen is a window
7
+ * over it, wherever it was last panned to and however far it was zoomed. None
8
+ * of that belongs in a file, so a picture is written out from the drawing
9
+ * outwards — the group it is drawn in is measured, and the window is ignored.
10
+ * Whatever is written on it is measured with it, so a name hanging under the
11
+ * bottom of the drawing is not cut off.
12
+ *
13
+ * An SVG that marks no such group — a molecule depiction, which is drawn to the
14
+ * size of its box and nothing else — is measured whole. What is left out there
15
+ * is only the room the drawing already left around itself.
16
+ * @param svg - The element to measure, as it is rendered.
17
+ * @param padding - Room left around the symbols, in drawing units. Defaults to
18
+ * `0`.
19
+ * @returns The rectangle, or `null` when nothing is drawn or the element is not
20
+ * rendered — a measurement is only ever taken of something on screen.
21
+ */
22
+ export function contentBox(svg, padding = 0) {
23
+ const marked = svg.querySelector(`[${CSS.escape(CONTENT_ATTRIBUTE)}]`);
24
+ const content = marked instanceof SVGGraphicsElement ? marked : svg;
25
+ const box = content.getBBox();
26
+ if (box.width <= 0 || box.height <= 0)
27
+ return null;
28
+ return {
29
+ x: box.x - padding,
30
+ y: box.y - padding,
31
+ width: box.width + padding * 2,
32
+ height: box.height + padding * 2,
33
+ };
34
+ }
35
+ /**
36
+ * The rectangle the element itself covers, rather than the marks inside it.
37
+ *
38
+ * A chart is drawn to the box it was given — its axes reach the edges of it and
39
+ * its trace reaches wherever the data does — so the box is the picture, and
40
+ * measuring the marks would crop the frame off it. It is measured where it is
41
+ * on the page, and read off its own attributes where it is not: a picture of a
42
+ * stacked editor is composed out of the panes rather than being any one element
43
+ * on screen, so it never has a place on the page to be measured at and carries
44
+ * the size it was composed at instead.
45
+ * @param svg - The element to measure.
46
+ * @returns The rectangle, or `null` when it is neither laid out nor sized.
47
+ */
48
+ export function elementBox(svg) {
49
+ const laidOut = svg.getBoundingClientRect();
50
+ if (laidOut.width > 0 && laidOut.height > 0) {
51
+ return { x: 0, y: 0, width: laidOut.width, height: laidOut.height };
52
+ }
53
+ const width = statedSide(svg, 'width');
54
+ const height = statedSide(svg, 'height');
55
+ if (width <= 0 || height <= 0)
56
+ return null;
57
+ return { x: 0, y: 0, width, height };
58
+ }
59
+ /**
60
+ * A side the element states for itself, for one that is not on the page.
61
+ * @param svg - The element.
62
+ * @param name - Which side to read.
63
+ * @returns Its length in drawing units, `0` when it states none.
64
+ */
65
+ function statedSide(svg, name) {
66
+ const stated = Number.parseFloat(svg.getAttribute(name) ?? '');
67
+ return Number.isFinite(stated) ? stated : 0;
68
+ }
69
+ //# sourceMappingURL=svgBounds.js.map
@@ -0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tE,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACzC,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3C,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,SAAS,UAAU,CAAC,GAAkB,EAAE,IAAwB;IAC9D,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The namespace every SVG element is created in.
3
+ *
4
+ * `document.createElementNS` needs it to make an element the browser draws
5
+ * rather than an unknown tag, and a file written out needs it declared on the
6
+ * root or nothing will open it.
7
+ */
8
+ export declare const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
9
+ //# sourceMappingURL=svgNamespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgNamespace.d.ts","sourceRoot":"","sources":["../../../src/download/core/svgNamespace.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,aAAa,+BAA+B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The namespace every SVG element is created in.
3
+ *
4
+ * `document.createElementNS` needs it to make an element the browser draws
5
+ * rather than an unknown tag, and a file written out needs it declared on the
6
+ * root or nothing will open it.
7
+ */
8
+ // eslint-disable-next-line unicorn/prefer-https -- the SVG namespace is a fixed identifier, not a URL to fetch
9
+ export const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
10
+ //# sourceMappingURL=svgNamespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgNamespace.js","sourceRoot":"","sources":["../../../src/download/core/svgNamespace.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,+GAA+G;AAC/G,MAAM,CAAC,MAAM,aAAa,GAAG,4BAA4B,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { SvgBox } from './svgBounds.ts';
2
+ export interface PngOptions {
3
+ /**
4
+ * The rectangle of the drawing to rasterize, in drawing units.
5
+ * @default what the element is currently showing
6
+ */
7
+ box?: SvgBox | null;
8
+ /**
9
+ * How wide the PNG is, in pixels.
10
+ * @default the width the element is drawn at, times `scale`
11
+ */
12
+ width?: number;
13
+ /**
14
+ * How tall the PNG is, in pixels.
15
+ * @default the height the element is drawn at, times `scale`
16
+ */
17
+ height?: number;
18
+ /**
19
+ * How many device pixels to give each pixel of the drawing, when no size is
20
+ * given.
21
+ * @default 2
22
+ */
23
+ scale?: number;
24
+ /**
25
+ * What the picture is read out as, in the document it is rasterized from.
26
+ * @default the label the element already carries
27
+ */
28
+ label?: string;
29
+ }
30
+ /**
31
+ * Rasterize a rendered SVG element to a PNG.
32
+ *
33
+ * This is the one place in the package a bitmap is made, and it is made only on
34
+ * the way out: everything is drawn as SVG so it stays sharp at any zoom, and a
35
+ * PNG exists for the places a vector cannot be pasted into. Asked for no size
36
+ * it is drawn at twice the size it is shown at, so it is still readable on a
37
+ * retina screen and survives being scaled up a little in a slide.
38
+ * @param svg - The element to rasterize, as it is rendered.
39
+ * @param options - What part of it to rasterize, and how big.
40
+ * @returns The PNG.
41
+ */
42
+ export declare function svgToPng(svg: SVGSVGElement, options?: PngOptions): Promise<Blob>;
43
+ //# sourceMappingURL=svgToPng.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgToPng.d.ts","sourceRoot":"","sources":["../../../src/download/core/svgToPng.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAM7C,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,aAAa,EAClB,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
@@ -0,0 +1,79 @@
1
+ import { svgToString } from "./svgToString.js";
2
+ /** How many device pixels a PNG gets per pixel the drawing is shown at. */
3
+ const DEFAULT_SCALE = 2;
4
+ /**
5
+ * Rasterize a rendered SVG element to a PNG.
6
+ *
7
+ * This is the one place in the package a bitmap is made, and it is made only on
8
+ * the way out: everything is drawn as SVG so it stays sharp at any zoom, and a
9
+ * PNG exists for the places a vector cannot be pasted into. Asked for no size
10
+ * it is drawn at twice the size it is shown at, so it is still readable on a
11
+ * retina screen and survives being scaled up a little in a slide.
12
+ * @param svg - The element to rasterize, as it is rendered.
13
+ * @param options - What part of it to rasterize, and how big.
14
+ * @returns The PNG.
15
+ */
16
+ export async function svgToPng(svg, options = {}) {
17
+ const { box = null, width, height, scale = DEFAULT_SCALE, label } = options;
18
+ const rendered = svg.getBoundingClientRect();
19
+ const pixelWidth = side(width ?? (box?.width ?? rendered.width) * scale);
20
+ const pixelHeight = side(height ?? (box?.height ?? rendered.height) * scale);
21
+ // The document is written at the size the PNG is asked for rather than blown
22
+ // up afterwards: the shapes are rasterized once, at the final size, so the
23
+ // symbols and their labels stay sharp however big the picture is.
24
+ const image = await loadImage(svgToString(svg, { box, width: pixelWidth, height: pixelHeight, label }));
25
+ const canvas = document.createElement('canvas');
26
+ canvas.width = pixelWidth;
27
+ canvas.height = pixelHeight;
28
+ const context = canvas.getContext('2d');
29
+ if (!context)
30
+ throw new Error('The browser gave no drawing context.');
31
+ // A PNG carries an alpha channel and the structure is drawn in black, so a
32
+ // background left transparent comes out black on black wherever it is pasted.
33
+ context.fillStyle = '#ffffff';
34
+ context.fillRect(0, 0, canvas.width, canvas.height);
35
+ context.drawImage(image, 0, 0, canvas.width, canvas.height);
36
+ return await toPngBlob(canvas);
37
+ }
38
+ /**
39
+ * A side of the picture, in whole pixels.
40
+ * @param value - How long it is.
41
+ * @returns Whole pixels, never zero: a canvas sized zero rasterizes nothing.
42
+ */
43
+ function side(value) {
44
+ return Math.max(1, Math.round(value));
45
+ }
46
+ /**
47
+ * Load an SVG document as an image.
48
+ * @param source - The SVG document.
49
+ * @returns The image, already decoded, so it can be drawn straight away.
50
+ */
51
+ async function loadImage(source) {
52
+ const url = URL.createObjectURL(new Blob([source], { type: 'image/svg+xml' }));
53
+ try {
54
+ const image = new Image();
55
+ image.src = url;
56
+ await image.decode();
57
+ return image;
58
+ }
59
+ finally {
60
+ // The decoded image no longer needs the URL it came from.
61
+ URL.revokeObjectURL(url);
62
+ }
63
+ }
64
+ /**
65
+ * Read a canvas back as a PNG.
66
+ * @param canvas - What was drawn.
67
+ * @returns The PNG.
68
+ */
69
+ async function toPngBlob(canvas) {
70
+ return await new Promise((resolve, reject) => {
71
+ canvas.toBlob((blob) => {
72
+ if (blob)
73
+ resolve(blob);
74
+ else
75
+ reject(new Error('The browser produced no PNG.'));
76
+ }, 'image/png');
77
+ });
78
+ }
79
+ //# sourceMappingURL=svgToPng.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgToPng.js","sourceRoot":"","sources":["../../../src/download/core/svgToPng.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,2EAA2E;AAC3E,MAAM,aAAa,GAAG,CAAC,CAAC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umentOptions {
3
+ /**
4
+ * The rectangle of the drawing to write out, in drawing units.
5
+ * @default what the element is currently showing
6
+ */
7
+ box?: SvgBox | null;
8
+ /**
9
+ * How wide the document is, in pixels.
10
+ * @default the width the element is drawn at
11
+ */
12
+ width?: number;
13
+ /**
14
+ * How tall the document is, in pixels.
15
+ * @default the height the element is drawn at
16
+ */
17
+ height?: number;
18
+ /**
19
+ * What the document is read out as. Given one, the copy becomes a picture
20
+ * rather than the thing on screen: it is no longer reachable by the keyboard,
21
+ * and it is described as what it shows rather than as what could be done to
22
+ * it.
23
+ * @default the label the element already carries
24
+ */
25
+ label?: string;
26
+ }
27
+ /**
28
+ * Write a rendered SVG element out as a standalone SVG document.
29
+ *
30
+ * On the page the element takes its size from the box it sits in, which is not
31
+ * something that travels with it: opened on its own the same markup would be
32
+ * sized by whatever it is opened in. The copy therefore carries a size, as
33
+ * attributes, so the file is a picture rather than a drawing to be laid out
34
+ * again.
35
+ *
36
+ * A rectangle can be given to write out part of the drawing — the symbols
37
+ * rather than the canvas around them — and a size to write it out bigger than
38
+ * it is on screen. Neither turns the picture into pixels: an SVG holds shapes,
39
+ * so the numbers only say how big it opens.
40
+ * @param svg - The element to write out, as it is rendered.
41
+ * @param options - What part of it to write out, and how big.
42
+ * @returns The SVG document, ready to be saved or rasterized.
43
+ */
44
+ export declare function svgToString(svg: SVGSVGElement, options?: SvgDocumentOptions): string;
45
+ //# sourceMappingURL=svgToString.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgToString.d.ts","sourceRoot":"","sources":["../../../src/download/core/svgToString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG7C,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,aAAa,EAClB,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CA2BR"}
@@ -0,0 +1,58 @@
1
+ import { SVG_NAMESPACE } from "./svgNamespace.js";
2
+ /**
3
+ * Write a rendered SVG element out as a standalone SVG document.
4
+ *
5
+ * On the page the element takes its size from the box it sits in, which is not
6
+ * something that travels with it: opened on its own the same markup would be
7
+ * sized by whatever it is opened in. The copy therefore carries a size, as
8
+ * attributes, so the file is a picture rather than a drawing to be laid out
9
+ * again.
10
+ *
11
+ * A rectangle can be given to write out part of the drawing — the symbols
12
+ * rather than the canvas around them — and a size to write it out bigger than
13
+ * it is on screen. Neither turns the picture into pixels: an SVG holds shapes,
14
+ * so the numbers only say how big it opens.
15
+ * @param svg - The element to write out, as it is rendered.
16
+ * @param options - What part of it to write out, and how big.
17
+ * @returns The SVG document, ready to be saved or rasterized.
18
+ */
19
+ export function svgToString(svg, options = {}) {
20
+ const { box = null, width, height, label } = options;
21
+ const clone = svg.cloneNode(true);
22
+ if (label !== undefined) {
23
+ clone.setAttribute('role', 'img');
24
+ clone.setAttribute('aria-label', label);
25
+ // A canvas is focused to be drawn on; a file of it is only looked at.
26
+ clone.removeAttribute('tabindex');
27
+ }
28
+ const rendered = svg.getBoundingClientRect();
29
+ const drawnWidth = side(width ?? box?.width ?? rendered.width);
30
+ const drawnHeight = side(height ?? box?.height ?? rendered.height);
31
+ clone.setAttribute('xmlns', SVG_NAMESPACE);
32
+ clone.setAttribute('width', String(drawnWidth));
33
+ clone.setAttribute('height', String(drawnHeight));
34
+ if (box) {
35
+ clone.setAttribute('viewBox', `${round(box.x)} ${round(box.y)} ${round(box.width)} ${round(box.height)}`);
36
+ }
37
+ else if (!clone.hasAttribute('viewBox')) {
38
+ clone.setAttribute('viewBox', `0 0 ${drawnWidth} ${drawnHeight}`);
39
+ }
40
+ return new XMLSerializer().serializeToString(clone);
41
+ }
42
+ /**
43
+ * A side of the document, as an attribute takes it.
44
+ * @param value - How long it is.
45
+ * @returns Whole pixels, never zero: a document sized zero is an empty file.
46
+ */
47
+ function side(value) {
48
+ return Math.max(1, Math.round(value));
49
+ }
50
+ /**
51
+ * A drawing coordinate, short enough to read.
52
+ * @param value - The coordinate.
53
+ * @returns It, to two decimals.
54
+ */
55
+ function round(value) {
56
+ return Math.round(value * 100) / 100;
57
+ }
58
+ //# sourceMappingURL=svgToString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgToString.js","sourceRoot":"","sources":["../../../src/download/core/svgToString.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA4BlD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CACzB,GAAkB,EAClB,UAA8B,EAAE;IAEhC,MAAM,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAErD,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,CAAkB,CAAC;IACnD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAClC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QACxC,sEAAsE;QACtE,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,QAAQ,GAAG,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,EAAE,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,EAAE,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEnE,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC3C,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAChD,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IAClD,IAAI,GAAG,EAAE,CAAC;QACR,KAAK,CAAC,YAAY,CAChB,SAAS,EACT,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAC3E,CAAC;IACJ,CAAC;SAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,UAAU,IAAI,WAAW,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,IAAI,aAAa,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,SAAS,IAAI,CAAC,KAAa;IACzB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { IconName } from '@blueprintjs/core';
2
+ import type { ReactNode } from 'react';
3
+ export interface ExportDialogFrameProps {
4
+ /** Whether the dialog is showing. */
5
+ isOpen: boolean;
6
+ /** What it is about, along the top. */
7
+ title: string;
8
+ /** The icon beside that title. */
9
+ icon: IconName;
10
+ /**
11
+ * The name saved files take, without their extension; the section is keyed on
12
+ * it, so a file saved under a new name is what the name box opens on next
13
+ * time rather than what was typed and then thought better of.
14
+ */
15
+ filename: string;
16
+ /**
17
+ * How wide the dialog opens, in pixels. A section showing text needs the room
18
+ * to show a molfile line whole; one showing controls does not.
19
+ * @default 560
20
+ */
21
+ width?: number;
22
+ /**
23
+ * Whether the section is mounted only while the dialog is open, for a section
24
+ * whose work — measuring a picture off the page — is only worth doing while
25
+ * it is being looked at.
26
+ * @default false
27
+ */
28
+ mountWhileOpen?: boolean;
29
+ /** The section, built with the status setter the footer reads. */
30
+ children: (onStatus: (status: string) => void) => ReactNode;
31
+ /** Called when the dialog is dismissed. */
32
+ onClose: () => void;
33
+ }
34
+ /**
35
+ * The frame every export dialog shares: the section, and what it last did.
36
+ *
37
+ * Each thing the editor writes out gets a dialog of its own rather than one
38
+ * shared dialog of tabs, since a picture, a structure and a sequence are asked
39
+ * for at different moments; what they have in common is only the frame, which
40
+ * is here so the three cannot come to differ in how they close or where they
41
+ * say what they wrote.
42
+ * @param props - Component props.
43
+ * @returns The dialog.
44
+ */
45
+ export declare function ExportDialogFrame(props: ExportDialogFrameProps): import("react").JSX.Element;
46
+ //# sourceMappingURL=ExportDialogFrame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportDialogFrame.d.ts","sourceRoot":"","sources":["../../../src/download/ui/ExportDialogFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kEAAkE;IAClE,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,SAAS,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAgC9D"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
3
+ import { useState } from 'react';
4
+ import { useConfirmOnEnter } from "../../panel/ui/useConfirmOnEnter.js";
5
+ import { exportNoteStyle } from "../core/exportStyles.js";
6
+ /**
7
+ * The frame every export dialog shares: the section, and what it last did.
8
+ *
9
+ * Each thing the editor writes out gets a dialog of its own rather than one
10
+ * shared dialog of tabs, since a picture, a structure and a sequence are asked
11
+ * for at different moments; what they have in common is only the frame, which
12
+ * is here so the three cannot come to differ in how they close or where they
13
+ * say what they wrote.
14
+ * @param props - Component props.
15
+ * @returns The dialog.
16
+ */
17
+ export function ExportDialogFrame(props) {
18
+ const { isOpen, title, icon, filename, width = DEFAULT_WIDTH, mountWhileOpen = false, children, onClose, } = props;
19
+ const [status, setStatus] = useState(null);
20
+ useConfirmOnEnter(isOpen, onClose);
21
+ return (_jsxs(Dialog, { isOpen: isOpen, title: title, icon: icon, style: { width, maxWidth: '92vw' }, onClose: onClose, children: [_jsx(DialogBody, { children: mountWhileOpen && !isOpen ? null : children(setStatus) }, filename), _jsx(DialogFooter, { actions: _jsx(Button, { text: "Close", onClick: onClose }), children: _jsx("span", { style: exportNoteStyle, children: status }) })] }));
22
+ }
23
+ const DEFAULT_WIDTH = 560;
24
+ //# sourceMappingURL=ExportDialogFrame.js.map
@@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AC"}
@@ -0,0 +1,47 @@
1
+ import type { PictureFrame } from '../core/pictureExport.ts';
2
+ export interface ExportImageDialogProps {
3
+ /** Whether the dialog is showing. */
4
+ isOpen: boolean;
5
+ /**
6
+ * The drawing the picture is taken of, as it is rendered. Read when a button
7
+ * is pressed rather than passed in, since a drawing is laid out again on
8
+ * every resize. `null` when nothing is drawn.
9
+ */
10
+ getDrawing: () => SVGSVGElement | null;
11
+ /**
12
+ * The name saved files take, without their extension.
13
+ * @default 'picture'
14
+ */
15
+ filename?: string;
16
+ /**
17
+ * What the picture is read out as in the file it is written to, in place of
18
+ * the instructions the element carries for whoever is working it.
19
+ * @default 'Drawing'
20
+ */
21
+ label?: string;
22
+ /**
23
+ * Whether the picture is the drawing inside the element — a canvas, which is
24
+ * mostly the empty space around what is on it — or the element as it is laid
25
+ * out, which is what a chart drawn to the box it was given is.
26
+ * @default 'content'
27
+ */
28
+ frame?: PictureFrame;
29
+ /** Called when the dialog is dismissed. */
30
+ onClose: () => void;
31
+ }
32
+ /**
33
+ * A drawing as a picture: PNG at a chosen resolution, or SVG.
34
+ *
35
+ * How big it comes out is asked rather than guessed, since only one size could
36
+ * be the default and neither a figure nor a thumbnail is it. SVG is the honest
37
+ * answer wherever it is accepted — it is drawn again at whatever size it is
38
+ * printed — so the resolution there is only the size the file opens at.
39
+ *
40
+ * The same dialog writes out a glycan, a molecule and a spectrum, because none
41
+ * of what it does depends on what is drawn: it is handed an SVG element that is
42
+ * already on the page, and asks it how big it is.
43
+ * @param props - Component props.
44
+ * @returns The dialog.
45
+ */
46
+ export declare function ExportImageDialog(props: ExportImageDialogProps): import("react").JSX.Element;
47
+ //# sourceMappingURL=ExportImageDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportImageDialog.d.ts","sourceRoot":"","sources":["../../../src/download/ui/ExportImageDialog.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,UAAU,EAAE,MAAM,aAAa,GAAG,IAAI,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,2CAA2C;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAqC9D"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { DEFAULT_IMAGE_RESOLUTION } from "../core/imageResolution.js";
4
+ import { ExportDialogFrame } from "./ExportDialogFrame.js";
5
+ import { ExportPictureSection } from "./ExportPictureSection.js";
6
+ /**
7
+ * A drawing as a picture: PNG at a chosen resolution, or SVG.
8
+ *
9
+ * How big it comes out is asked rather than guessed, since only one size could
10
+ * be the default and neither a figure nor a thumbnail is it. SVG is the honest
11
+ * answer wherever it is accepted — it is drawn again at whatever size it is
12
+ * printed — so the resolution there is only the size the file opens at.
13
+ *
14
+ * The same dialog writes out a glycan, a molecule and a spectrum, because none
15
+ * of what it does depends on what is drawn: it is handed an SVG element that is
16
+ * already on the page, and asks it how big it is.
17
+ * @param props - Component props.
18
+ * @returns The dialog.
19
+ */
20
+ export function ExportImageDialog(props) {
21
+ const { isOpen, getDrawing, filename = 'picture', label = 'Drawing', frame, onClose, } = props;
22
+ const [resolutionId, setResolutionId] = useState(DEFAULT_IMAGE_RESOLUTION.id);
23
+ return (_jsx(ExportDialogFrame, { isOpen: isOpen, title: "Export as an image", icon: "media", filename: filename, width: 460, mountWhileOpen: true, onClose: onClose, children: (onStatus) => (_jsx(ExportPictureSection, { getDrawing: getDrawing, resolutionId: resolutionId, onResolutionChange: setResolutionId, filename: filename, label: label, frame: frame, onStatus: onStatus })) }));
24
+ }
25
+ //# sourceMappingURL=ExportImageDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportImageDialog.js","sourceRoot":"","sources":["../../../src/download/ui/ExportImageDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA4B,CAAC;AAiClE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,GAAG,SAAS,EACpB,KAAK,GAAG,SAAS,EACjB,KAAK,EACL,OAAO,GACR,GAAG,KAAK,CAAC;IAEV,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAC9C,wBAAwB,CAAC,EAAE,CAC5B,CAAC;IAEF,OAAO,CACL,KAAC,iBAAiB,IAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAC,oBAAoB,EAC1B,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,GAAG,EACV,cAAc,QACd,OAAO,EAAE,OAAO,YAEf,CAAC,QAAQ,EAAE,EAAE,CAAC,CACb,KAAC,oBAAoB,IACnB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,eAAe,EACnC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,CACH,GACiB,CACrB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ export interface ExportNameFieldProps {
2
+ /** What is in the box, without an extension. */
3
+ name: string;
4
+ /**
5
+ * The extension the file is about to take, shown after what is typed.
6
+ * @default ''
7
+ */
8
+ extension?: string;
9
+ /** Called with what was typed. */
10
+ onChange: (name: string) => void;
11
+ }
12
+ /**
13
+ * What the file about to be written out is called.
14
+ *
15
+ * It sits at the right of the row of buttons, against the one that writes the
16
+ * file, because that is what it is about — copying takes no name, and puts
17
+ * itself at the other end of the row. The name the editor came in with is
18
+ * offered, since that is what a glycan is usually saved under, but a picture
19
+ * for a slide and a molfile for a docking run are rarely wanted under it.
20
+ *
21
+ * The box grows with what is typed, so the extension sits directly against the
22
+ * name and the two read as the one filename they are about to become. Held to a
23
+ * fixed width instead, the extension hangs at the far edge with the gap between
24
+ * them reading as part of neither.
25
+ * @param props - Component props.
26
+ * @returns The field.
27
+ */
28
+ export declare function ExportNameField(props: ExportNameFieldProps): import("react").JSX.Element;
29
+ //# sourceMappingURL=ExportNameField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportNameField.d.ts","sourceRoot":"","sources":["../../../src/download/ui/ExportNameField.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,+BAmD1D"}