@milaboratories/graph-maker 1.1.138 → 1.1.140

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 (253) hide show
  1. package/dist/GraphMaker/components/Chart.vue.d.ts.map +1 -1
  2. package/dist/GraphMaker/components/Chart.vue.js +1 -0
  3. package/dist/GraphMaker/components/Chart.vue.js.map +1 -1
  4. package/dist/GraphMaker/components/LassoControls/index.vue.js +15 -13
  5. package/dist/GraphMaker/components/LassoControls/index.vue.js.map +1 -1
  6. package/dist/GraphMaker/dataBindAes.d.ts +5 -5
  7. package/dist/GraphMaker/dataBindAes.d.ts.map +1 -1
  8. package/dist/GraphMaker/dataBindAes.js +52 -49
  9. package/dist/GraphMaker/dataBindAes.js.map +1 -1
  10. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js +14 -14
  11. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js.map +1 -1
  12. package/dist/GraphMaker/index.vue.d.ts.map +1 -1
  13. package/dist/GraphMaker/index.vue.js +125 -124
  14. package/dist/GraphMaker/index.vue.js.map +1 -1
  15. package/dist/GraphMaker/types.d.ts +1 -1
  16. package/dist/GraphMaker/types.d.ts.map +1 -1
  17. package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +6 -0
  18. package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts.map +1 -1
  19. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.d.ts +4 -8
  20. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.d.ts.map +1 -1
  21. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.js.map +1 -1
  22. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts +15 -0
  23. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts.map +1 -1
  24. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +12 -3
  25. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
  26. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +21 -0
  27. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
  28. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +10 -6
  29. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts.map +1 -1
  30. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +31 -13
  31. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
  32. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +56 -62
  33. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
  34. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +29 -13
  35. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map +1 -1
  36. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +20 -19
  37. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
  38. package/dist/GraphMaker/utils/loadUniqueValuesToSave.d.ts.map +1 -1
  39. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js +57 -54
  40. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js.map +1 -1
  41. package/dist/lib.js +1 -1
  42. package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js +5 -5
  43. package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js.map +1 -1
  44. package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js +95 -72
  45. package/dist/node_modules/@milaboratories/miplots4/dist/DataFrame.js.map +1 -1
  46. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +8 -5
  47. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js.map +1 -1
  48. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js +124 -122
  49. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/ChartRenderer.js.map +1 -1
  50. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js +72 -91
  51. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/Chart.js.map +1 -1
  52. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js +43 -41
  53. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/components/ChartsGroup.js.map +1 -1
  54. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js +28 -0
  55. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCellTooltip.js.map +1 -0
  56. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js +94 -0
  57. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getGroupedCellsData.js.map +1 -0
  58. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js +38 -34
  59. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js.map +1 -1
  60. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/utils/calculateCaptionTails.js.map +1 -1
  61. package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js +4 -22
  62. package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js.map +1 -1
  63. package/dist/node_modules/@milaboratories/miplots4/dist/common/Legend.js.map +1 -1
  64. package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js +11 -11
  65. package/dist/node_modules/@milaboratories/miplots4/dist/common/Tooltip.js.map +1 -1
  66. package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js +20 -0
  67. package/dist/node_modules/@milaboratories/miplots4/dist/common/useDataFrame.js.map +1 -0
  68. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js +181 -181
  69. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/ChartRenderer.js.map +1 -1
  70. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js +2 -2
  71. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/DendroSettingsImpl.js.map +1 -1
  72. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js +45 -45
  73. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Chart.js.map +1 -1
  74. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js +27 -27
  75. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Heatmap.js.map +1 -1
  76. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/Legend.js.map +1 -1
  77. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js +18 -18
  78. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/LinksGroup.js.map +1 -1
  79. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js +36 -36
  80. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/components/NodesGroup.js.map +1 -1
  81. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js +45 -41
  82. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHeatmapData.js.map +1 -1
  83. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js +33 -33
  84. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/getHierarchyData.js.map +1 -1
  85. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js +90 -93
  86. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js.map +1 -1
  87. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js +199 -198
  88. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js.map +1 -1
  89. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +17 -17
  90. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
  91. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/BoxElement.js.map +1 -1
  92. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +102 -99
  93. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
  94. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js +31 -36
  95. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/bar.js.map +1 -1
  96. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js +62 -74
  97. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/binnedDots.js.map +1 -1
  98. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js +52 -53
  99. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/boxes.js.map +1 -1
  100. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js +32 -32
  101. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/dots.js.map +1 -1
  102. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js +7 -6
  103. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js.map +1 -1
  104. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js +23 -23
  105. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/logo.js.map +1 -1
  106. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js +63 -63
  107. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/pairedPoints.js.map +1 -1
  108. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js +60 -64
  109. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/sina.js.map +1 -1
  110. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js +23 -23
  111. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedBar.js.map +1 -1
  112. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js +5 -5
  113. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/getOutliersBounds.js.map +1 -1
  114. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js +13 -13
  115. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/utils/splitTextByWidth.js.map +1 -1
  116. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +258 -256
  117. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
  118. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js +1 -1
  119. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
  120. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js +81 -79
  121. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
  122. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +140 -134
  123. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js.map +1 -1
  124. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js +17 -17
  125. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js.map +1 -1
  126. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +99 -95
  127. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
  128. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +32 -31
  129. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
  130. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js +1 -1
  131. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateAnnotationTitleSizes.js.map +1 -1
  132. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
  133. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js +143 -142
  134. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/ChartRenderer.js.map +1 -1
  135. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/HistogramSettingsImpl.js.map +1 -1
  136. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js +30 -30
  137. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/Chart.js.map +1 -1
  138. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/components/ChartsGroup.js +7 -7
  139. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js +53 -54
  140. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/getHistogramData.js.map +1 -1
  141. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js +62 -58
  142. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js.map +1 -1
  143. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/@d3fc/d3fc-axis/src/axisBase.js +7 -7
  144. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js +6 -12
  145. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-array/src/min.js.map +1 -1
  146. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-shape/src/line.js.map +1 -1
  147. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js +148 -0
  148. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/kdbush/index.js.map +1 -0
  149. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js +172 -168
  150. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ChartRenderer.js.map +1 -1
  151. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js +28 -28
  152. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
  153. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/Chart.js +11 -11
  154. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js +30 -29
  155. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartAxisTitles.js.map +1 -1
  156. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js +135 -153
  157. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartLayersData.js.map +1 -1
  158. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js +35 -32
  159. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTooltip.js.map +1 -1
  160. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js +27 -27
  161. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
  162. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/components/ChartsGroup.js +14 -14
  163. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/constants.js.map +1 -1
  164. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js +24 -25
  165. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js.map +1 -1
  166. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js +13 -13
  167. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js.map +1 -1
  168. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +69 -76
  169. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js.map +1 -1
  170. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js +85 -83
  171. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/linearRegression.js.map +1 -1
  172. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js +20 -20
  173. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createAesGetter.js.map +1 -1
  174. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js +50 -38
  175. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
  176. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js +11 -0
  177. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/formatColumnValue.js.map +1 -0
  178. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js +46 -56
  179. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/getVisibleLabels.js.map +1 -1
  180. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js +18 -0
  181. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js.map +1 -0
  182. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js +223 -205
  183. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  184. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js +26 -26
  185. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
  186. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js +42 -0
  187. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/colors.js.map +1 -0
  188. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js +84 -81
  189. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
  190. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/SVGLayer.js +11 -11
  191. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js +15 -14
  192. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
  193. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js +97 -118
  194. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js.map +1 -1
  195. package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js +3 -1
  196. package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js.map +1 -1
  197. package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js +1 -1
  198. package/dist/node_modules/@milaboratories/miplots4/dist/types/dendro.js.map +1 -1
  199. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +1 -1
  200. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
  201. package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +1 -1
  202. package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js.map +1 -1
  203. package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js +1 -1
  204. package/dist/node_modules/@milaboratories/miplots4/dist/types/histogram.js.map +1 -1
  205. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js +23 -17
  206. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js.map +1 -1
  207. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js +25 -19
  208. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js.map +1 -1
  209. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js +39 -0
  210. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/TextMeasurer.js.map +1 -0
  211. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js +101 -0
  212. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer/charToWidth.json.js.map +1 -0
  213. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js +4 -4
  214. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arrangeLegendParts.js.map +1 -1
  215. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js +7 -0
  216. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js.map +1 -0
  217. package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js +3 -3
  218. package/dist/node_modules/@milaboratories/miplots4/dist/utils/getLegendWidth.js.map +1 -1
  219. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +1111 -1097
  220. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
  221. package/package.json +3 -3
  222. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js +0 -91
  223. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/getCells.js.map +0 -1
  224. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js +0 -30
  225. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/add.js.map +0 -1
  226. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js +0 -29
  227. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/cover.js.map +0 -1
  228. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js +0 -12
  229. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/data.js.map +0 -1
  230. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js +0 -7
  231. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/extent.js.map +0 -1
  232. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js +0 -26
  233. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/find.js.map +0 -1
  234. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js +0 -7
  235. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quad.js.map +0 -1
  236. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js +0 -51
  237. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/quadtree.js.map +0 -1
  238. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js +0 -21
  239. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/remove.js.map +0 -1
  240. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js +0 -7
  241. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/root.js.map +0 -1
  242. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js +0 -12
  243. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/size.js.map +0 -1
  244. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js +0 -14
  245. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visit.js.map +0 -1
  246. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js +0 -19
  247. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/visitAfter.js.map +0 -1
  248. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js +0 -11
  249. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/x.js.map +0 -1
  250. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js +0 -11
  251. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/d3-quadtree/src/y.js.map +0 -1
  252. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js +0 -24
  253. package/dist/node_modules/@milaboratories/miplots4/dist/utils/TextMeasurer.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Heatmap.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/dendro/components/Heatmap.tsx"],"sourcesContent":["import {Tooltip} from '../../common/Tooltip';\nimport {BLACK} from '../../constants';\nimport type {Cell, ChartScales, ChartSizes} from './types';\nimport {COLOR_EMPTY, DIMMED_OPACITY, HEATMAP_LEFT_OFFSET, MARGIN} from '../constants';\nimport type {HeatmapData} from '../getHeatmapData';\nimport type {TreeNodeData} from '../getHierarchyData';\nimport type {DataValue} from '../../types';\nimport type {HierarchyPointNode} from 'd3-hierarchy';\nimport React, {useState} from 'react';\n\nfunction formatCellValue(v: DataValue): number | string {\n if (v === null) {\n return 'null';\n }\n if (typeof v === 'number') {\n const whole = Math.floor(v);\n const decimal = v - whole;\n return whole + Number(decimal.toPrecision(2));\n }\n return v;\n}\n\nfunction getTooltipContent(cell: Cell, labels:Record<string, string>) {\n return [`X: ${labels[cell.x]}`, `Node: ${cell.y}`, `Value: ${formatCellValue(cell.value)}`];\n}\n\nexport function Heatmap({\n heatmapData,\n scales,\n step,\n colorScale,\n tooltipsContainer,\n chartSizes,\n selectedNode,\n labels\n}: {\n heatmapData: HeatmapData;\n scales: ChartScales;\n step: {x: number; y: number};\n colorScale: (value: DataValue) => string;\n chartSizes: ChartSizes;\n tooltipsContainer: Element | null;\n selectedNode: HierarchyPointNode<TreeNodeData> | null,\n labels: string[]\n}) {\n const {xKeys, yKeys, cells, meta} = heatmapData;\n const [selectedCell, setSelectedCell] = useState<Cell | null>(null);\n const sideDistances = {\n left: chartSizes.treeWidth + HEATMAP_LEFT_OFFSET + MARGIN.LEFT,\n right: chartSizes.heatmapWidth + MARGIN.RIGHT,\n top: MARGIN.TOP,\n bottom: chartSizes.heatmapHeight + MARGIN.BOTTOM,\n };\n return (\n <g onMouseLeave={() => setSelectedCell(null)}>\n {labels.length && (\n <g transform={'translate(0,-8)'} >\n {xKeys.map((key, idx) => (\n <text x={scales.x(key) + 2} key={key} fontWeight=\"500\">\n <title>{meta.xLabels[key]}</title>\n {labels[idx]}\n </text>\n ))}\n </g>\n )}\n {/* cells */}\n {xKeys.map(xKey =>\n yKeys.map(yKey => {\n const cell = cells?.[xKey]?.[yKey];\n return (\n <rect\n key={cell ? cell.id : `${xKey}_${yKey}`}\n x={scales.x(xKey)}\n y={scales.y(yKey)}\n width={step.x}\n height={step.y}\n stroke=\"white\"\n strokeWidth=\"1px\"\n fill={cell ? colorScale(cell?.value) : COLOR_EMPTY}\n onMouseOver={() => {\n if (cell?.value !== null && typeof cell?.value !== 'undefined') {\n setSelectedCell(cell);\n } else {\n setSelectedCell(null);\n }\n }}\n opacity={selectedNode && selectedNode.data.rawData[0].id !== cell?.data.id ? DIMMED_OPACITY : 1}\n />\n );\n })\n )}\n {labels.length && (\n <line x1=\"0\" x2={chartSizes.heatmapWidth} y1=\"0\" y2=\"0\" stroke={BLACK} strokeWidth=\"1px\"/>\n )}\n {selectedCell && tooltipsContainer && (\n <Tooltip\n content={getTooltipContent(selectedCell, heatmapData.meta.xLabels)}\n x={scales.x(selectedCell.x) + step.x / 2}\n y={scales.y(selectedCell.y) + step.y / 2}\n offset={xKeys.length > 1 ? step.x / 2 : 0}\n active={true}\n fixed={false}\n sideDistances={sideDistances}\n container={tooltipsContainer}\n />\n )}\n </g>\n );\n}\n"],"names":["formatCellValue","v","whole","decimal","getTooltipContent","cell","labels","Heatmap","heatmapData","scales","step","colorScale","tooltipsContainer","chartSizes","selectedNode","xKeys","yKeys","cells","meta","selectedCell","setSelectedCell","useState","sideDistances","HEATMAP_LEFT_OFFSET","MARGIN","i","jsx","key","idx","jsxs","xKey","yKey","_a","COLOR_EMPTY","DIMMED_OPACITY","BLACK","Tooltip"],"mappings":";;;;;AAUA,SAASA,EAAgBC,GAA+B;AACpD,MAAIA,MAAM;AACN,WAAO;AAEX,MAAI,OAAOA,KAAM,UAAU;AACvB,UAAMC,IAAQ,KAAK,MAAMD,CAAC,GACpBE,IAAUF,IAAIC;AACpB,WAAOA,IAAQ,OAAOC,EAAQ,YAAY,CAAC,CAAC;AAAA,EAChD;AACA,SAAOF;AACX;AAEA,SAASG,EAAkBC,GAAYC,GAA+B;AAClE,SAAO,CA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;AAER;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"Heatmap.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/dendro/components/Heatmap.tsx"],"sourcesContent":["import type { HierarchyPointNode } from 'd3-hierarchy';\nimport { useState } from 'react';\nimport { Tooltip } from '../../common/Tooltip';\nimport { BLACK } from '../../constants';\nimport type { DataValue } from '../../types';\nimport { COLOR_EMPTY, DIMMED_OPACITY, HEATMAP_LEFT_OFFSET, MARGIN } from '../constants';\nimport type { HeatmapData } from '../getHeatmapData';\nimport type { TreeNodeData } from '../getHierarchyData';\nimport type { Cell, ChartScales, ChartSizes } from './types';\n\nfunction formatCellValue(v: DataValue): number | string {\n if (v === null) {\n return 'null';\n }\n if (typeof v === 'number') {\n const whole = Math.floor(v);\n const decimal = v - whole;\n return whole + Number(decimal.toPrecision(2));\n }\n return v;\n}\n\nfunction getTooltipContent(cell: Cell, labels:Record<string, string>) {\n return [`X: ${labels[cell.x]}`, `Node: ${cell.y}`, `Value: ${formatCellValue(cell.value)}`];\n}\n\nexport function Heatmap({\n heatmapData,\n scales,\n step,\n colorScale,\n tooltipsContainer,\n chartSizes,\n selectedNode,\n labels\n}: {\n heatmapData: HeatmapData;\n scales: ChartScales;\n step: {x: number; y: number};\n colorScale: (value: DataValue) => string;\n chartSizes: ChartSizes;\n tooltipsContainer: Element | null;\n selectedNode: HierarchyPointNode<TreeNodeData> | null,\n labels: string[]\n}) {\n const {xKeys, yKeys, cells, meta} = heatmapData;\n const [selectedCell, setSelectedCell] = useState<Cell | null>(null);\n const sideDistances = {\n left: chartSizes.treeWidth + HEATMAP_LEFT_OFFSET + MARGIN.LEFT,\n right: chartSizes.heatmapWidth + MARGIN.RIGHT,\n top: MARGIN.TOP,\n bottom: chartSizes.heatmapHeight + MARGIN.BOTTOM,\n };\n return (\n <g onMouseLeave={() => setSelectedCell(null)}>\n {labels.length && (\n <g transform={'translate(0,-8)'} >\n {xKeys.map((key, idx) => (\n <text x={scales.x(key) + 2} key={key} fontWeight=\"500\">\n <title>{meta.xLabels[key]}</title>\n {labels[idx]}\n </text>\n ))}\n </g>\n )}\n {/* cells */}\n {xKeys.map(xKey =>\n yKeys.map(yKey => {\n const cell = cells?.[xKey]?.[yKey];\n return (\n <rect\n key={cell ? cell.id : `${xKey}_${yKey}`}\n x={scales.x(xKey)}\n y={scales.y(yKey)}\n width={step.x}\n height={step.y}\n stroke=\"white\"\n strokeWidth=\"1px\"\n fill={cell ? colorScale(cell?.value) : COLOR_EMPTY}\n onMouseOver={() => {\n if (cell?.value !== null && typeof cell?.value !== 'undefined') {\n setSelectedCell(cell);\n } else {\n setSelectedCell(null);\n }\n }}\n opacity={selectedNode && selectedNode.data.rawIndexes[0] !== cell?.idx ? DIMMED_OPACITY : 1}\n />\n );\n })\n )}\n {labels.length && (\n <line x1=\"0\" x2={chartSizes.heatmapWidth} y1=\"0\" y2=\"0\" stroke={BLACK} strokeWidth=\"1px\"/>\n )}\n {selectedCell && tooltipsContainer && (\n <Tooltip\n content={getTooltipContent(selectedCell, heatmapData.meta.xLabels)}\n x={scales.x(selectedCell.x) + step.x / 2}\n y={scales.y(selectedCell.y) + step.y / 2}\n offset={xKeys.length > 1 ? step.x / 2 : 0}\n active={true}\n fixed={false}\n sideDistances={sideDistances}\n container={tooltipsContainer}\n />\n )}\n </g>\n );\n}\n"],"names":["formatCellValue","v","whole","decimal","getTooltipContent","cell","labels","Heatmap","heatmapData","scales","step","colorScale","tooltipsContainer","chartSizes","selectedNode","xKeys","yKeys","cells","meta","selectedCell","setSelectedCell","useState","sideDistances","HEATMAP_LEFT_OFFSET","MARGIN","i","jsx","key","idx","jsxs","xKey","yKey","_a","COLOR_EMPTY","DIMMED_OPACITY","BLACK","Tooltip"],"mappings":";;;;;AAUA,SAASA,EAAgBC,GAA+B;AACpD,MAAIA,MAAM;AACN,WAAO;AAEX,MAAI,OAAOA,KAAM,UAAU;AACvB,UAAMC,IAAQ,KAAK,MAAMD,CAAC,GACpBE,IAAUF,IAA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AAI;AAAA,QACxC,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,eAAAY;AAAAA,QACA,WAAWV;AAAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGvB;AAER;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"Legend.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/dendro/components/Legend.tsx"],"sourcesContent":["import {BLACK} from '../../constants';\nimport type {DotAesItem, LegendData, LegendItemContinuous} from './types';\nimport {getPointShape} from '../../utils/getPointShape';\nimport React from 'react';\n\nconst COLOR_ITEM_WIDTH_C = 14;\nconst COLOR_ITEM_SIZE_D = 12;\nconst LEGEND_ITEM_SIZE = 12;\nconst TITLE_POSITION = -12;\n\ninterface LegendProps {\n legendData: LegendData;\n}\n\nfunction AesItem({aes, label}: {aes: DotAesItem; label: string}) {\n const shape = getPointShape(aes.shape, aes.size, aes.color);\n\n return (\n <g>\n <g transform={`translate(${LEGEND_ITEM_SIZE / 2},${LEGEND_ITEM_SIZE / 2})`}>{shape}</g>\n <text x={LEGEND_ITEM_SIZE + 8} y={LEGEND_ITEM_SIZE / 2} dominantBaseline=\"central\" fontWeight={500}>\n {label}\n </text>\n </g>\n );\n}\n\nexport function Legend({legendData}: LegendProps) {\n const debug = false;\n const continuousItems= legendData.items.filter((item) => item.type === 'continuous') as LegendItemContinuous[];\n return (\n <g>\n <defs>\n {continuousItems.map(item => (\n <linearGradient key={item.id} id={item.id} gradientTransform=\"rotate(90)\">\n {item.scale.domain().map(value => {\n const domain = item.scale.domain();\n const range = domain[domain.length - 1] - domain[0];\n const percent = range > 0 ? (value - domain[0]) / range * 100 : 0;\n return (\n <stop\n key={value}\n offset={`${percent}%`}\n stopColor={item.scale(value)}\n />\n );\n })}\n </linearGradient>\n ))}\n </defs>\n {legendData.items.map(item => {\n if (item.type === 'continuous') {\n const min = Math.min(...item.values);\n const max = Math.max(...item.values);\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`}>\n <text fontWeight={500} fontSize=\"14px\" y={TITLE_POSITION}>{item.title}</text>\n <rect\n x=\"0\"\n y=\"0\"\n width={COLOR_ITEM_WIDTH_C}\n height={item.height}\n stroke={BLACK}\n fill={`url(#${item.id})`}\n />\n <g transform={`translate(${COLOR_ITEM_WIDTH_C},0)`}>\n {item.values.map(value => {\n const range = max - min;\n const y = range > 0 ? (item.height * (value - min)) / range : 0;\n return (\n <g key={value} transform={`translate(0,${y})`}>\n <line x1=\"0\" x2={-4} stroke={BLACK} />\n <text x={8} y={4}>{value}</text>\n </g>\n );\n })}\n </g>\n {debug && <rect width={item.width} height={item.height} fill=\"none\" stroke=\"black\"/>}\n </g>\n );\n }\n if (item.type === 'discrete') {\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`}>\n <text fontWeight={500} fontSize=\"14px\" y={TITLE_POSITION}>{item.title}</text>\n {item.values.map((value, idx) => {\n return <g key={value} transform={`translate(0, ${idx * (COLOR_ITEM_SIZE_D + 4)})`}>\n <rect\n x=\"0\"\n y=\"0\"\n width={COLOR_ITEM_SIZE_D}\n height={COLOR_ITEM_SIZE_D}\n fill={item.scale(value)}\n rx=\"1\"\n ry=\"1\"\n />\n <text x={COLOR_ITEM_SIZE_D + 8} y={10}>{value}</text>\n </g>;\n })}\n {debug && <rect width={item.width} height={item.height} fill=\"none\" stroke=\"black\"/>}\n </g>\n );\n }\n if (item.type === 'nodes') {\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`} fontSize=\"14px\" fontWeight={500}>\n <text fontWeight={500} y={TITLE_POSITION}>\n {item.title}\n </text>\n {item.values.map((value, idx) => {\n return (\n <g key={value} transform={`translate(0, ${idx * (LEGEND_ITEM_SIZE + 4)})`}>\n <AesItem aes={item.scale(value)} label={item.labels[value]} />\n </g>\n );\n })}\n {debug && <rect width={item.width} height={item.height} fill=\"none\" stroke=\"black\" />}\n </g>\n );\n }\n if (item.type === 'size') {\n const size = item.height / item.values.length;\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`} fontSize=\"14px\" fontWeight={500}>\n <text fontWeight={500} y={TITLE_POSITION}>\n {item.title}\n </text>\n {item.values.map((value, idx) => {\n const r = item.scale(value);\n return (\n <g key={value} transform={`translate(0, ${idx * size})`}>\n <circle r={r} cx={size / 2} cy={size / 2} fill={BLACK}/>\n <text x={size + 4} y={size / 2} alignmentBaseline=\"central\">{item.labels[value]}</text>\n </g>\n );\n })}\n {debug && <rect width={item.width} height={item.height} fill=\"none\" stroke=\"black\" />}\n </g>\n );\n }\n })}\n </g>\n );\n}\n"],"names":["COLOR_ITEM_WIDTH_C","COLOR_ITEM_SIZE_D","LEGEND_ITEM_SIZE","TITLE_POSITION","AesItem","aes","label","shape","getPointShape","n","jsx","Legend","legendData","continuousItems","item","value","domain","range","percent","min","max","jsxs","t","BLACK","y","idx","size","r"],"mappings":";;;AAKA,MAAMA,IAAqB,IACrBC,IAAoB,IACpBC,IAAmB,IACnBC,IAAiB;AAMvB,SAASC,EAAQ,EAAC,KAAAC,GAAK,OAAAC,EAAAA,GAA0C;AAC7D,QAAMC,IAAQC,EAAcH,EAAI,OAAOA,EAAI,MAAMA,EAAI,KAAK;AAE1D,SAAAI,gBAAAA,EAAA,KACK,KAAA,EACG,UAAA;AAAA,IAAAC,gBAAAA,EAAAA,IAAC,KAAA,EAAE,WAAW,aAAaR,IAAmB,CAAC,IAAIA,IAAmB,CAAC,KAAM,UAAAK,GAAM;AAAA,IACnFG,gBAAAA,EAAAA,IAAC,QAAA,EAAK,GAAGR,IAAmB,GAAG,GAAGA,IAAmB,GAAG,kBAAiB,WAAU,YAAY,KAC1F,UAAAI,GACL;AAAA,EAAA,GACJ;AAER;AAEO,SAASK,EAAO,EAAC,YAAAC,KAA0B;AAE9C,QAAMC,IAAiBD,EAAW,MAAM,OAAO,CAACE,MAASA,EAAK,SAAS,YAAY;AACnF,SAAAL,gBAAAA,EAAA,KACK,KAAA,EACG,UAAA;AAAA,IAAAC,gBAAAA,EAAAA,IAAC,QAAA,EACI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,GAAGA,IAAO,GAAG,mBAAkB,WAAW,UAAAZ,EAAK,OAAOC,CAAK,GAAE;AAAA,YAAA,EAAA,GAF5EA,CAGR;AAAA,UAER,CAAC;AAAA,UACA;AAAA,QAAA,EAAkF,GAb/ED,EAAK,EAcb;AAAA,MAER;AAAA,IACJ,CAAC;AAAA,EAAA,GACL;AAER;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"Legend.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/dendro/components/Legend.tsx"],"sourcesContent":["import { BLACK } from '../../constants';\nimport { getPointShape } from '../../utils/getPointShape';\nimport type { DotAesItem, LegendData, LegendItemContinuous } from './types';\n\nconst COLOR_ITEM_WIDTH_C = 14;\nconst COLOR_ITEM_SIZE_D = 12;\nconst LEGEND_ITEM_SIZE = 12;\nconst TITLE_POSITION = -12;\n\ninterface LegendProps {\n legendData: LegendData;\n}\n\nfunction AesItem({aes, label}: {aes: DotAesItem; label: string}) {\n const shape = getPointShape(aes.shape, aes.size, aes.color);\n\n return (\n <g>\n <g transform={`translate(${LEGEND_ITEM_SIZE / 2},${LEGEND_ITEM_SIZE / 2})`}>{shape}</g>\n <text x={LEGEND_ITEM_SIZE + 8} y={LEGEND_ITEM_SIZE / 2} dominantBaseline=\"central\" fontWeight={500}>\n {label}\n </text>\n </g>\n );\n}\n\nexport function Legend({legendData}: LegendProps) {\n const debug = false;\n const continuousItems= legendData.items.filter((item) => item.type === 'continuous') as LegendItemContinuous[];\n return (\n <g>\n <defs>\n {continuousItems.map(item => (\n <linearGradient key={item.id} id={item.id} gradientTransform=\"rotate(90)\">\n {item.scale.domain().map(value => {\n const domain = item.scale.domain();\n const range = domain[domain.length - 1] - domain[0];\n const percent = range > 0 ? (value - domain[0]) / range * 100 : 0;\n return (\n <stop\n key={value}\n offset={`${percent}%`}\n stopColor={item.scale(value)}\n />\n );\n })}\n </linearGradient>\n ))}\n </defs>\n {legendData.items.map(item => {\n if (item.type === 'continuous') {\n const min = Math.min(...item.values);\n const max = Math.max(...item.values);\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`}>\n <text fontWeight={500} fontSize=\"14px\" y={TITLE_POSITION}>{item.title}</text>\n <rect\n x=\"0\"\n y=\"0\"\n width={COLOR_ITEM_WIDTH_C}\n height={item.height}\n stroke={BLACK}\n fill={`url(#${item.id})`}\n />\n <g transform={`translate(${COLOR_ITEM_WIDTH_C},0)`}>\n {item.values.map(value => {\n const range = max - min;\n const y = range > 0 ? (item.height * (value - min)) / range : 0;\n return (\n <g key={value} transform={`translate(0,${y})`}>\n <line x1=\"0\" x2={-4} stroke={BLACK} />\n <text x={8} y={4}>{value}</text>\n </g>\n );\n })}\n </g>\n {debug && <rect width={item.width} height={item.height} fill=\"none\" stroke=\"black\"/>}\n </g>\n );\n }\n if (item.type === 'discrete') {\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`}>\n <text fontWeight={500} fontSize=\"14px\" y={TITLE_POSITION}>{item.title}</text>\n {item.values.map((value, idx) => {\n return <g key={value} transform={`translate(0, ${idx * (COLOR_ITEM_SIZE_D + 4)})`}>\n <rect\n x=\"0\"\n y=\"0\"\n width={COLOR_ITEM_SIZE_D}\n height={COLOR_ITEM_SIZE_D}\n fill={item.scale(value)}\n rx=\"1\"\n ry=\"1\"\n />\n <text x={COLOR_ITEM_SIZE_D + 8} y={10}>{value}</text>\n </g>;\n })}\n {debug && <rect width={item.width} height={item.height} fill=\"none\" stroke=\"black\"/>}\n </g>\n );\n }\n if (item.type === 'nodes') {\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`} fontSize=\"14px\" fontWeight={500}>\n <text fontWeight={500} y={TITLE_POSITION}>\n {item.title}\n </text>\n {item.values.map((value, idx) => {\n return (\n <g key={value} transform={`translate(0, ${idx * (LEGEND_ITEM_SIZE + 4)})`}>\n <AesItem aes={item.scale(value)} label={item.labels[value]} />\n </g>\n );\n })}\n {debug && <rect width={item.width} height={item.height} fill=\"none\" stroke=\"black\" />}\n </g>\n );\n }\n if (item.type === 'size') {\n const size = item.height / item.values.length;\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`} fontSize=\"14px\" fontWeight={500}>\n <text fontWeight={500} y={TITLE_POSITION}>\n {item.title}\n </text>\n {item.values.map((value, idx) => {\n const r = item.scale(value);\n return (\n <g key={value} transform={`translate(0, ${idx * size})`}>\n <circle r={r} cx={size / 2} cy={size / 2} fill={BLACK}/>\n <text x={size + 4} y={size / 2} alignmentBaseline=\"central\">{item.labels[value]}</text>\n </g>\n );\n })}\n {debug && <rect width={item.width} height={item.height} fill=\"none\" stroke=\"black\" />}\n </g>\n );\n }\n })}\n </g>\n );\n}\n"],"names":["COLOR_ITEM_WIDTH_C","COLOR_ITEM_SIZE_D","LEGEND_ITEM_SIZE","TITLE_POSITION","AesItem","aes","label","shape","getPointShape","n","jsx","Legend","legendData","continuousItems","item","value","domain","range","percent","min","max","jsxs","t","BLACK","y","idx","size","r"],"mappings":";;;AAIA,MAAMA,IAAqB,IACrBC,IAAoB,IACpBC,IAAmB,IACnBC,IAAiB;AAMvB,SAASC,EAAQ,EAAC,KAAAC,GAAK,OAAAC,EAAAA,GAA0C;AAC7D,QAAMC,IAAQC,EAAcH,EAAI,OAAOA,EAAI,MAAMA,EAAI,KAAK;AAE1D,SAAAI,gBAAAA,EAAA,KACK,KAAA,EACG,UAAA;AAAA,IAAAC,gBAAAA,EAAAA,IAAC,KAAA,EAAE,WAAW,aAAaR,IAAmB,CAAC,IAAIA,IAAmB,CAAC,KAAM,UAAAK,GAAM;AAAA,IACnFG,gBAAAA,EAAAA,IAAC,QAAA,EAAK,GAAGR,IAAmB,GAAG,GAAGA,IAAmB,GAAG,kBAAiB,WAAU,YAAY,KAC1F,UAAAI,GACL;AAAA,EAAA,GACJ;AAER;AAEO,SAASK,EAAO,EAAC,YAAAC,KAA0B;AAE9C,QAAMC,IAAiBD,EAAW,MAAM,OAAO,CAACE,MAASA,EAAK,SAAS,YAAY;AACnF,SAAAL,gBAAAA,EAAA,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AAAA,cACtDb,gBAAAA,EAAAA,IAAC,QAAA,EAAK,GAAGgB,IAAO,GAAG,GAAGA,IAAO,GAAG,mBAAkB,WAAW,UAAAZ,EAAK,OAAOC,CAAK,GAAE;AAAA,YAAA,EAAA,GAF5EA,CAGR;AAAA,UAER,CAAC;AAAA,UACA;AAAA,QAAA,EAAkF,GAb/ED,EAAK,EAcb;AAAA,MAER;AAAA,IACJ,CAAC;AAAA,EAAA,GACL;AAER;","x_google_ignoreList":[0]}
@@ -1,32 +1,32 @@
1
- import { j as $ } from "../../node_modules/react/jsx-runtime.js";
1
+ import { j as a } from "../../node_modules/react/jsx-runtime.js";
2
2
  import { SELECTED_PATH_COLOR as u } from "../constants.js";
3
3
  import { link as y } from "../../node_modules/d3-shape/src/link.js";
4
4
  import { bumpY as m, bumpX as p } from "../../node_modules/d3-shape/src/curve/bump.js";
5
- function L(n, a, s) {
6
- const { source: e, target: o } = n, r = s === "top";
7
- return a === "rectangle" ? r ? `M ${e.x},${e.y} L ${o.x},${e.y} L${o.x},${o.y}` : `M ${e.y},${e.x} L ${e.y},${o.x} L${o.y},${o.x}` : a === "curve" ? y(
8
- r ? m : p
9
- ).x((t) => r ? t.x : t.y).y((t) => r ? t.y : t.x).source((t) => t.target).target((t) => t.source)(n) ?? "" : r ? `M ${e.x},${e.y} L${o.x},${o.y}` : `M ${e.y},${e.x} L${o.y},${o.x}`;
5
+ function L(n, s, $) {
6
+ const { source: t, target: r } = n, o = $ === "top";
7
+ return s === "rectangle" ? o ? `M ${t.x},${t.y} L ${r.x},${t.y} L${r.x},${r.y}` : `M ${t.y},${t.x} L ${t.y},${r.x} L${r.y},${r.x}` : s === "curve" ? y(
8
+ o ? m : p
9
+ ).x((e) => o ? e.x : e.y).y((e) => o ? e.y : e.x).source((e) => e.target).target((e) => e.source)(n) ?? "" : o ? `M ${t.x},${t.y} L${r.x},${r.y}` : `M ${t.y},${t.x} L${r.y},${r.x}`;
10
10
  }
11
11
  function h({
12
12
  links: n,
13
- connectionType: a,
14
- rootPosition: s,
15
- edgeInheritance: e,
16
- aesGetters: o,
17
- selected: r
13
+ connectionType: s,
14
+ rootPosition: $,
15
+ edgeInheritance: t,
16
+ aesGetters: r,
17
+ selected: o
18
18
  }) {
19
- return /* @__PURE__ */ $.jsx($.Fragment, { children: n.map((t) => {
20
- const { source: i, target: x } = t, c = (e === "up" ? i : x).data.rawData[0];
21
- return /* @__PURE__ */ $.jsx(
19
+ return /* @__PURE__ */ a.jsx(a.Fragment, { children: n.map((e) => {
20
+ const { source: i, target: x } = e, c = (t === "up" ? i : x).data.rawIndexes[0];
21
+ return /* @__PURE__ */ a.jsx(
22
22
  "path",
23
23
  {
24
- d: L(t, a, s),
25
- stroke: r ? u : o.lineColor(c),
26
- strokeWidth: r ? 2 : 1,
24
+ d: L(e, s, $),
25
+ stroke: o ? u : r.lineColor(c),
26
+ strokeWidth: o ? 2 : 1,
27
27
  fill: "none"
28
28
  },
29
- `${t.source.id},${t.target.id}`
29
+ `${e.source.id},${e.target.id}`
30
30
  );
31
31
  }) });
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LinksGroup.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/dendro/components/LinksGroup.tsx"],"sourcesContent":["import {SELECTED_PATH_COLOR} from '../constants';\nimport type {DendroSettingsImpl} from '../DendroSettingsImpl';\nimport type {TreeNodeData} from '../getHierarchyData';\nimport type {HierarchyPointLink, HierarchyPointNode} from 'd3-hierarchy';\nimport {curveBumpX, curveBumpY, link as d3link} from 'd3-shape';\nimport React from 'react';\n\ninterface LinksGroupProps {\n links: HierarchyPointLink<TreeNodeData>[];\n connectionType: DendroSettingsImpl['connectionType'];\n rootPosition: DendroSettingsImpl['rootPosition'];\n edgeInheritance: DendroSettingsImpl['edgeInheritance'];\n aesGetters: {\n nodeShape: (row: Record<string, string>) => string;\n nodeColor: (row: Record<string, string>) => string;\n nodeSize: (row: Record<string, number>) => number;\n lineShape: (row: Record<string, string>) => string;\n lineColor: (row: Record<string, string>) => string;\n };\n selected: boolean;\n}\n\nfunction getLinkPath(\n link: HierarchyPointLink<TreeNodeData>,\n connectionType: DendroSettingsImpl['connectionType'],\n rootPosition: DendroSettingsImpl['rootPosition']\n): string {\n const {source, target} = link;\n const isVertical = rootPosition === 'top';\n if (connectionType === 'rectangle') {\n return isVertical\n ? `M ${source.x},${source.y} L ${target.x},${source.y} L${target.x},${target.y}`\n : `M ${source.y},${source.x} L ${source.y},${target.x} L${target.y},${target.x}`;\n }\n if (connectionType === 'curve') {\n return (\n d3link<HierarchyPointLink<TreeNodeData>, HierarchyPointNode<TreeNodeData>>(\n isVertical ? curveBumpY : curveBumpX\n )\n .x(d => (isVertical ? d.x : d.y))\n .y(d => (isVertical ? d.y : d.x))\n .source(d => d.target)\n .target(d => d.source)(link) ?? ''\n );\n }\n return isVertical\n ? `M ${source.x},${source.y} L${target.x},${target.y}`\n : `M ${source.y},${source.x} L${target.y},${target.x}`;\n}\n\nexport function LinksGroup({\n links,\n connectionType,\n rootPosition,\n edgeInheritance,\n aesGetters,\n selected,\n}: LinksGroupProps) {\n return (\n <>\n {links.map(link => {\n const {source, target} = link;\n const aesNode = edgeInheritance === 'up' ? source : target;\n const row = aesNode.data.rawData[0];\n return (\n <path\n key={`${link.source.id},${link.target.id}`}\n d={getLinkPath(link, connectionType, rootPosition)}\n stroke={selected ? SELECTED_PATH_COLOR : aesGetters.lineColor(row as Record<string, string>)}\n strokeWidth={selected ? 2 : 1}\n fill=\"none\"\n />\n );\n })}\n </>\n );\n}\n"],"names":["getLinkPath","link","connectionType","rootPosition","source","target","isVertical","d3link","curveBumpY","curveBumpX","d","LinksGroup","links","edgeInheritance","aesGetters","selected","jsx","Fragment","row","SELECTED_PATH_COLOR"],"mappings":";;;;AAsBA,SAASA,EACLC,GACAC,GACAC,GACM;AACN,QAAM,EAAC,QAAAC,GAAQ,QAAAC,MAAUJ,GACnBK,IAAaH,MAAiB;AACpC,SAAID,MAAmB,cACZI,IACD,KAAKF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,QAC5B,MAAK;AAAA,MAAA;AAAA,MAJA,GAAGd,EAAK,OAAO,EAAE,IAAIA,EAAK,OAAO,EAAE;AAAA,IAAA;AAAA,EAOpD,CAAC,GACL;AAER;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"LinksGroup.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/dendro/components/LinksGroup.tsx"],"sourcesContent":["import type { HierarchyPointLink, HierarchyPointNode } from 'd3-hierarchy';\nimport { curveBumpX, curveBumpY, link as d3link } from 'd3-shape';\nimport { SELECTED_PATH_COLOR } from '../constants';\nimport type { DendroSettingsImpl } from '../DendroSettingsImpl';\nimport type { TreeNodeData } from '../getHierarchyData';\n\ninterface LinksGroupProps {\n links: HierarchyPointLink<TreeNodeData>[];\n connectionType: DendroSettingsImpl['connectionType'];\n rootPosition: DendroSettingsImpl['rootPosition'];\n edgeInheritance: DendroSettingsImpl['edgeInheritance'];\n aesGetters: {\n nodeShape: (idx: number) => string;\n nodeColor: (idx: number) => string;\n nodeSize: (idx: number) => number;\n lineShape: (idx: number) => string;\n lineColor: (idx: number) => string;\n };\n selected: boolean;\n}\n\nfunction getLinkPath(\n link: HierarchyPointLink<TreeNodeData>,\n connectionType: DendroSettingsImpl['connectionType'],\n rootPosition: DendroSettingsImpl['rootPosition']\n): string {\n const {source, target} = link;\n const isVertical = rootPosition === 'top';\n if (connectionType === 'rectangle') {\n return isVertical\n ? `M ${source.x},${source.y} L ${target.x},${source.y} L${target.x},${target.y}`\n : `M ${source.y},${source.x} L ${source.y},${target.x} L${target.y},${target.x}`;\n }\n if (connectionType === 'curve') {\n return (\n d3link<HierarchyPointLink<TreeNodeData>, HierarchyPointNode<TreeNodeData>>(\n isVertical ? curveBumpY : curveBumpX\n )\n .x(d => (isVertical ? d.x : d.y))\n .y(d => (isVertical ? d.y : d.x))\n .source(d => d.target)\n .target(d => d.source)(link) ?? ''\n );\n }\n return isVertical\n ? `M ${source.x},${source.y} L${target.x},${target.y}`\n : `M ${source.y},${source.x} L${target.y},${target.x}`;\n}\n\nexport function LinksGroup({\n links,\n connectionType,\n rootPosition,\n edgeInheritance,\n aesGetters,\n selected,\n}: LinksGroupProps) {\n return (\n <>\n {links.map(link => {\n const {source, target} = link;\n const aesNode = edgeInheritance === 'up' ? source : target;\n const idx = aesNode.data.rawIndexes[0];\n return (\n <path\n key={`${link.source.id},${link.target.id}`}\n d={getLinkPath(link, connectionType, rootPosition)}\n stroke={selected ? SELECTED_PATH_COLOR : aesGetters.lineColor(idx)}\n strokeWidth={selected ? 2 : 1}\n fill=\"none\"\n />\n );\n })}\n </>\n );\n}\n"],"names":["getLinkPath","link","connectionType","rootPosition","source","target","isVertical","d3link","curveBumpY","curveBumpX","d","LinksGroup","links","edgeInheritance","aesGetters","selected","jsx","Fragment","idx","SELECTED_PATH_COLOR"],"mappings":";;;;AAqBA,SAASA,EACLC,GACAC,GACAC,GACM;AACN,QAAM,EAAC,QAAAC,GAAQ,QAAAC,MAAUJ,GACnBK,IAAaH,MAAiB;AACpC,SAAID,MAAmB,cACZI,IACD,KAAKF,EAAO,CAAC,IAAIA,EAAO,CAAC,MAAMC,EAAO,CAAC,IAAID,EAAO,CAAC,KAAKC,EAAO,CAAC,IAAIA,EAAO,CAAC,KAC5E,KAAKD,EAAO,CAAC,IAAIA,EAAO,CAAC,MAAMA,EAAO,CAAC,IAAIC,EAAO,CAAC,KAAKA,EAAO,CAAC,IAAIA,EAAO,CAAC,KAElFH,MAAmB,UAEfK;AAAAA,IACID,IAAaE,IAAaC;AAAAA,EAAAA,EAEzB,EAAE,CAAAC,MAAMJ,IAAaI,EAAE,IAAIA,EAAE,CAAE,EAC/B,EAAE,CAAAA,MAAMJ,IAAaI,EAAE,IAAIA,EAAE,CAAE,EAC/B,OAAO,CAAAA,MAAKA,EAAE,MAAM,EACpB,OAAO,CAAAA,MAAKA,EAAE,MAAM,EAAET,CAAI,KAAK,KAGrCK,IACD,KAAKF,EAAO,CAAC,IAAIA,EAAO,CAAC,KAAKC,EAAO,CAAC,IAAIA,EAAO,CAAC,KAClD,KAAKD,EAAO,CAAC,IAAIA,EAAO,CAAC,KAAKC,EAAO,CAAC,IAAIA,EAAO,CAAC;AAC5D;AAEO,SAASM,EAAW;AAAA,EACvB,OAAAC;AAAAA,EACA,gBAAAV;AAAAA,EACA,cAAAC;AAAAA,EACA,iBAAAU;AAAAA,EACA,YAAAC;AAAAA,EACA,UAAAC;AACJ,GAAoB;AAChB,SACIC,gBAAAA,EAAAA,IAAAC,EAAAA,UAAA,EACK,UAAAL,EAAM,IAAI,CAAAX,MAAQ;AACf,UAAM,EAAC,QAAAG,GAAQ,QAAAC,MAAUJ,GAEnBiB,KADUL,MAAoB,OAAOT,IAASC,GAChC,KAAK,WAAW,CAAC;AACrC,WACIW,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QAEG,GAAGhB,EAAYC,GAAMC,GAAgBC,CAAY;AAAA,QACjD,QAAQY,IAAWI,IAAsBL,EAAW,UAAUI,CAAG;AAAA,QACjE,aAAaH,IAAW,IAAI;AAAA,QAC5B,MAAK;AAAA,MAAA;AAAA,MAJA,GAAGd,EAAK,OAAO,EAAE,IAAIA,EAAK,OAAO,EAAE;AAAA,IAAA;AAAA,EAOpD,CAAC,GACL;AAER;","x_google_ignoreList":[0]}
@@ -1,78 +1,78 @@
1
- import { j as t } from "../../node_modules/react/jsx-runtime.js";
2
- import { DIMMED_OPACITY as L, SELECTED_NODE_COLOR as f, MARGIN as x } from "../constants.js";
3
- import { getPointShape as w } from "../../utils/getPointShape.js";
4
- import { r as y } from "../../_virtual/index.js";
1
+ import { j as o } from "../../node_modules/react/jsx-runtime.js";
2
+ import { r as f } from "../../_virtual/index.js";
3
+ import { getPointShape as L } from "../../utils/getPointShape.js";
4
+ import { DIMMED_OPACITY as O, SELECTED_NODE_COLOR as y, MARGIN as x } from "../constants.js";
5
5
  const C = 12;
6
- function $({
6
+ function P({
7
7
  nodes: p,
8
8
  rootPosition: g,
9
9
  showLeavesLabels: j,
10
- showNodesLabels: D,
11
- aesGetters: n,
10
+ showNodesLabels: I,
11
+ aesGetters: s,
12
12
  selectedNodeId: u,
13
13
  onClick: h,
14
14
  onSelectedUpdate: m
15
15
  }) {
16
- const o = g === "top", [O, i] = y.useState(null);
17
- return y.useEffect(() => {
18
- i(null);
19
- }, [u]), /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
20
- /* @__PURE__ */ t.jsx("g", { children: p.map((e) => {
21
- const a = e.data.rawData[0], l = n.nodeSize(a), r = n.nodeColor(a), s = o ? e.x : e.y, d = o ? e.y : e.x;
22
- return /* @__PURE__ */ t.jsx(
16
+ const t = g === "top", [w, d] = f.useState(null);
17
+ return f.useEffect(() => {
18
+ d(null);
19
+ }, [u]), /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
20
+ /* @__PURE__ */ o.jsx("g", { children: p.map((e) => {
21
+ const n = e.data.rawIndexes[0], l = s.nodeSize(n), r = s.nodeColor(n), a = t ? e.x : e.y, i = t ? e.y : e.x;
22
+ return /* @__PURE__ */ o.jsx(
23
23
  "g",
24
24
  {
25
- transform: `translate(${s},${d})`,
25
+ transform: `translate(${a},${i})`,
26
26
  style: { cursor: "pointer" },
27
27
  onClick: (c) => {
28
- c.stopPropagation(), h({ x: s + x.LEFT, y: d + x.TOP, info: e.data.rawData }), m(e);
28
+ c.stopPropagation(), h({ x: a + x.LEFT, y: i + x.TOP, info: e.data.rawIndexes }), m(e);
29
29
  },
30
- children: /* @__PURE__ */ t.jsx("g", { children: /* @__PURE__ */ t.jsx(
30
+ children: /* @__PURE__ */ o.jsx("g", { children: /* @__PURE__ */ o.jsx(
31
31
  "circle",
32
32
  {
33
33
  cx: 0,
34
34
  cy: 0,
35
35
  r: l + C,
36
- fill: u === e.id ? f : O === e.id ? r : "transparent",
37
- opacity: L,
38
- onMouseOver: () => i(e.id ?? null),
39
- onMouseLeave: () => i(null)
36
+ fill: u === e.id ? y : w === e.id ? r : "transparent",
37
+ opacity: O,
38
+ onMouseOver: () => d(e.id ?? null),
39
+ onMouseLeave: () => d(null)
40
40
  }
41
41
  ) })
42
42
  },
43
43
  e.id
44
44
  );
45
45
  }) }),
46
- /* @__PURE__ */ t.jsx("g", { children: p.map((e) => {
47
- const a = e.data.rawData[0], l = n.nodeShape(a), r = n.nodeSize(a), s = n.nodeColor(a), d = o ? e.x : e.y, c = o ? e.y : e.x;
48
- return /* @__PURE__ */ t.jsx(
46
+ /* @__PURE__ */ o.jsx("g", { children: p.map((e) => {
47
+ const n = e.data.rawIndexes[0], l = s.nodeShape(n), r = s.nodeSize(n), a = s.nodeColor(n), i = t ? e.x : e.y, c = t ? e.y : e.x;
48
+ return /* @__PURE__ */ o.jsx(
49
49
  "g",
50
50
  {
51
- transform: `translate(${d},${c})`,
51
+ transform: `translate(${i},${c})`,
52
52
  style: { cursor: "pointer" },
53
53
  onClick: (E) => {
54
- E.stopPropagation(), h({ x: d + x.LEFT, y: c + x.TOP, info: e.data.rawData }), m(e);
54
+ E.stopPropagation(), h({ x: i + x.LEFT, y: c + x.TOP, info: e.data.rawIndexes }), m(e);
55
55
  },
56
- children: /* @__PURE__ */ t.jsx(
56
+ children: /* @__PURE__ */ o.jsx(
57
57
  "g",
58
58
  {
59
- onMouseOver: () => i(e.id ?? null),
60
- onMouseLeave: () => i(null),
61
- children: w(l, r, u === e.id ? f : s)
59
+ onMouseOver: () => d(e.id ?? null),
60
+ onMouseLeave: () => d(null),
61
+ children: L(l, r, u === e.id ? y : a)
62
62
  }
63
63
  )
64
64
  },
65
65
  e.id
66
66
  );
67
67
  }) }),
68
- /* @__PURE__ */ t.jsx("g", { children: p.map((e) => {
69
- const a = e.data.rawData[0], l = n.nodeSize(a), r = o ? e.x : e.y, s = o ? e.y : e.x;
70
- return /* @__PURE__ */ t.jsx(
68
+ /* @__PURE__ */ o.jsx("g", { children: p.map((e) => {
69
+ const n = e.data.rawIndexes[0], l = s.nodeSize(n), r = t ? e.x : e.y, a = t ? e.y : e.x;
70
+ return /* @__PURE__ */ o.jsx(
71
71
  "g",
72
72
  {
73
- transform: `translate(${r},${s})`,
73
+ transform: `translate(${r},${a})`,
74
74
  style: { pointerEvents: "none" },
75
- children: (D && e.children || j && !e.children) && /* @__PURE__ */ t.jsx(
75
+ children: (I && e.children || j && !e.children) && /* @__PURE__ */ o.jsx(
76
76
  "text",
77
77
  {
78
78
  x: l + 4,
@@ -90,6 +90,6 @@ function $({
90
90
  ] });
91
91
  }
92
92
  export {
93
- $ as NodesGroup
93
+ P as NodesGroup
94
94
  };
95
95
  //# sourceMappingURL=NodesGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NodesGroup.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/dendro/components/NodesGroup.tsx"],"sourcesContent":["import {DIMMED_OPACITY, MARGIN, SELECTED_NODE_COLOR} from '../constants';\nimport type {DendroSettingsImpl} from '../DendroSettingsImpl';\nimport type {TreeNodeData} from '../getHierarchyData';\nimport {getPointShape} from '../../utils/getPointShape';\nimport type {ClickEventData, PointShape} from '../../types';\nimport type {HierarchyPointNode} from 'd3-hierarchy';\nimport React, {useEffect, useState} from 'react';\n\ninterface NodeGroupProps {\n nodes: HierarchyPointNode<TreeNodeData>[];\n rootPosition: DendroSettingsImpl['rootPosition'];\n showLeavesLabels: DendroSettingsImpl['showLeavesLabels'];\n showNodesLabels: DendroSettingsImpl['showNodesLabels'];\n aesGetters: {\n nodeShape: (row: Record<string, string>) => string;\n nodeColor: (row: Record<string, string>) => string;\n nodeSize: (row: Record<string, number>) => number;\n lineShape: (row: Record<string, string>) => string;\n lineColor: (row: Record<string, string>) => string;\n };\n onClick: (data: ClickEventData) => void;\n onSelectedUpdate: (node: HierarchyPointNode<TreeNodeData>) => void;\n selectedNodeId?: string;\n}\n\nconst SELECTED_NODE_HIGHLIGHT_WIDTH = 12;\n\nexport function NodesGroup({\n nodes,\n rootPosition,\n showLeavesLabels,\n showNodesLabels,\n aesGetters,\n selectedNodeId,\n onClick,\n onSelectedUpdate,\n}: NodeGroupProps) {\n const isVertical = rootPosition === 'top';\n const [hoveredNodeId, setHoveredNodeId] = useState<string | null>(null);\n useEffect(() => {\n setHoveredNodeId(null);\n }, [selectedNodeId]);\n return (\n <>\n <g>\n {nodes.map(node => {\n const row = node.data.rawData[0];\n const size = aesGetters.nodeSize(row as Record<string, number>);\n const color = aesGetters.nodeColor(row as Record<string, string>);\n const x = isVertical ? node.x : node.y;\n const y = isVertical ? node.y : node.x;\n return (\n <g\n key={node.id}\n transform={`translate(${x},${y})`}\n style={{cursor: 'pointer'}}\n onClick={e => {\n e.stopPropagation();\n onClick({x: x + MARGIN.LEFT, y: y + MARGIN.TOP, info: node.data.rawData});\n onSelectedUpdate(node);\n }}\n >\n <g>\n <circle\n cx={0}\n cy={0}\n r={size + SELECTED_NODE_HIGHLIGHT_WIDTH}\n fill={\n selectedNodeId === node.id\n ? SELECTED_NODE_COLOR\n : hoveredNodeId === node.id\n ? color\n : 'transparent'\n }\n opacity={DIMMED_OPACITY}\n onMouseOver={() => setHoveredNodeId(node.id ?? null)}\n onMouseLeave={() => setHoveredNodeId(null)}\n />\n </g>\n </g>\n );\n })}\n </g>\n <g>\n {nodes.map(node => {\n const row = node.data.rawData[0];\n const shape = aesGetters.nodeShape(row as Record<string, string>) as PointShape;\n const size = aesGetters.nodeSize(row as Record<string, number>);\n const color = aesGetters.nodeColor(row as Record<string, string>);\n const x = isVertical ? node.x : node.y;\n const y = isVertical ? node.y : node.x;\n return (\n <g\n key={node.id}\n transform={`translate(${x},${y})`}\n style={{cursor: 'pointer'}}\n onClick={e => {\n e.stopPropagation();\n onClick({x: x + MARGIN.LEFT, y: y + MARGIN.TOP, info: node.data.rawData});\n onSelectedUpdate(node);\n }}\n >\n <g\n onMouseOver={() => setHoveredNodeId(node.id ?? null)}\n onMouseLeave={() => setHoveredNodeId(null)}\n >\n {getPointShape(shape, size, selectedNodeId === node.id ? SELECTED_NODE_COLOR : color)}\n </g>\n </g>\n );\n })}\n </g>\n <g>\n {nodes.map(node => {\n const row = node.data.rawData[0];\n const size = aesGetters.nodeSize(row as Record<string, number>);\n const x = isVertical ? node.x : node.y;\n const y = isVertical ? node.y : node.x;\n return (\n <g\n key={node.id}\n transform={`translate(${x},${y})`}\n style={{pointerEvents: 'none'}}\n >\n {((showNodesLabels && node.children) || (showLeavesLabels && !node.children)) && (\n <text\n x={size + 4}\n y=\"4\"\n paintOrder=\"stroke\"\n stroke=\"white\"\n strokeWidth=\"3\"\n >\n {node.data.label}\n </text>\n )}\n </g>\n );\n })}\n </g>\n </>\n );\n}\n"],"names":["SELECTED_NODE_HIGHLIGHT_WIDTH","NodesGroup","nodes","rootPosition","showLeavesLabels","showNodesLabels","aesGetters","selectedNodeId","onClick","onSelectedUpdate","isVertical","hoveredNodeId","setHoveredNodeId","useState","useEffect","jsxs","Fragment","jsx","node","row","size","color","x","y","e","MARGIN","t","SELECTED_NODE_COLOR","DIMMED_OPACITY","shape","D"],"mappings":";;;;AAyBA,MAAMA,IAAgC;AAE/B,SAASC,EAAW;AAAA,EACvB,OAAAC;AAAAA,EACA,cAAAC;AAAAA,EACA,kBAAAC;AAAAA,EACA,iBAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,gBAAAC;AAAAA,EACA,SAAAC;AAAAA,EACA,kBAAAC;AACJ,GAAmB;AACf,QAAMC,IAAaP,MAAiB,OAC9B,CAACQ,GAAeC,CAAgB,IAAIC,EAAAA,SAAwB,IAAI;AACtEC,SAAAA,EAAAA,UAAU,MAAM;AACZF,IAAAA,EAAiB,IAAI;AAAA,EACzB,GAAG,CAACL,CAAc,CAAC,GAEfQ,gBAAAA,EAAAA,KAAAC,EAAAA,UAAA,EACI,UAAA;AAAA,IAAAC,gBAAAA,EAAAA,IAAC,KAAA,EACI,UAAAf,EAAM,IAAI,CAAAgB,MAAQ;AACf,YAAMC,IAAMD,EAAK,KAAK,QAAQ,CAAC,GACzBE,IAAOd,EAAW,SAASa,CAA6B,GACxDE,IAAQf,EAAW,UAAUa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AAA,QAAA;AAAA,QAZdF,EAAK;AAAA,MAAA;AAAA,IAiBtB,CAAC,GACL;AAAA,EAAA,GACJ;AAER;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"NodesGroup.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/dendro/components/NodesGroup.tsx"],"sourcesContent":["import type { HierarchyPointNode } from 'd3-hierarchy';\nimport { useEffect, useState } from 'react';\nimport type { ClickEventData, PointShape } from '../../types';\nimport { getPointShape } from '../../utils/getPointShape';\nimport { DIMMED_OPACITY, MARGIN, SELECTED_NODE_COLOR } from '../constants';\nimport type { DendroSettingsImpl } from '../DendroSettingsImpl';\nimport type { TreeNodeData } from '../getHierarchyData';\n\ninterface NodeGroupProps {\n nodes: HierarchyPointNode<TreeNodeData>[];\n rootPosition: DendroSettingsImpl['rootPosition'];\n showLeavesLabels: DendroSettingsImpl['showLeavesLabels'];\n showNodesLabels: DendroSettingsImpl['showNodesLabels'];\n aesGetters: {\n nodeShape: (idx: number) => string;\n nodeColor: (idx: number) => string;\n nodeSize: (idx: number) => number;\n lineShape: (idx: number) => string;\n lineColor: (idx: number) => string;\n };\n onClick: (data: ClickEventData) => void;\n onSelectedUpdate: (node: HierarchyPointNode<TreeNodeData>) => void;\n selectedNodeId?: string;\n}\n\nconst SELECTED_NODE_HIGHLIGHT_WIDTH = 12;\n\nexport function NodesGroup({\n nodes,\n rootPosition,\n showLeavesLabels,\n showNodesLabels,\n aesGetters,\n selectedNodeId,\n onClick,\n onSelectedUpdate,\n}: NodeGroupProps) {\n const isVertical = rootPosition === 'top';\n const [hoveredNodeId, setHoveredNodeId] = useState<string | null>(null);\n useEffect(() => {\n setHoveredNodeId(null);\n }, [selectedNodeId]);\n return (\n <>\n <g>\n {nodes.map(node => {\n const idx = node.data.rawIndexes[0];\n const size = aesGetters.nodeSize(idx);\n const color = aesGetters.nodeColor(idx);\n const x = isVertical ? node.x : node.y;\n const y = isVertical ? node.y : node.x;\n return (\n <g\n key={node.id}\n transform={`translate(${x},${y})`}\n style={{cursor: 'pointer'}}\n onClick={e => {\n e.stopPropagation();\n onClick({x: x + MARGIN.LEFT, y: y + MARGIN.TOP, info: node.data.rawIndexes});\n onSelectedUpdate(node);\n }}\n >\n <g>\n <circle\n cx={0}\n cy={0}\n r={size + SELECTED_NODE_HIGHLIGHT_WIDTH}\n fill={\n selectedNodeId === node.id\n ? SELECTED_NODE_COLOR\n : hoveredNodeId === node.id\n ? color\n : 'transparent'\n }\n opacity={DIMMED_OPACITY}\n onMouseOver={() => setHoveredNodeId(node.id ?? null)}\n onMouseLeave={() => setHoveredNodeId(null)}\n />\n </g>\n </g>\n );\n })}\n </g>\n <g>\n {nodes.map(node => {\n const idx = node.data.rawIndexes[0];\n const shape = aesGetters.nodeShape(idx) as PointShape;\n const size = aesGetters.nodeSize(idx);\n const color = aesGetters.nodeColor(idx);\n const x = isVertical ? node.x : node.y;\n const y = isVertical ? node.y : node.x;\n return (\n <g\n key={node.id}\n transform={`translate(${x},${y})`}\n style={{cursor: 'pointer'}}\n onClick={e => {\n e.stopPropagation();\n onClick({x: x + MARGIN.LEFT, y: y + MARGIN.TOP, info: node.data.rawIndexes});\n onSelectedUpdate(node);\n }}\n >\n <g\n onMouseOver={() => setHoveredNodeId(node.id ?? null)}\n onMouseLeave={() => setHoveredNodeId(null)}\n >\n {getPointShape(shape, size, selectedNodeId === node.id ? SELECTED_NODE_COLOR : color)}\n </g>\n </g>\n );\n })}\n </g>\n <g>\n {nodes.map(node => {\n const idx = node.data.rawIndexes[0];\n const size = aesGetters.nodeSize(idx);\n const x = isVertical ? node.x : node.y;\n const y = isVertical ? node.y : node.x;\n return (\n <g\n key={node.id}\n transform={`translate(${x},${y})`}\n style={{pointerEvents: 'none'}}\n >\n {((showNodesLabels && node.children) || (showLeavesLabels && !node.children)) && (\n <text\n x={size + 4}\n y=\"4\"\n paintOrder=\"stroke\"\n stroke=\"white\"\n strokeWidth=\"3\"\n >\n {node.data.label}\n </text>\n )}\n </g>\n );\n })}\n </g>\n </>\n );\n}\n"],"names":["SELECTED_NODE_HIGHLIGHT_WIDTH","NodesGroup","nodes","rootPosition","showLeavesLabels","showNodesLabels","aesGetters","selectedNodeId","onClick","onSelectedUpdate","isVertical","hoveredNodeId","setHoveredNodeId","useState","useEffect","jsxs","Fragment","jsx","node","idx","size","color","x","y","e","MARGIN","t","SELECTED_NODE_COLOR","DIMMED_OPACITY","shape","g"],"mappings":";;;;AAyBA,MAAMA,IAAgC;AAE/B,SAASC,EAAW;AAAA,EACvB,OAAAC;AAAAA,EACA,cAAAC;AAAAA,EACA,kBAAAC;AAAAA,EACA,iBAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,gBAAAC;AAAAA,EACA,SAAAC;AAAAA,EACA,kBAAAC;AACJ,GAAmB;AACf,QAAMC,IAAaP,MAAiB,OAC9B,CAACQ,GAAeC,CAAgB,IAAIC,EAAAA,SAAwB,IAAI;AACtEC,SAAAA,EAAAA,UAAU,MAAM;AACZF,IAAAA,EAAiB,IAAI;AAAA,EACzB,GAAG,CAACL,CAAc,CAAC,GAEfQ,gBAAAA,EAAAA,KAAAC,EAAAA,UAAA,EACI,UAAA;AAAA,IAAAC,gBAAAA,EAAAA,IAAC,KAAA,EACI,UAAAf,EAAM,IAAI,CAAAgB,MAAQ;AACf,YAAMC,IAAMD,EAAK,KAAK,WAAW,CAAC,GAC5BE,IAAOd,EAAW,SAASa,CAAG,GAC9BE,IAAQf,EAAW,UAAUa,CAAG,GAChCG,IAAIZ,IAAaQ,EAAK,IAAIA,EAAK,GAC/BK,IAAIb,IAAaQ,EAAK,IAAIA,EAAK;AACrC,aACID,gBAAAA,EAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UAEG,WAAW,aAAaK,CAAC,IAAIC,CAAC;AAAA,UAC9B,OAAO,EAAC,QAAQ,UAAA;AAAA,UAChB,SAAS,CAAAC,MAAK;AACV,YAAAA,EAAE,mBACFhB,EAAQ,EAAC,GAAGc,IAAIG,EAAO,MAAM,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AAAA,YAAA;AAAA,cACG,aAAa,MAAML,EAAiBM,EAAK,MAAM,IAAI;AAAA,cACnD,cAAc,MAAMN,EAAiB,IAAI;AAAA,cAExC,YAAciB,GAAOT,GAAMb,MAAmBW,EAAK,KAAKS,IAAsBN,CAAK;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAbnFH,EAAK;AAAA,MAAA;AAAA,IAiBtB,CAAC,GACL;AAAA,IACAD,gBAAAA,EAAAA,IAAC,KAAA,EACI,UAAAf,EAAM,IAAI,CAAAgB,MAAQ;AACf,YAAMC,IAAMD,EAAK,KAAK,WAAW,CAAC,GAC5BE,IAAOd,EAAW,SAASa,CAAG,GAC9BG,IAAIZ,IAAaQ,EAAK,IAAIA,EAAK,GAC/BK,IAAIb,IAAaQ,EAAK,IAAIA,EAAK;AACrC,aACID,gBAAAA,EAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UAEG,WAAW,aAAaK,CAAC,IAAIC,CAAC;AAAA,UAC9B,OAAO,EAAC,eAAe,OAAA;AAAA,UAEpB,WAAAO,KAAmBZ,EAAK,YAAcd,KAAoB,CAACc,EAAK,aAC/DD,gBAAAA,EAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACG,GAAGG,IAAO;AAAA,cACV,GAAE;AAAA,cACF,YAAW;AAAA,cACX,QAAO;AAAA,cACP,aAAY;AAAA,cAEX,YAAK,KAAK;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAZdF,EAAK;AAAA,MAAA;AAAA,IAiBtB,CAAC,GACL;AAAA,EAAA,GACJ;AAER;","x_google_ignoreList":[0]}
@@ -1,73 +1,77 @@
1
- function b(d, i, x, v, K, t, m) {
2
- return i === "stringSource" ? E(d, x, t, m) : G(d, i, x, v, K, t, m);
1
+ function G(t, x, m, d, S, n, g) {
2
+ return x === "stringSource" ? h(t, m, n, g) : V(t, x, m, d, S, n, g);
3
3
  }
4
- function G(d, i, x, v, K, t, m) {
5
- if (!x || !v)
4
+ function V(t, x, m, d, S, n, g) {
5
+ if (!m || !d)
6
6
  return null;
7
- const f = m.leaves().map((a) => String(a.data.rawData[0][t.value])), e = {
7
+ const K = g.leaves().map((l) => String(t.getColumnValue(n.value, l.data.rawIndexes[0]))), e = {
8
8
  xKeys: [],
9
9
  xGroupKeys: [],
10
10
  xKeysByGroups: {},
11
- yKeys: f,
11
+ yKeys: K,
12
12
  cells: {},
13
13
  meta: {
14
14
  valueExtent: [1 / 0, -1 / 0],
15
15
  uniqueValues: /* @__PURE__ */ new Set(),
16
16
  xLabels: {}
17
17
  }
18
- }, S = x, p = K, u = v, r = t, y = /* @__PURE__ */ new Set(), s = {}, n = /* @__PURE__ */ new Set();
19
- return d.rows.forEach((a) => {
20
- const o = p.length ? p.map((w) => String(a[w.value])).join("_") : "null";
21
- let l = a[u.value], c = a[r.value];
22
- if (l === null || c === null)
23
- return;
24
- l = String(l), c = String(c), s[o] || (s[o] = /* @__PURE__ */ new Set(), n.add(o)), y.add(l), s[o].add(l), e.cells[l] || (e.cells[l] = {});
25
- const g = a[S.value];
26
- if (i === "discrete" && e.meta.uniqueValues.add(String(g)), i === "continuous" && (e.meta.valueExtent[0] = Math.min(g, e.meta.valueExtent[0]), e.meta.valueExtent[1] = Math.max(g, e.meta.valueExtent[1])), e.cells[l][c] && g !== g)
27
- throw Error(`More than 1 value for x=${l}, y=${c}`);
28
- const h = String(a[u.valueLabels ?? u.value]);
29
- if (e.meta.xLabels[l] && h !== e.meta.xLabels[l])
30
- throw Error(`More than 1 x-label value for x=${l}`);
31
- e.meta.xLabels[l] = h, e.cells[l][c] = {
32
- id: `${l}_${c}`,
33
- x: l,
18
+ }, p = m, v = S, u = d, r = n, y = /* @__PURE__ */ new Set(), o = {}, s = /* @__PURE__ */ new Set();
19
+ for (let l = 0; l < t.rowsCount; l++) {
20
+ const i = v.length ? v.map((w) => String(t.getColumnValue(w.value, l))).join("_") : "null";
21
+ let a = t.getColumnValue(u.value, l), c = t.getColumnValue(r.value, l);
22
+ if (a === null || c === null)
23
+ continue;
24
+ a = String(a), c = String(c), o[i] || (o[i] = /* @__PURE__ */ new Set(), s.add(i)), y.add(a), o[i].add(a), e.cells[a] || (e.cells[a] = {});
25
+ const f = t.getColumnValue(p.value, l);
26
+ if (x === "discrete" && e.meta.uniqueValues.add(String(f)), x === "continuous" && (e.meta.valueExtent[0] = Math.min(f, e.meta.valueExtent[0]), e.meta.valueExtent[1] = Math.max(f, e.meta.valueExtent[1])), e.cells[a][c] && f !== f)
27
+ throw Error(`More than 1 value for x=${a}, y=${c}`);
28
+ const C = String(
29
+ t.getColumnValue(u.valueLabels ?? u.value, l)
30
+ );
31
+ if (e.meta.xLabels[a] && C !== e.meta.xLabels[a])
32
+ throw Error(`More than 1 x-label value for x=${a}`);
33
+ e.meta.xLabels[a] = C, e.cells[a][c] = {
34
+ idx: l,
35
+ id: `${a}_${c}`,
36
+ x: a,
34
37
  y: c,
35
- value: a[S.value],
36
- data: a
38
+ value: t.getColumnValue(p.value, l)
37
39
  };
38
- }), e.xGroupKeys = [...n], e.xKeysByGroups = [...n].reduce((a, o) => (a[o] = [...s[o]], a), {}), e.xKeys = e.xGroupKeys.reduce((a, o) => (a = a.concat(e.xKeysByGroups[o]), a), []), e;
40
+ }
41
+ return e.xGroupKeys = [...s], e.xKeysByGroups = [...s].reduce((l, i) => (l[i] = [...o[i]], l), {}), e.xKeys = e.xGroupKeys.reduce((l, i) => (l = l.concat(e.xKeysByGroups[i]), l), []), e;
39
42
  }
40
- function E(d, i, x, v) {
41
- if (!i)
43
+ function h(t, x, m, d) {
44
+ if (!x)
42
45
  return null;
43
- const K = v.leaves().map((u) => String(u.data.rawData[0][x.value])), t = {
46
+ const S = d.leaves().map((u) => String(t.getColumnValue(m.value, u.data.rawIndexes[0]))), n = {
44
47
  xKeys: [],
45
48
  xGroupKeys: [],
46
49
  xKeysByGroups: {},
47
- yKeys: K,
50
+ yKeys: S,
48
51
  cells: {},
49
52
  meta: {
50
53
  valueExtent: [1 / 0, -1 / 0],
51
54
  uniqueValues: /* @__PURE__ */ new Set(),
52
55
  xLabels: {}
53
56
  }
54
- }, m = i, f = x, e = { null: /* @__PURE__ */ new Set() }, S = ["null"];
55
- let p = 0;
56
- return d.rows.forEach((u) => {
57
- const r = u[m.value];
58
- let y = u[f.value];
57
+ }, g = x, K = m, e = { null: /* @__PURE__ */ new Set() }, p = ["null"];
58
+ let v = 0;
59
+ for (let u = 0; u < t.rowsCount; u++) {
60
+ const r = t.getColumnValue(g.value, u);
61
+ let y = t.getColumnValue(K.value, u);
59
62
  if (!(r === null || y === null)) {
60
63
  y = String(y);
61
- for (let s = 0; s < r.length; s++) {
62
- p = Math.max(p, r.length);
63
- const n = String(s), a = r[s];
64
- e.null.add(n), t.meta.uniqueValues.add(a), t.meta.xLabels[n] = n, t.cells[n] || (t.cells[n] = {}), t.cells[n][y] = { id: `${n}_${y}`, x: n, y, value: a, data: u };
64
+ for (let o = 0; o < r.length; o++) {
65
+ v = Math.max(v, r.length);
66
+ const s = String(o), l = r[o];
67
+ e.null.add(s), n.meta.uniqueValues.add(l), n.meta.xLabels[s] = s, n.cells[s] || (n.cells[s] = {}), n.cells[s][y] = { idx: u, id: `${s}_${y}`, x: s, y, value: l };
65
68
  }
66
69
  }
67
- }), t.xGroupKeys = S, t.xKeysByGroups = S.reduce((u, r) => (u[r] = [...e[r]], u), {}), t.xKeys = new Array(p).fill(null).map((u, r) => String(r)), t;
70
+ }
71
+ return n.xGroupKeys = p, n.xKeysByGroups = p.reduce((u, r) => (u[r] = [...e[r]], u), {}), n.xKeys = new Array(v).fill(null).map((u, r) => String(r)), n;
68
72
  }
69
73
  export {
70
- b as getHeatmapData,
71
- G as getHeatmapDataWithAxisColumn
74
+ G as getHeatmapData,
75
+ V as getHeatmapDataWithAxisColumn
72
76
  };
73
77
  //# sourceMappingURL=getHeatmapData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getHeatmapData.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/dendro/getHeatmapData.ts"],"sourcesContent":["import type {DataFrame} from '../DataFrame';\nimport type {DendroSettingsImpl} from './DendroSettingsImpl';\nimport type {TreeNodeData} from './getHierarchyData';\nimport type {Cell} from './components/types';\nimport type {HierarchyNode} from 'd3-hierarchy';\n\nexport type HeatmapData = {\n xKeys: string[];\n yKeys: string[];\n xGroupKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n cells: Record<string, Record<string, Cell>>;\n meta: {\n valueExtent: [number, number];\n uniqueValues: Set<string>;\n xLabels: Record<string, string>;\n };\n};\n\nexport function getHeatmapData(\n data:DataFrame,\n type: DendroSettingsImpl['heatmapSettings']['valueType'],\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n heatmapAxis: DendroSettingsImpl['heatmapAxis'],\n heatmapGroup: DendroSettingsImpl['heatmapGroup'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) {\n return type === 'stringSource'\n ? getHeatmapDataByStringSource(data, heatmapAnnotation, id, hierarchy)\n : getHeatmapDataWithAxisColumn(data, type, heatmapAnnotation, heatmapAxis, heatmapGroup, id, hierarchy);\n}\nexport function getHeatmapDataWithAxisColumn(\n data:DataFrame,\n type: DendroSettingsImpl['heatmapSettings']['valueType'],\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n heatmapAxis: DendroSettingsImpl['heatmapAxis'],\n heatmapGroup: DendroSettingsImpl['heatmapGroup'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) : HeatmapData | null {\n if (!heatmapAnnotation || !heatmapAxis) {\n return null;\n }\n const yKeys = hierarchy.leaves().map((node) => String(node.data.rawData[0][id.value]));\n const result:HeatmapData = {\n xKeys: [],\n xGroupKeys: [],\n xKeysByGroups: {},\n yKeys: yKeys,\n cells: {},\n meta: {\n valueExtent: [Infinity, -Infinity],\n uniqueValues: new Set(),\n xLabels: {},\n }\n };\n const valueColumn = heatmapAnnotation;\n const xGroupBy = heatmapGroup;\n const xColumn = heatmapAxis;\n const yColumn = id;\n\n const xKeysSet = new Set<string>();\n const xKeysByGroups:Record<string, Set<string>> = {};\n const xGroupKeys = new Set<string>();\n data.rows.forEach(row => {\n const xGroupKey = xGroupBy.length ? xGroupBy.map(column => String(row[column.value])).join('_') : 'null';\n let x = row[xColumn.value];\n let y = row[yColumn.value];\n if (x === null || y === null) {\n return;\n }\n x = String(x);\n y = String(y);\n if (!xKeysByGroups[xGroupKey]) {\n xKeysByGroups[xGroupKey] = new Set<string>();\n xGroupKeys.add(xGroupKey);\n }\n xKeysSet.add(x);\n xKeysByGroups[xGroupKey].add(x);\n\n if (!result.cells[x]) {\n result.cells[x] = {};\n }\n\n const value = row[valueColumn.value];\n\n if (type === 'discrete') {\n result.meta.uniqueValues.add(String(value));\n }\n if (type === 'continuous') {\n result.meta.valueExtent[0] = Math.min(value as number, result.meta.valueExtent[0]);\n result.meta.valueExtent[1] = Math.max(value as number, result.meta.valueExtent[1]);\n }\n\n if (result.cells[x][y] && value !== value) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n const label = String(row[xColumn.valueLabels ?? xColumn.value]);\n if (result.meta.xLabels[x] && label !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n result.meta.xLabels[x] = label;\n\n result.cells[x][y] = {\n id: `${x}_${y}`,\n x,\n y,\n value: row[valueColumn.value],\n data: row,\n };\n });\n result.xGroupKeys = [...xGroupKeys];\n result.xKeysByGroups = [...xGroupKeys].reduce((res:HeatmapData['xKeysByGroups'], key) => {\n res[key] = [...xKeysByGroups[key]];\n return res;\n }, {});\n result.xKeys = result.xGroupKeys.reduce((res:string[], groupKey) => {\n res = res.concat(result.xKeysByGroups[groupKey]);\n return res;\n }, []);\n return result;\n}\n\nfunction getHeatmapDataByStringSource(\n data:DataFrame,\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) : HeatmapData | null {\n if (!heatmapAnnotation) {\n return null;\n }\n const yKeys = hierarchy.leaves().map((node) => String(node.data.rawData[0][id.value]));\n const result:HeatmapData = {\n xKeys: [],\n xGroupKeys: [],\n xKeysByGroups: {},\n yKeys: yKeys,\n cells: {},\n meta: {\n valueExtent: [Infinity, -Infinity],\n uniqueValues: new Set(),\n xLabels: {},\n }\n };\n const valueColumn = heatmapAnnotation;\n const yColumn = id;\n\n const xKeysByGroups:Record<string, Set<string>> = {'null': new Set()};\n const xGroupKeys = ['null'];\n let maxLine = 0;\n\n data.rows.forEach(row => {\n const line = row[valueColumn.value] as string;\n let y = row[yColumn.value];\n if (line === null || y === null) {\n return;\n }\n y = String(y);\n for (let i = 0; i < line.length; i++) {\n maxLine = Math.max(maxLine, line.length);\n const x = String(i);\n const value = line[i];\n xKeysByGroups['null'].add(x);\n\n result.meta.uniqueValues.add(value);\n result.meta.xLabels[x] = x;\n\n if (!result.cells[x]) {\n result.cells[x] = {};\n }\n result.cells[x][y] = {id: `${x}_${y}`, x, y, value, data: row};\n }\n });\n result.xGroupKeys = xGroupKeys;\n result.xKeysByGroups = xGroupKeys.reduce((res:HeatmapData['xKeysByGroups'], key) => {\n res[key] = [...xKeysByGroups[key]];\n return res;\n }, {});\n result.xKeys = new Array(maxLine).fill(null).map((_v, idx) => String(idx));\n return result;\n}\n"],"names":["getHeatmapData","data","type","heatmapAnnotation","heatmapAxis","heatmapGroup","id","hierarchy","getHeatmapDataByStringSource","getHeatmapDataWithAxisColumn","yKeys","node","result","valueColumn","xGroupBy","xColumn","yColumn","xKeysSet","xKeysByGroups","xGroupKeys","row","xGroupKey","column","x","y","value","label","res","key","groupKey","maxLine","line","i","_v","idx"],"mappings":"AAmBO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACF;AACE,SAAOL,MAAS,iBACVM,EAA6BP,GAAME,GAAmBG,GAAIC,CAAS,IACnEE,EAA6BR,GAAMC,GAAMC,GAAmBC,GAAaC,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gBO,EAAW,OAAO,CAACQ,GAAkCC,OACxED,EAAIC,CAAG,IAAI,CAAC,GAAGV,EAAcU,CAAG,CAAC,GAC1BD,IACR,CAAA,CAAE,GACLf,EAAO,QAAQ,IAAI,MAAMkB,CAAO,EAAE,KAAK,IAAI,EAAE,IAAI,CAACG,GAAIC,MAAQ,OAAOA,CAAG,CAAC,GAClEtB;AACX;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"getHeatmapData.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/dendro/getHeatmapData.ts"],"sourcesContent":["import type { HierarchyNode } from 'd3-hierarchy';\nimport type { DataFrame } from '../DataFrame';\nimport type { Cell } from './components/types';\nimport type { DendroSettingsImpl } from './DendroSettingsImpl';\nimport type { TreeNodeData } from './getHierarchyData';\n\nexport type HeatmapData = {\n xKeys: string[];\n yKeys: string[];\n xGroupKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n cells: Record<string, Record<string, Cell>>;\n meta: {\n valueExtent: [number, number];\n uniqueValues: Set<string>;\n xLabels: Record<string, string>;\n };\n};\n\nexport function getHeatmapData(\n data:DataFrame,\n type: DendroSettingsImpl['heatmapSettings']['valueType'],\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n heatmapAxis: DendroSettingsImpl['heatmapAxis'],\n heatmapGroup: DendroSettingsImpl['heatmapGroup'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) {\n return type === 'stringSource'\n ? getHeatmapDataByStringSource(data, heatmapAnnotation, id, hierarchy)\n : getHeatmapDataWithAxisColumn(data, type, heatmapAnnotation, heatmapAxis, heatmapGroup, id, hierarchy);\n}\nexport function getHeatmapDataWithAxisColumn(\n data:DataFrame,\n type: DendroSettingsImpl['heatmapSettings']['valueType'],\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n heatmapAxis: DendroSettingsImpl['heatmapAxis'],\n heatmapGroup: DendroSettingsImpl['heatmapGroup'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) : HeatmapData | null {\n if (!heatmapAnnotation || !heatmapAxis) {\n return null;\n }\n const yKeys = hierarchy.leaves().map((node) => String(data.getColumnValue(id.value, node.data.rawIndexes[0])));\n const result:HeatmapData = {\n xKeys: [],\n xGroupKeys: [],\n xKeysByGroups: {},\n yKeys: yKeys,\n cells: {},\n meta: {\n valueExtent: [Infinity, -Infinity],\n uniqueValues: new Set(),\n xLabels: {},\n }\n };\n const valueColumn = heatmapAnnotation;\n const xGroupBy = heatmapGroup;\n const xColumn = heatmapAxis;\n const yColumn = id;\n\n const xKeysSet = new Set<string>();\n const xKeysByGroups:Record<string, Set<string>> = {};\n const xGroupKeys = new Set<string>();\n\n for (let i = 0; i < data.rowsCount; i++) {\n const xGroupKey = xGroupBy.length ? xGroupBy.map(column => String(data.getColumnValue(column.value, i))).join('_') : 'null';\n let x = data.getColumnValue(xColumn.value, i);\n let y = data.getColumnValue(yColumn.value, i);\n if (x === null || y === null) {\n continue;\n }\n\n x = String(x);\n y = String(y);\n if (!xKeysByGroups[xGroupKey]) {\n xKeysByGroups[xGroupKey] = new Set<string>();\n xGroupKeys.add(xGroupKey);\n }\n xKeysSet.add(x);\n xKeysByGroups[xGroupKey].add(x);\n\n if (!result.cells[x]) {\n result.cells[x] = {};\n }\n\n const value = data.getColumnValue(valueColumn.value, i);\n\n if (type === 'discrete') {\n result.meta.uniqueValues.add(String(value));\n }\n if (type === 'continuous') {\n result.meta.valueExtent[0] = Math.min(value as number, result.meta.valueExtent[0]);\n result.meta.valueExtent[1] = Math.max(value as number, result.meta.valueExtent[1]);\n }\n\n if (result.cells[x][y] && value !== value) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n const label = String(\n data.getColumnValue(xColumn.valueLabels ?? xColumn.value, i)\n );\n if (result.meta.xLabels[x] && label !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n result.meta.xLabels[x] = label;\n\n result.cells[x][y] = {\n idx: i,\n id: `${x}_${y}`,\n x,\n y,\n value: data.getColumnValue(valueColumn.value, i),\n };\n }\n\n result.xGroupKeys = [...xGroupKeys];\n result.xKeysByGroups = [...xGroupKeys].reduce((res:HeatmapData['xKeysByGroups'], key) => {\n res[key] = [...xKeysByGroups[key]];\n return res;\n }, {});\n result.xKeys = result.xGroupKeys.reduce((res:string[], groupKey) => {\n res = res.concat(result.xKeysByGroups[groupKey]);\n return res;\n }, []);\n return result;\n}\n\nfunction getHeatmapDataByStringSource(\n data:DataFrame,\n heatmapAnnotation: DendroSettingsImpl['heatmapAnnotation'],\n id: DendroSettingsImpl['id'],\n hierarchy: HierarchyNode<TreeNodeData>\n) : HeatmapData | null {\n if (!heatmapAnnotation) {\n return null;\n }\n const yKeys = hierarchy.leaves().map((node) => String(data.getColumnValue(id.value, node.data.rawIndexes[0])));\n const result:HeatmapData = {\n xKeys: [],\n xGroupKeys: [],\n xKeysByGroups: {},\n yKeys: yKeys,\n cells: {},\n meta: {\n valueExtent: [Infinity, -Infinity],\n uniqueValues: new Set(),\n xLabels: {},\n }\n };\n const valueColumn = heatmapAnnotation;\n const yColumn = id;\n\n const xKeysByGroups:Record<string, Set<string>> = {'null': new Set()};\n const xGroupKeys = ['null'];\n let maxLine = 0;\n\n for (let i = 0; i < data.rowsCount; i++) {\n const line = data.getColumnValue(valueColumn.value, i) as string;\n let y = data.getColumnValue(yColumn.value, i);\n if (line === null || y === null) {\n continue;\n }\n y = String(y);\n for (let j = 0; j < line.length; j++) {\n maxLine = Math.max(maxLine, line.length);\n const x = String(j);\n const value = line[j];\n xKeysByGroups['null'].add(x);\n\n result.meta.uniqueValues.add(value);\n result.meta.xLabels[x] = x;\n\n if (!result.cells[x]) {\n result.cells[x] = {};\n }\n result.cells[x][y] = {idx: i, id: `${x}_${y}`, x, y, value};\n }\n }\n \n result.xGroupKeys = xGroupKeys;\n result.xKeysByGroups = xGroupKeys.reduce((res:HeatmapData['xKeysByGroups'], key) => {\n res[key] = [...xKeysByGroups[key]];\n return res;\n }, {});\n result.xKeys = new Array(maxLine).fill(null).map((_v, idx) => String(idx));\n return result;\n}\n"],"names":["getHeatmapData","data","type","heatmapAnnotation","heatmapAxis","heatmapGroup","id","hierarchy","getHeatmapDataByStringSource","getHeatmapDataWithAxisColumn","yKeys","node","result","valueColumn","xGroupBy","xColumn","yColumn","xKeysSet","xKeysByGroups","xGroupKeys","i","xGroupKey","column","x","y","value","label","res","key","groupKey","maxLine","line","j","_v","idx"],"mappings":"AAmBO,SAASA,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACF;AACE,SAAOL,MAAS,iBACVM,EAA6BP,GAAME,GAAmBG,GAAIC,CAAS,IACnEE,EAA6BR,GAAMC,GAAMC,GAAmBC,GAAaC,GAAcC,GAAIC,CAAS;AAC9G;AACO,SAASE,EACZR,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACmB;AACnB,MAAI,CAACJ,KAAqB,CAACC;AACvB,WAAO;AAEX,QAAMM,IAAQH,EAAU,OAAA,EAAS,IAAI,CAACI,MAAS,OAAOV,EAAK,eAAeK,EAAG,OAAOK,EAAK,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,GACvGC,IAAqB;AAAA,IACvB,OAAO,CAAA;AAAA,IACP,YAAY,CAAA;AAAA,IACZ,eAAe,CAAA;AAAA,IACf,OAAAF;AAAAA,IACA,OAAO,CAAA;AAAA,IACP,MAAM;AAAA,MACF,aAAa,CAAC,OAAU,MAAS;AAAA,MACjC,kCAAkB,IAAA;AAAA,MAClB,SAAS,CAAA;AAAA,IAAA;AAAA,EAAC,GAGZG,IAAcV,GACdW,IAAWT,GACXU,IAAUX,GACVY,IAAUV,GAEVW,IAAAA,oBAAe,OACfC,IAA4C,CAAA,GAC5CC,wBAAiB,IAAA;AAEvB,WAASC,IAAI,GAAGA,IAAInB,EAAK,WAAWmB,KAAK;AACrC,UAAMC,IAAYP,EAAS,SAASA,EAAS,IAAI,OAAU,OAAOb,EA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