@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,20 +1,24 @@
1
+ import { renderToString as v } from "../node_modules/react-dom/server.browser.js";
1
2
  import { AbstractChart as C } from "../AbstractChart.js";
2
- import { getCells as v } from "./getCells.js";
3
- import { renderToString as g } from "../node_modules/react-dom/server.browser.js";
4
- import y from "./ChartRenderer.js";
5
- import { BubbleSettingsImpl as m } from "./BubbleSettingsImpl.js";
6
- import { getKeysCombinations as f } from "../utils/getKeysCombination.js";
7
- var D = Object.defineProperty, b = (i, t, e) => t in i ? D(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, d = (i, t, e) => b(i, typeof t != "symbol" ? t + "" : t, e);
8
- class R extends C {
3
+ import { getKeysCombinations as g } from "../utils/getKeysCombination.js";
4
+ import { BubbleSettingsImpl as c } from "./BubbleSettingsImpl.js";
5
+ import D from "./ChartRenderer.js";
6
+ import { getCellTooltip as f } from "./getCellTooltip.js";
7
+ import { getGroupedCellsData as y } from "./getGroupedCellsData.js";
8
+ var b = Object.defineProperty, S = (n, t, e) => t in n ? b(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, s = (n, t, e) => S(n, typeof t != "symbol" ? t + "" : t, e);
9
+ class T extends C {
9
10
  constructor(t, e, a) {
10
- super(t, e), d(this, "settings"), d(this, "chartRenderer", new y()), d(this, "onTooltipHintSwitch", () => {
11
- }), d(this, "calculatedData", null), this.settings = new m(e), a && (this.onTooltipHintSwitch = a[0]);
11
+ super(t, e), s(this, "settings"), s(this, "chartRenderer"), s(this, "onTooltipHintSwitch", () => {
12
+ }), s(this, "calculatedData", null), s(this, "_getTooltip", (r) => {
13
+ var l, o, i;
14
+ return this.calculatedData ? f(this.data, r, this.calculatedData.groupedCellsData.meta, (i = (o = (l = this.settings) == null ? void 0 : l.chartSettings) == null ? void 0 : o.tooltips) == null ? void 0 : i.content) : ["No data available"];
15
+ }), this.settings = new c(e), this.chartRenderer = new D(), a && (this.onTooltipHintSwitch = a[0]);
12
16
  }
13
17
  mount(t) {
14
18
  try {
15
- this.chartRenderer.init(t), this._updateData(), this._updateChart();
19
+ this.chartRenderer.init(t), this._updateData(), this._updateChart(), this.hasError = !1;
16
20
  } catch (e) {
17
- e instanceof Error && this.chartRenderer.renderError(e.message);
21
+ this.hasError = !0, e instanceof Error && (this.chartRenderer.renderError(e.message), console.error(e));
18
22
  }
19
23
  }
20
24
  unmount() {
@@ -23,48 +27,47 @@ class R extends C {
23
27
  updateSettingsAndData(t, e) {
24
28
  try {
25
29
  const a = this.settings, r = this.data;
26
- this.settings = new m(e), this.data = t, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(r, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart();
30
+ this.settings = new c(e), this.data = t, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(r, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart(), this.hasError = !1;
27
31
  } catch (a) {
28
- a instanceof Error && this.chartRenderer.renderError(a.message);
32
+ this.hasError = !0, a instanceof Error && (this.chartRenderer.renderError(a.message), console.error(a));
29
33
  }
30
34
  }
31
35
  updateChartState(t, e) {
32
36
  console.warn("no chart state for bubble chart");
33
37
  }
34
38
  export() {
35
- return this._updateChart(), g(this.chartRenderer.component);
39
+ return this._updateChart(), v(this.chartRenderer.component);
36
40
  }
37
41
  _needUpdateCalculatedDataBySettings(t, e) {
38
- var a, r, l, n;
39
- return t.facetBy.some((s, o) => {
40
- var u;
41
- return s.value !== ((u = e.facetBy[o]) == null ? void 0 : u.value);
42
- }) || ((a = t.normalization) == null ? void 0 : a.method) !== ((r = e.normalization) == null ? void 0 : r.method) || ((l = t.normalization) == null ? void 0 : l.direction) !== ((n = e.normalization) == null ? void 0 : n.direction) || t.xColumn.value !== e.xColumn.value || t.yColumn.value !== e.yColumn.value || t.valueColumnColor.value !== e.valueColumnColor.value || t.valueColumnSize.value !== e.valueColumnSize.value || t.NAValueAs !== e.NAValueAs;
42
+ var a, r, l, o;
43
+ return t.facetBy.some((i, u) => {
44
+ var h;
45
+ return i.value !== ((h = e.facetBy[u]) == null ? void 0 : h.value);
46
+ }) || ((a = t.normalization) == null ? void 0 : a.method) !== ((r = e.normalization) == null ? void 0 : r.method) || ((l = t.normalization) == null ? void 0 : l.direction) !== ((o = e.normalization) == null ? void 0 : o.direction) || t.xColumn.value !== e.xColumn.value || t.yColumn.value !== e.yColumn.value || t.valueColumnColor.value !== e.valueColumnColor.value || t.valueColumnSize.value !== e.valueColumnSize.value || t.NAValueAs !== e.NAValueAs;
43
47
  }
44
48
  _needUpdateCalculatedDataByData(t, e) {
45
49
  const a = Object.keys(t.data), r = Object.keys(e.data);
46
50
  return t.id !== e.id || a.length !== r.length || a.some((l) => {
47
- var n;
48
- return t.data[l].length !== ((n = e.data[l]) == null ? void 0 : n.length);
51
+ var o;
52
+ return t.data[l].length !== ((o = e.data[l]) == null ? void 0 : o.length);
49
53
  });
50
54
  }
51
55
  _updateData() {
52
- const { facetBy: t, xColumn: e, yColumn: a, valueColumnSize: r, valueColumnColor: l, normalization: n, NAValueAs: s } = this.settings, o = t.map((h) => this.data.getColumnCategories(h.value)), u = o.length ? f([...o]) : [["null"]], p = t.map((h) => h.value) ?? null;
53
- this.data.setGrouping([...p]);
54
- const c = v(
56
+ const { facetBy: t, xColumn: e, yColumn: a, valueColumnSize: r, valueColumnColor: l, normalization: o, NAValueAs: i } = this.settings, u = t.map((d) => this.data.getColumnCategories(d.value)), h = u.length ? g([...u]) : [["null"]], m = t.map((d) => d.value) ?? null;
57
+ this.data.setGrouping([...m]);
58
+ const p = y(
55
59
  this.data,
56
60
  e,
57
61
  a,
58
62
  r,
59
63
  l,
60
64
  t,
61
- u,
62
- n,
63
- s
65
+ h,
66
+ o,
67
+ i
64
68
  );
65
69
  this.calculatedData = {
66
- facetKeys: c.meta.facetKeys,
67
- groupedCellsData: c
70
+ groupedCellsData: p
68
71
  };
69
72
  }
70
73
  _updateAesInData() {
@@ -73,22 +76,23 @@ class R extends C {
73
76
  _updateChart() {
74
77
  if (!this.calculatedData)
75
78
  return;
76
- const { id: t, chartSettings: e, facetSettings: a, valueColumnColor: r, valueColumnSize: l, normalization: n, aes: s } = this.settings;
79
+ const { id: t, chartSettings: e, facetSettings: a, valueColumnColor: r, valueColumnSize: l, normalization: o, aes: i } = this.settings;
77
80
  this.chartRenderer.render(
81
+ this.data,
78
82
  t,
79
83
  e,
80
84
  a,
81
- this.calculatedData.facetKeys,
82
85
  this.calculatedData.groupedCellsData,
83
86
  r,
84
87
  l,
85
- n,
86
- s,
88
+ o,
89
+ i,
90
+ this._getTooltip,
87
91
  this.onTooltipHintSwitch
88
92
  );
89
93
  }
90
94
  }
91
95
  export {
92
- R as ChartBubble
96
+ T as ChartBubble
93
97
  };
94
98
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/bubble/index.ts"],"sourcesContent":["import {AbstractChart} from '../AbstractChart';\nimport {getCells} from './getCells';\nimport type {GroupedCellsData} from './getCells';\nimport type {BubbleEventHandlers, BubbleSettings} from '../types';\nimport {renderToString} from 'react-dom/server';\nimport ChartRenderer from './ChartRenderer';\nimport {BubbleSettingsImpl} from './BubbleSettingsImpl';\nimport type {DataFrame} from '../DataFrame';\nimport {getKeysCombinations} from '../utils/getKeysCombination';\n\nexport class ChartBubble extends AbstractChart {\n settings: BubbleSettingsImpl;\n chartRenderer = new ChartRenderer();\n\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n calculatedData: {\n facetKeys: string[];\n groupedCellsData: GroupedCellsData;\n } | null = null;\n\n constructor(data: DataFrame, settings: BubbleSettings, eventHandlers?: BubbleEventHandlers) {\n super(data, settings);\n\n this.settings = new BubbleSettingsImpl(settings);\n if (eventHandlers) {\n this.onTooltipHintSwitch = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: BubbleSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new BubbleSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n }\n }\n }\n\n updateChartState(_field: string, _value: unknown) {\n console.warn('no chart state for bubble chart');\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: BubbleSettingsImpl, settings: BubbleSettingsImpl) {\n return prevSettings.facetBy.some((el, idx) => el.value !== settings.facetBy[idx]?.value) ||\n prevSettings.normalization?.method !== settings.normalization?.method ||\n prevSettings.normalization?.direction !== settings.normalization?.direction ||\n prevSettings.xColumn.value !== settings.xColumn.value ||\n prevSettings.yColumn.value !== settings.yColumn.value ||\n prevSettings.valueColumnColor.value !== settings.valueColumnColor.value ||\n prevSettings.valueColumnSize.value !== settings.valueColumnSize.value ||\n prevSettings.NAValueAs !== settings.NAValueAs;\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {facetBy, xColumn, yColumn, valueColumnSize, valueColumnColor, normalization, NAValueAs} = this.settings;\n\n const facetKeysLists = facetBy.map(column => this.data.getColumnCategories(column.value));\n const facetKeysCombinations = facetKeysLists.length ? getKeysCombinations([...facetKeysLists]) : [['null']];\n const facetGroupingValues = facetBy.map(column => column.value) ?? null;\n\n this.data.setGrouping([...facetGroupingValues]);\n\n const cells = getCells(\n this.data,\n xColumn,\n yColumn,\n valueColumnSize,\n valueColumnColor,\n facetBy,\n facetKeysCombinations,\n normalization,\n NAValueAs\n );\n this.calculatedData = {\n facetKeys: cells.meta.facetKeys,\n groupedCellsData: cells,\n };\n }\n\n _updateAesInData() {\n const calculated = this.calculatedData;\n if (!calculated) {\n return;\n }\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {id, chartSettings, facetSettings, valueColumnColor, valueColumnSize, normalization, aes} = this.settings;\n this.chartRenderer.render(\n id,\n chartSettings,\n facetSettings,\n this.calculatedData.facetKeys,\n this.calculatedData.groupedCellsData,\n valueColumnColor,\n valueColumnSize,\n normalization,\n aes,\n this.onTooltipHintSwitch\n );\n }\n}\n"],"names":["ChartBubble","AbstractChart","data","settings","eventHandlers","__publicField","ChartRenderer","BubbleSettingsImpl","node","err","previousSettings","previousData","_field","_value","renderToString","prevSettings","el","idx","_a","_b","_c","_d","prevData","prevKeys","keys","o","key","facetBy","xColumn","yColumn","valueColumnSize","valueColumnColor","normalization","NAValueAs","facetKeysLists","column","facetKeysCombinations","getKeysCombinations","facetGroupingValues","cells","getCells","id","chartSettings","facetSettings","aes"],"mappings":";;;;;;;AAUO,MAAMA,UAAoBC,EAAc;AAAA,EAU3C,YAAYC,GAAiBC,GAA0BC,GAAqC;AACxF,UAAMF,GAAMC,CAAQ,GAVxBE,EAAA,MAAA,UAAA,GACAA,EAAA,MAAA,iBAAgB,IAAIC,EAAAA,CAAA,GAEpBD,EAAA,6BAA2C,MAAA;AAAA,IAAA,CAAA,GAC3CA,EAAA,MAAA,kBAGW,IAAA,GAKP,KAAK,WAAW,IAAIE,EAAmBJ,CAAQ,GAC3CC,MACA,KAAK,sBAAsBA,EAAc,CAAC;AAAA,EAElD;AAAA,EAEA,MAAMI,GAAmB;AACrB,QAAI;AACA,WAAK,cAAc,KAAKA,CAAI,GAC5B,KAAK,YAAA,GACL,KAAK,aAAA;AAAA,IACT,SAASC,GAAK;AACNA,MAAAA,aAAe,SACf,KAAK,cAAc,YAAYA,EAAI,OAAiB;AAAA,IAE5D;AAAA,EACJ;AAAA,E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AACvG,SAAK,cAAc;AAAA,MACfH;AAAAA,MACAC;AAAAA,MACAC;AAAAA,MACA,KAAK,eAAe;AAAA,MACpB,KAAK,eAAe;AAAA,MACpBZ;AAAAA,MACAD;AAAAA,MACAE;AAAAA,MACAY;AAAAA,MACA,KAAK;AAAA,IAAA;AAAA,EAEb;AACJ;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/bubble/index.ts"],"sourcesContent":["import { renderToString } from 'react-dom/server';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport type { BubbleEventHandlers, BubbleSettings } from '../types';\nimport { getKeysCombinations } from '../utils/getKeysCombination';\nimport { BubbleSettingsImpl } from './BubbleSettingsImpl';\nimport ChartRenderer from './ChartRenderer';\nimport { getCellTooltip } from './getCellTooltip';\nimport type { Cell, GroupedCellsData } from './getGroupedCellsData';\nimport { getGroupedCellsData } from './getGroupedCellsData';\n\nexport class ChartBubble extends AbstractChart {\n settings: BubbleSettingsImpl;\n chartRenderer: ChartRenderer;\n\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n calculatedData: {\n groupedCellsData: GroupedCellsData;\n } | null = null;\n\n constructor(data: DataFrame, settings: BubbleSettings, eventHandlers?: BubbleEventHandlers) {\n super(data, settings);\n\n this.settings = new BubbleSettingsImpl(settings);\n this.chartRenderer = new ChartRenderer();\n if (eventHandlers) {\n this.onTooltipHintSwitch = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: BubbleSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new BubbleSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n updateChartState(_field: string, _value: unknown) {\n console.warn('no chart state for bubble chart');\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: BubbleSettingsImpl, settings: BubbleSettingsImpl) {\n return prevSettings.facetBy.some((el, idx) => el.value !== settings.facetBy[idx]?.value) ||\n prevSettings.normalization?.method !== settings.normalization?.method ||\n prevSettings.normalization?.direction !== settings.normalization?.direction ||\n prevSettings.xColumn.value !== settings.xColumn.value ||\n prevSettings.yColumn.value !== settings.yColumn.value ||\n prevSettings.valueColumnColor.value !== settings.valueColumnColor.value ||\n prevSettings.valueColumnSize.value !== settings.valueColumnSize.value ||\n prevSettings.NAValueAs !== settings.NAValueAs;\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {facetBy, xColumn, yColumn, valueColumnSize, valueColumnColor, normalization, NAValueAs} = this.settings;\n\n const facetKeysLists = facetBy.map(column => this.data.getColumnCategories(column.value));\n const facetKeysCombinations = facetKeysLists.length ? getKeysCombinations([...facetKeysLists]) : [['null']];\n const facetGroupingValues = facetBy.map(column => column.value) ?? null;\n\n this.data.setGrouping([...facetGroupingValues]);\n\n const groupedCellsData = getGroupedCellsData(\n this.data,\n xColumn,\n yColumn,\n valueColumnSize,\n valueColumnColor,\n facetBy,\n facetKeysCombinations,\n normalization,\n NAValueAs\n );\n this.calculatedData = {\n groupedCellsData,\n };\n }\n\n _updateAesInData() {\n const calculated = this.calculatedData;\n if (!calculated) {\n return;\n }\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {id, chartSettings, facetSettings, valueColumnColor, valueColumnSize, normalization, aes} = this.settings;\n this.chartRenderer.render(\n this.data,\n id,\n chartSettings,\n facetSettings,\n this.calculatedData.groupedCellsData,\n valueColumnColor,\n valueColumnSize,\n normalization,\n aes,\n this._getTooltip,\n this.onTooltipHintSwitch\n );\n }\n\n private _getTooltip = (cell: Cell): string[] => {\n return this.calculatedData\n ? getCellTooltip(this.data, cell, this.calculatedData.groupedCellsData.meta, this.settings?.chartSettings?.tooltips?.content)\n : ['No data available'];\n };\n}\n"],"names":["ChartBubble","AbstractChart","data","settings","eventHandlers","__publicField","cell","getCellTooltip","_c","_b","_a","BubbleSettingsImpl","ChartRenderer","node","err","previousSettings","previousData","_field","_value","renderToString","prevSettings","el","idx","_d","prevData","prevKeys","keys","o","key","facetBy","xColumn","yColumn","valueColumnSize","valueColumnColor","normalization","NAValueAs","facetKeysLists","column","facetKeysCombinations","getKeysCombinations","facetGroupingValues","groupedCellsData","getGroupedCellsData","id","chartSettings","facetSettings","aes"],"mappings":";;;;;;;;AAWO,MAAMA,UAAoBC,EAAc;AAAA,EAS3C,YAAYC,GAAiBC,GAA0BC,GAAqC;AACxF,UAAMF,GAAMC,CAAQ,GATxBE,EAAA,MAAA,UAAA,GACAA,EAAA,MAAA,eAAA,GAEAA,EAAA,6BAA2C,MAAA;AAAA,IAAA,CAAA,GAC3CA,EAAA,MAAA,kBAEW,IAAA,GA0IHA,EAAA,MAAA,eAAc,CAACC,MAAyB;;AAC5C,aAAO,KAAK,iBACNC,EAAe,KAAK,MAAMD,GAAM,KAAK,eAAe,iBAAiB,OAAME,KAAAC,KAAAC,IAAA,KAAK,aAAL,OAAA,SAAAA,EAAe,kBAAf,OAAA,SAAAD,EAA8B,aAA9B,OAAA,SAAAD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AAK,YAAY,CAAC,GAAGG,CAAmB,CAAC;AAE9C,UAAMC,IAAmBC;AAAAA,MACrB,KAAK;AAAA,MACLZ;AAAAA,MACAC;AAAAA,MACAC;AAAAA,MACAC;AAAAA,MACAJ;AAAAA,MACAS;AAAAA,MACAJ;AAAAA,MACAC;AAAAA,IAAA;AAEJ,SAAK,iBAAiB;AAAA,MAClB,kBAAAM;AAAAA,IAAA;AAAA,EAER;AAAA,EAEA,mBAAmB;AACI,SAAK;AAAA,EAI5B;AAAA,EAEA,eAAe;AACX,QAAI,CAAC,KAAK;AACN;AAEJ,UAAM,EAAC,IAAAE,GAAI,eAAAC,GAAe,eAAAC,GAAe,kBAAAZ,GAAkB,iBAAAD,GAAiB,eAAAE,GAAe,KAAAY,MAAO,KAAK;AACvG,SAAK,cAAc;AAAA,MACf,KAAK;AAAA,MACLH;AAAAA,MACAC;AAAAA,MACAC;AAAAA,MACA,KAAK,eAAe;AAAA,MACpBZ;AAAAA,MACAD;AAAAA,MACAE;AAAAA,MACAY;AAAAA,MACA,KAAK;AAAA,MACL,KAAK;AAAA,IAAA;AAAA,EAEb;AAOJ;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"calculateCaptionTails.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/bubble/utils/calculateCaptionTails.ts"],"sourcesContent":["import type {LabelAngles} from '../components/types';\nimport {MIN_STEP_FOR_VISIBLE_LABELS} from '../constants';\nimport type {GroupedCellsData} from '../getCells';\nimport type {TextMeasurer} from '../../utils/TextMeasurer';\n\nexport function calculateCaptionTails(\n labelAngles: LabelAngles,\n steps: {x: number; y: number;},\n groupedCells: GroupedCellsData,\n textMeasurer: TextMeasurer\n): {xCaptionTail: number; yCaptionTail: number} {\n const {xLabels, yLabels} = groupedCells.meta;\n const xLabelAngle = (labelAngles.xAxisLabels / 180) * Math.PI;\n const yLabelAngle = (labelAngles.yAxisLabels / 180) * Math.PI;\n let xCaptionTail = 0;\n let yCaptionTail = 0;\n // tails from 45deg inclined captions of groups titles/cells labels, that take place on adjacent padding\n const xLabelsInclined = labelAngles.xAxisLabels === 45;\n if (xLabelsInclined) {\n const xKeys = groupedCells.meta.xKeys;\n const step = steps.x;\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n const firstLabel = xLabels[xKeys[0]];\n xCaptionTail = Math.max(\n xCaptionTail,\n (xLabelsInclined && labelsVisible\n ? textMeasurer.getTextWidth(firstLabel) * Math.cos(xLabelAngle)\n : 0) -\n step / 2\n );\n }\n const yLabelsInclined = labelAngles.yAxisLabels === 45;\n if (yLabelsInclined) {\n const yKeys = groupedCells.meta.yKeys;\n if (yKeys.length) {\n const step = steps.y;\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n const lastLabel = yLabels[yKeys[yKeys.length - 1]];\n yCaptionTail = Math.max(\n yCaptionTail,\n (yLabelsInclined && labelsVisible\n ? textMeasurer.getTextWidth(lastLabel) * Math.cos(yLabelAngle)\n : 0) -\n step / 2\n );\n }\n }\n return {xCaptionTail, yCaptionTail};\n}\n"],"names":["calculateCaptionTails","labelAngles","steps","groupedCells","textMeasurer","xLabels","yLabels","xLabelAngle","yLabelAngle","xCaptionTail","yCaptionTail","xLabelsInclined","xKeys","step","labelsVisible","MIN_STEP_FOR_VISIBLE_LABELS","firstLabel","yLabelsInclined","yKeys","lastLabel"],"mappings":";AAKO,SAASA,EACZC,GACAC,GACAC,GACAC,GAC4C;AAC5C,QAAM,EAAC,SAAAC,GAAS,SAAAC,EAAAA,IAAWH,EAAa,MAClCI,IAAeN,EAAY,cAAc,MAAO,KAAK,IACrDO,IAAeP,EAAY,cAAc,MAAO,KAAK;AAC3D,MAAIQ,IAAe,GACfC,IAAe;AAEnB,QAAMC,IAAkBV,EAAY,gBAAgB;AACpD,MAAIU,GAAiB;AACjB,UAAMC,IAAQT,EAAa,KAAK,OAC1BU,IAAOX,EAAM,GACbY,IAAgBD,IAAOE,GACvBC,IAAaX,EAAQO,EAAM,CAAC,CAAC;AACnCH,QAAe,KAAK;AAAA,MAChBA;AAAAA,OACCE,KAAmBG,IACdV,EAAa,aAAaY,CAAU,IAAI,KAAK,IAAIT,CAAW,IAC5D,KACFM,IAAO;AAAA,IAAA;AAAA,EAEnB;AACA,QAAMI,IAAkBhB,EAAY,gBAAgB;AACpD,MAAIgB,GAAiB;AACjB,UAAMC,IAAQf,EAAa,KAAK;AAChC,QAAIe,EAAM,QAAQ;AACd,YAAML,IAAOX,EAAM,GACbY,IAAgBD,IAAOE,GACvBI,IAAYb,EAAQY,EAAMA,EAAM,SAAS,CAAC,CAAC;AACjDR,MAAAA,IAAe,KAAK;AAAA,QAChBA;AAAAA,SACCO,KAAmBH,IACdV,EAAa,aAAae,CAAS,IAAI,KAAK,IAAIX,CAAW,IAC3D,KACNK,IAAO;AAAA,MAAA;AAAA,IAEf;AAAA,EACJ;AACA,SAAO,EAAC,cAAAJ,GAAc,cAAAC,EAAAA;AAC1B;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"calculateCaptionTails.js","sources":["../../../../../../../node_modules/@milaboratories/miplots4/src/bubble/utils/calculateCaptionTails.ts"],"sourcesContent":["import type { TextMeasurer } from '../../utils/TextMeasurer/TextMeasurer';\nimport type { LabelAngles } from '../components/types';\nimport { MIN_STEP_FOR_VISIBLE_LABELS } from '../constants';\nimport type { GroupedCellsData } from '../getGroupedCellsData';\n\nexport function calculateCaptionTails(\n labelAngles: LabelAngles,\n steps: {x: number; y: number;},\n groupedCells: GroupedCellsData,\n textMeasurer: TextMeasurer\n): {xCaptionTail: number; yCaptionTail: number} {\n const {xLabels, yLabels} = groupedCells.meta;\n const xLabelAngle = (labelAngles.xAxisLabels / 180) * Math.PI;\n const yLabelAngle = (labelAngles.yAxisLabels / 180) * Math.PI;\n let xCaptionTail = 0;\n let yCaptionTail = 0;\n // tails from 45deg inclined captions of groups titles/cells labels, that take place on adjacent padding\n const xLabelsInclined = labelAngles.xAxisLabels === 45;\n if (xLabelsInclined) {\n const xKeys = groupedCells.meta.xKeys;\n const step = steps.x;\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n const firstLabel = xLabels[xKeys[0]];\n xCaptionTail = Math.max(\n xCaptionTail,\n (xLabelsInclined && labelsVisible\n ? textMeasurer.getTextWidth(firstLabel) * Math.cos(xLabelAngle)\n : 0) -\n step / 2\n );\n }\n const yLabelsInclined = labelAngles.yAxisLabels === 45;\n if (yLabelsInclined) {\n const yKeys = groupedCells.meta.yKeys;\n if (yKeys.length) {\n const step = steps.y;\n const labelsVisible = step > MIN_STEP_FOR_VISIBLE_LABELS;\n const lastLabel = yLabels[yKeys[yKeys.length - 1]];\n yCaptionTail = Math.max(\n yCaptionTail,\n (yLabelsInclined && labelsVisible\n ? textMeasurer.getTextWidth(lastLabel) * Math.cos(yLabelAngle)\n : 0) -\n step / 2\n );\n }\n }\n return {xCaptionTail, yCaptionTail};\n}\n"],"names":["calculateCaptionTails","labelAngles","steps","groupedCells","textMeasurer","xLabels","yLabels","xLabelAngle","yLabelAngle","xCaptionTail","yCaptionTail","xLabelsInclined","xKeys","step","labelsVisible","MIN_STEP_FOR_VISIBLE_LABELS","firstLabel","yLabelsInclined","yKeys","lastLabel"],"mappings":";AAKO,SAASA,EACZC,GACAC,GACAC,GACAC,GAC4C;AAC5C,QAAM,EAAC,SAAAC,GAAS,SAAAC,EAAAA,IAAWH,EAAa,MAClCI,IAAeN,EAAY,cAAc,MAAO,KAAK,IACrDO,IAAeP,EAAY,cAAc,MAAO,KAAK;AAC3D,MAAIQ,IAAe,GACfC,IAAe;AAEnB,QAAMC,IAAkBV,EAAY,gBAAgB;AACpD,MAAIU,GAAiB;AACjB,UAAMC,IAAQT,EAAa,KAAK,OAC1BU,IAAOX,EAAM,GACbY,IAAgBD,IAAOE,GACvBC,IAAaX,EAAQO,EAAM,CAAC,CAAC;AACnCH,QAAe,KAAK;AAAA,MAChBA;AAAAA,OACCE,KAAmBG,IACdV,EAAa,aAAaY,CAAU,IAAI,KAAK,IAAIT,CAAW,IAC5D,KACFM,IAAO;AAAA,IAAA;AAAA,EAEnB;AACA,QAAMI,IAAkBhB,EAAY,gBAAgB;AACpD,MAAIgB,GAAiB;AACjB,UAAMC,IAAQf,EAAa,KAAK;AAChC,QAAIe,EAAM,QAAQ;AACd,YAAML,IAAOX,EAAM,GACbY,IAAgBD,IAAOE,GACvBI,IAAYb,EAAQY,EAAMA,EAAM,SAAS,CAAC,CAAC;AACjDR,MAAAA,IAAe,KAAK;AAAA,QAChBA;AAAAA,SACCO,KAAmBH,IACdV,EAAa,aAAae,CAAS,IAAI,KAAK,IAAIX,CAAW,IAC3D,KACNK,IAAO;AAAA,MAAA;AAAA,IAEf;AAAA,EACJ;AACA,SAAO,EAAC,cAAAJ,GAAc,cAAAC,EAAAA;AAC1B;","x_google_ignoreList":[0]}
@@ -1,26 +1,8 @@
1
- import { j as i } from "../node_modules/react/jsx-runtime.js";
2
- function t({ message: e }) {
3
- return /* @__PURE__ */ i.jsx(
4
- "div",
5
- {
6
- style: {
7
- width: "500px",
8
- height: "400px",
9
- color: "#ee1616",
10
- display: "flex",
11
- alignItems: "center",
12
- justifyContent: "center",
13
- fontSize: "25px",
14
- fontFamily: "Arial",
15
- border: "1px solid",
16
- padding: "20px",
17
- lineHeight: "25px"
18
- },
19
- children: e
20
- }
21
- );
1
+ import { j as r } from "../node_modules/react/jsx-runtime.js";
2
+ function e({ message: t }) {
3
+ return /* @__PURE__ */ r.jsx("div", { style: { width: "500px", height: "400px" } });
22
4
  }
23
5
  export {
24
- t as Error
6
+ e as Error
25
7
  };
26
8
  //# sourceMappingURL=Error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Error.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/common/Error.tsx"],"sourcesContent":["import React from 'react';\n\nexport function Error({message}: {message: string}) {\n return (\n <div\n style={{\n width: '500px',\n height: '400px',\n color: '#ee1616',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontSize: '25px',\n fontFamily: 'Arial',\n border: '1px solid',\n padding: '20px',\n lineHeight: '25px'\n }}\n >\n {message}\n </div>\n );\n}\n"],"names":["Error","message","jsx"],"mappings":";AAEO,SAASA,EAAM,EAAC,SAAAC,KAA6B;AAChD,SACIC,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACG,OAAO;AAAA,QACH,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,YAAY;AAAA,MAAA;AAAA,MAGf,UAAAD;AAAAA,IAAA;AAAA,EAAA;AAGb;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"Error.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/common/Error.tsx"],"sourcesContent":["import React from 'react';\n\nexport function Error({message}: {message?:string}) {\n return (\n <div style={{width: '500px', height: '400px'}} />\n );\n}\n"],"names":["Error","message","jsx"],"mappings":";AAEO,SAASA,EAAM,EAAC,SAAAC,KAA6B;AAChD,SACIC,gBAAAA,EAAAA,IAAC,OAAA,EAAI,OAAO,EAAC,OAAO,SAAS,QAAQ,QAAA,GAAU;AAEvD;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"Legend.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/common/Legend.tsx"],"sourcesContent":["import {BLACK} from '../constants';\nimport type {LegendItemDiscreteMultiAes, LegendItemGradient} from './types';\nimport type {LegendData} from './types';\nimport {getPointShape} from '../utils/getPointShape';\nimport type {DotAesItem} from './types';\nimport React from 'react';\nimport type { AesItem, LineShape } from '../types';\nimport {color} from 'd3-color';\n\nconst LEGEND_ITEM_SIZE = 12;\nconst TITLE_POSITION = -12;\nconst COLOR_ITEM_WIDTH_C = 14;\n\ninterface LegendProps {\n legendData: LegendData;\n}\n\nfunction getLineShapePath(lineShape:LineShape|null = null):string {\n if (lineShape === 'dashed') {\n return 'M1 11.25H6V12.75H1V11.25ZM9.5 11.25H14.5V12.75H9.5V11.25ZM18 11.25H23V12.75H18V11.25Z';\n }\n if (lineShape === 'dotted') {\n return 'M2.75 11.25H1.25V12.75H2.75V11.25Z M11.25 11.25H12.75V12.75H11.25V11.25Z M22.75 11.25H21.25V12.75H22.75V11.25Z M7.75 11.25H6.25V12.75H7.75V11.25Z M16.25 11.25H17.75V12.75H16.25V11.25Z';\n }\n if (lineShape === 'longdash') {\n return 'M1 11.25H10V12.75H1V11.25ZM14 11.25H23V12.75H14V11.25Z';\n }\n if (lineShape === 'dotdash') {\n return 'M1 11.25H2.5V12.75H1V11.25ZM17 12.75H7V11.25H17V12.75ZM21.5 12.75V11.25H23V12.75H21.5Z';\n }\n if (lineShape === 'twodash') {\n return 'M1 11.25H4V12.75H1V11.25ZM17.0261 12.75H7V11.25H17.0261V12.75ZM20 12.75V11.25H23V12.75H20Z';\n }\n return 'M1 11.25H23V12.75H1V11.25Z';\n}\n\nconst POINT_SIZE = 3;\nconst LINE_WIDTH = 24;\n\nfunction getAesItemStroke(fillColor?:string, lineColor?:string) {\n if (fillColor === 'transparent') {\n return BLACK;\n }\n // black border for white square if fill color is white\n const fill = color(fillColor ?? lineColor ?? '');\n if (fill && fill.formatHex() === '#ffffff') {\n return BLACK;\n }\n return fillColor ?? lineColor;\n}\nfunction AesLegendItem({ aes, label, usedAes }: { aes: AesItem; label: string, usedAes: LegendItemDiscreteMultiAes['usedAes'] }) {\n const needRenderLine = usedAes.lineShape;\n const needRenderDot = usedAes.dotShape;\n const needRenderRect = usedAes.fillColor ||\n (usedAes.lineColor && !usedAes.lineShape) ||\n (usedAes.dotFill && !usedAes.dotShape);\n\n const shape = needRenderDot ? getPointShape(\n aes.dotShape ?? '21',\n POINT_SIZE,\n needRenderRect ? BLACK : aes.dotFill ?? BLACK\n ) : null;\n\n const lineOffset = (needRenderDot && needRenderLine ? 2 * LEGEND_ITEM_SIZE : 0 ) - 6;\n const textOffset = needRenderLine ? lineOffset + LINE_WIDTH + 8 : LEGEND_ITEM_SIZE + 8;\n return (\n <g>\n {needRenderRect && (\n <rect\n width={LEGEND_ITEM_SIZE}\n height={LEGEND_ITEM_SIZE}\n stroke={getAesItemStroke(aes.fillColor, aes.lineColor)}\n fill={aes.fillColor ?? aes.lineColor}\n rx=\"1\"\n ry=\"1\"\n />\n )}\n {needRenderDot && <g transform={`translate(${LEGEND_ITEM_SIZE / 2},${LEGEND_ITEM_SIZE / 2})`}>\n {shape}\n </g>}\n {needRenderLine && (\n <path\n transform={`translate(${lineOffset},-5)`}\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d={getLineShapePath(aes.lineShape)}\n fill={aes.lineColor}\n />\n )}\n <text\n x={textOffset}\n y={LEGEND_ITEM_SIZE / 2}\n dominantBaseline=\"central\"\n fontWeight={500}\n >\n {label}\n </text>\n </g>\n );\n}\n\nfunction DotAesItemElement({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 LegendItemGradient[];\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().reverse().map(value => {\n const domain = item.scale.domain();\n const range = domain[domain.length - 1] - domain[0];\n const percent = range > 0 ? 100 - (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 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 y = item.tickPositionScale(value) ?? 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 === 'discreteColor') {\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 * (LEGEND_ITEM_SIZE + 4)})`}>\n <rect\n x=\"0\"\n y=\"0\"\n width={LEGEND_ITEM_SIZE}\n height={LEGEND_ITEM_SIZE}\n fill={item.scale(value)}\n rx=\"1\"\n ry=\"1\"\n stroke={BLACK}\n />\n <text x={LEGEND_ITEM_SIZE + 8} y={10}>{item.labels[value] ?? 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 === 'discreteMulti') {\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`} fontSize=\"14px\" fontWeight={500}>\n <text fontWeight={600} 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 <AesLegendItem\n aes={item.scale(value)}\n label={item.labels[value]}\n usedAes={item.usedAes}\n />\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 === 'dots') {\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 <DotAesItemElement 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":["LEGEND_ITEM_SIZE","TITLE_POSITION","COLOR_ITEM_WIDTH_C","getLineShapePath","lineShape","POINT_SIZE","LINE_WIDTH","getAesItemStroke","fillColor","lineColor","BLACK","fill","color","AesLegendItem","aes","label","usedAes","needRenderLine","needRenderDot","needRenderRect","shape","getPointShape","lineOffset","textOffset","n","jsx","DotAesItemElement","Legend","legendData","continuousItems","item","t","value","domain","range","percent","jsxs","y","idx","size","r"],"mappings":";;;;AASA,MAAMA,IAAmB,IACnBC,IAAiB,KACjBC,IAAqB;AAM3B,SAASC,EAAiBC,IAA2B,MAAa;AAC9D,SAAIA,MAAc,WACP,0FAEPA,MAAc,WACP,4LAEPA,MAAc,aACP,2DAEPA,MAAc,YACP,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,WAAW,gBAAgBc,IAAMC,CAAI,KAChD,UAAA;AAAA,cAAAd,gBAAAA,EAAAA,IAAC,UAAA,EAAO,GAAAe,GAAM,IAAID,IAAO,GAAG,IAAIA,IAAO,GAAG,MAAM7B,GAAM;AAAA,cACtDe,gBAAAA,EAAAA,IAAC,QAAA,EAAK,GAAGc,IAAO,GAAG,GAAGA,IAAO,GAAG,mBAAkB,WAAW,UAAAT,EAAK,OAAOE,CAAK,GAAE;AAAA,YAAA,EAAA,GAF5EA,CAGR;AAAA,UAER,CAAC;AAAA,UACA;AAAA,QAAA,EAAkF,GAb/EF,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/common/Legend.tsx"],"sourcesContent":["import { color } from 'd3-color';\nimport { BLACK } from '../constants';\nimport type { AesItem, LineShape } from '../types';\nimport { getPointShape } from '../utils/getPointShape';\nimport type { DotAesItem, LegendData, LegendItemDiscreteMultiAes, LegendItemGradient } from './types';\n\nconst LEGEND_ITEM_SIZE = 12;\nconst TITLE_POSITION = -12;\nconst COLOR_ITEM_WIDTH_C = 14;\n\ninterface LegendProps {\n legendData: LegendData;\n}\n\nfunction getLineShapePath(lineShape:LineShape|null = null):string {\n if (lineShape === 'dashed') {\n return 'M1 11.25H6V12.75H1V11.25ZM9.5 11.25H14.5V12.75H9.5V11.25ZM18 11.25H23V12.75H18V11.25Z';\n }\n if (lineShape === 'dotted') {\n return 'M2.75 11.25H1.25V12.75H2.75V11.25Z M11.25 11.25H12.75V12.75H11.25V11.25Z M22.75 11.25H21.25V12.75H22.75V11.25Z M7.75 11.25H6.25V12.75H7.75V11.25Z M16.25 11.25H17.75V12.75H16.25V11.25Z';\n }\n if (lineShape === 'longdash') {\n return 'M1 11.25H10V12.75H1V11.25ZM14 11.25H23V12.75H14V11.25Z';\n }\n if (lineShape === 'dotdash') {\n return 'M1 11.25H2.5V12.75H1V11.25ZM17 12.75H7V11.25H17V12.75ZM21.5 12.75V11.25H23V12.75H21.5Z';\n }\n if (lineShape === 'twodash') {\n return 'M1 11.25H4V12.75H1V11.25ZM17.0261 12.75H7V11.25H17.0261V12.75ZM20 12.75V11.25H23V12.75H20Z';\n }\n return 'M1 11.25H23V12.75H1V11.25Z';\n}\n\nconst POINT_SIZE = 3;\nconst LINE_WIDTH = 24;\n\nfunction getAesItemStroke(fillColor?:string, lineColor?:string) {\n if (fillColor === 'transparent') {\n return BLACK;\n }\n // black border for white square if fill color is white\n const fill = color(fillColor ?? lineColor ?? '');\n if (fill && fill.formatHex() === '#ffffff') {\n return BLACK;\n }\n return fillColor ?? lineColor;\n}\nfunction AesLegendItem({ aes, label, usedAes }: { aes: AesItem; label: string, usedAes: LegendItemDiscreteMultiAes['usedAes'] }) {\n const needRenderLine = usedAes.lineShape;\n const needRenderDot = usedAes.dotShape;\n const needRenderRect = usedAes.fillColor ||\n (usedAes.lineColor && !usedAes.lineShape) ||\n (usedAes.dotFill && !usedAes.dotShape);\n\n const shape = needRenderDot ? getPointShape(\n aes.dotShape ?? '21',\n POINT_SIZE,\n needRenderRect ? BLACK : aes.dotFill ?? BLACK\n ) : null;\n\n const lineOffset = (needRenderDot && needRenderLine ? 2 * LEGEND_ITEM_SIZE : 0 ) - 6;\n const textOffset = needRenderLine ? lineOffset + LINE_WIDTH + 8 : LEGEND_ITEM_SIZE + 8;\n return (\n <g>\n {needRenderRect && (\n <rect\n width={LEGEND_ITEM_SIZE}\n height={LEGEND_ITEM_SIZE}\n stroke={getAesItemStroke(aes.fillColor, aes.lineColor)}\n fill={aes.fillColor ?? aes.lineColor}\n rx=\"1\"\n ry=\"1\"\n />\n )}\n {needRenderDot && <g transform={`translate(${LEGEND_ITEM_SIZE / 2},${LEGEND_ITEM_SIZE / 2})`}>\n {shape}\n </g>}\n {needRenderLine && (\n <path\n transform={`translate(${lineOffset},-5)`}\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d={getLineShapePath(aes.lineShape)}\n fill={aes.lineColor}\n />\n )}\n <text\n x={textOffset}\n y={LEGEND_ITEM_SIZE / 2}\n dominantBaseline=\"central\"\n fontWeight={500}\n >\n {label}\n </text>\n </g>\n );\n}\n\nfunction DotAesItemElement({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 LegendItemGradient[];\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().reverse().map(value => {\n const domain = item.scale.domain();\n const range = domain[domain.length - 1] - domain[0];\n const percent = range > 0 ? 100 - (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 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 y = item.tickPositionScale(value) ?? 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 === 'discreteColor') {\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 * (LEGEND_ITEM_SIZE + 4)})`}>\n <rect\n x=\"0\"\n y=\"0\"\n width={LEGEND_ITEM_SIZE}\n height={LEGEND_ITEM_SIZE}\n fill={item.scale(value)}\n rx=\"1\"\n ry=\"1\"\n stroke={BLACK}\n />\n <text x={LEGEND_ITEM_SIZE + 8} y={10}>{item.labels[value] ?? 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 === 'discreteMulti') {\n return (\n <g key={item.id} transform={`translate(${item.left},${item.top})`} fontSize=\"14px\" fontWeight={500}>\n <text fontWeight={600} 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 <AesLegendItem\n aes={item.scale(value)}\n label={item.labels[value]}\n usedAes={item.usedAes}\n />\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 === 'dots') {\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 <DotAesItemElement 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":["LEGEND_ITEM_SIZE","TITLE_POSITION","COLOR_ITEM_WIDTH_C","getLineShapePath","lineShape","POINT_SIZE","LINE_WIDTH","getAesItemStroke","fillColor","lineColor","BLACK","fill","color","AesLegendItem","aes","label","usedAes","needRenderLine","needRenderDot","needRenderRect","shape","getPointShape","lineOffset","textOffset","n","jsx","DotAesItemElement","Legend","legendData","continuousItems","item","t","value","domain","range","percent","jsxs","y","idx","size","r"],"mappings":";;;;AAMA,MAAMA,IAAmB,IACnBC,IAAiB,KACjBC,IAAqB;AAM3B,SAASC,EAAiBC,IAA2B,MAAa;AAC9D,SAAIA,MAAc,WACP,0FAEPA,MAAc,WACP,4LAEPA,MAAc,aACP,2DAEPA,MAAc,YACP,2FAEPA,MAAc,YACP,+FAEJ;AACX;AAEA,MAAMC,IAAa,GACbC,IAAa;AAEnB,SAASC,EAAiBC,GAAmBC,GAAmB;AAC5D,MAAID,MAAc;AACd,WAAOE;AAGX,QAAMC,IAAOC,EAAMJ,KAAaC,KAAa,EAAE;AAC/C,SAAIE,KAAQA,EAAK,UAAA,MAAgB,YACtBD,IAEJF,KAAaC;AACxB;AACA,SAASI,EAAc,EAAE,KAAAC,GAAK,OAAAC,GAAO,SAAAC,KAA4F;AAC7H,QAAMC,IAAiBD,EAAQ,WACzBE,IAAgBF,EAAQ,UACxBG,IAAiBH,EAAQ,aAC1BA,EAAQ,aAAa,CAACA,EAAQ,aA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,GACL;AAER;","x_google_ignoreList":[0]}
@@ -3,7 +3,7 @@ import { r as $ } from "../_virtual/index.js";
3
3
  import { r as B } from "../node_modules/react-dom/index.js";
4
4
  import { BLACK as F } from "../constants.js";
5
5
  import { exhaustive as P } from "../utils/index.js";
6
- import { TextMeasurer as A } from "../utils/TextMeasurer.js";
6
+ import { TextMeasurer as A } from "../utils/TextMeasurer/TextMeasurer.js";
7
7
  const V = 8, Q = 12, w = 20, i = 6, s = 5, O = 8, C = 16, b = 8, q = C * 2 + b + 16, R = "#CFD1DB", S = "#fff", z = "miplots-tooltip";
8
8
  function K(r) {
9
9
  return r.length * w + 2 * V;
@@ -113,8 +113,8 @@ function ae(r = () => {
113
113
  u(null), n.current = !1, c.current && (clearTimeout(c.current), c.current = null), r(!1);
114
114
  }, f = () => {
115
115
  o.current = !1, t(!1), g();
116
- }, h = $.useCallback((p, m) => {
117
- o.current || (u(p), n.current = !0, x.current = m ?? "null", c.current && clearTimeout(c.current), c.current = setTimeout(() => {
116
+ }, m = $.useCallback((p, h) => {
117
+ o.current || (u(p), n.current = !0, x.current = h ?? "null", c.current && clearTimeout(c.current), c.current = setTimeout(() => {
118
118
  r(!0);
119
119
  }, 2e3));
120
120
  }, []), d = $.useCallback(() => {
@@ -124,21 +124,21 @@ function ae(r = () => {
124
124
  function p(L) {
125
125
  n.current && L.key === "Enter" && (o.current = !0, t(!0), c.current && (clearTimeout(c.current), c.current = null), r(!1));
126
126
  }
127
- function m(L) {
127
+ function h(L) {
128
128
  if (!o.current)
129
129
  return;
130
130
  const j = document.querySelector(`.${z}`), H = L.target;
131
131
  j && H && j.contains(H) || f();
132
132
  }
133
- return document.addEventListener("keydown", p), document.addEventListener("click", m), () => {
134
- document.removeEventListener("keydown", p), document.removeEventListener("click", m);
133
+ return document.addEventListener("keydown", p), document.addEventListener("click", h), () => {
134
+ document.removeEventListener("keydown", p), document.removeEventListener("click", h);
135
135
  };
136
136
  }, []), {
137
137
  active: l !== null,
138
138
  currentFacet: x.current,
139
139
  fixed: e,
140
140
  selectedData: l,
141
- onMouseEnter: h,
141
+ onMouseEnter: m,
142
142
  onMouseLeave: d,
143
143
  onClose: v
144
144
  };
@@ -156,7 +156,7 @@ function ce({
156
156
  offset: c = O,
157
157
  horizontal: g = !0
158
158
  }) {
159
- const f = U(r, t), h = K(r), d = X(f, h, l, u, c, o, g), v = te(d, o, l, f), p = re(d, o, u, h), m = `translate(${f - C - Q},${V})`, L = `translate(${f - C * 2 - b - Q},${V})`, [j, H] = $.useState(!1), [D, y] = $.useState(!1), [Z, k] = $.useState(!1);
159
+ const f = U(r, t), m = K(r), d = X(f, m, l, u, c, o, g), v = te(d, o, l, f), p = re(d, o, u, m), h = `translate(${f - C - Q},${V})`, L = `translate(${f - C * 2 - b - Q},${V})`, [j, H] = $.useState(!1), [D, y] = $.useState(!1), [Z, k] = $.useState(!1);
160
160
  function _() {
161
161
  var M;
162
162
  (M = window == null ? void 0 : window.navigator) == null || M.clipboard.writeText(r.join(`
@@ -178,7 +178,7 @@ function ce({
178
178
  "path",
179
179
  {
180
180
  transform: ee(d, c),
181
- d: N(f, h, d, v, p),
181
+ d: N(f, m, d, v, p),
182
182
  fill: F
183
183
  }
184
184
  ),
@@ -188,7 +188,7 @@ function ce({
188
188
  fontSize: "14px",
189
189
  fontFamily: "Manrope",
190
190
  fill: "white",
191
- transform: Y(d, f, h, c, v, p),
191
+ transform: Y(d, f, m, c, v, p),
192
192
  children: [
193
193
  r.map((M, E) => /* @__PURE__ */ a.jsx(
194
194
  "text",
@@ -200,7 +200,7 @@ function ce({
200
200
  },
201
201
  E
202
202
  )),
203
- t && /* @__PURE__ */ a.jsxs("g", { transform: m, children: [
203
+ t && /* @__PURE__ */ a.jsxs("g", { transform: h, children: [
204
204
  /* @__PURE__ */ a.jsx(
205
205
  "path",
206
206
  {
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/common/Tooltip.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { BLACK } from '../constants';\nimport { exhaustive } from '../utils';\nimport { TextMeasurer } from '../utils/TextMeasurer';\n\ntype Direction = 'left'|'right'|'top'|'bottom';\ntype SideDistances = {\n left: number;\n right: number;\n top: number;\n bottom: number;\n};\n\nconst OFFSET_V = 8;\nconst OFFSET_H = 12;\nconst LINE_HEIGHT = 20;\nconst R = 6;\nconst TAIL_OFFSET = 5;\nconst POSITION_OFFSET = 8;\n\nconst ICON_W = 16;\nconst ICON_OFFSET = 8;\nconst ICONS_WIDTH = ICON_W * 2 + ICON_OFFSET + 16;\n\nconst GREY = '#CFD1DB';\nconst WHITE = '#fff';\n\nconst TOOLTIP_CLASS = 'miplots-tooltip';\n\nexport function getTooltipHeight(content: string[]) {\n return content.length * LINE_HEIGHT + 2 * OFFSET_V;\n}\nexport function getTooltipWidth(content: string[], hasIcons = false) {\n const textMeasurer = new TextMeasurer('600 14px Arial');\n return Math.max(...content.map((str, idx) => textMeasurer.getTextWidth(str) + (idx === 0 && hasIcons ? ICONS_WIDTH : 0))) + 2 * OFFSET_H;\n}\n\nfunction rightTooltipPath(width: number, height: number, shiftY: number) {\n const left = -TAIL_OFFSET - width;\n const right = -TAIL_OFFSET;\n const top = -height / 2 + shiftY;\n const bottom = height / 2 + shiftY;\n return `M 0,0 \n L ${right},${-TAIL_OFFSET} \n V ${top + R}\n Q ${right},${top} ${right - R},${top} \n H ${left + R} \n Q ${left},${top} ${left},${top + R}\n V ${bottom - R}\n Q ${left},${bottom} ${left + R},${bottom}\n H ${right - R}\n Q ${right},${bottom} ${right},${bottom - R}\n V ${TAIL_OFFSET} \n L 0,0 z`;\n}\nfunction leftTooltipPath(width: number, height: number, shiftY: number) {\n const left = TAIL_OFFSET;\n const right = TAIL_OFFSET + width;\n const top = -height / 2 + shiftY;\n const bottom = height / 2 + shiftY;\n return `M 0,0 \n L ${left},${-TAIL_OFFSET} \n V ${top + R}\n Q ${left},${top} ${left + R},${top} \n H ${right - R} \n Q ${right},${top} ${right},${top + R}\n V ${bottom - R}\n Q ${right},${bottom} ${right - R},${bottom}\n H ${left + R}\n Q ${left},${bottom} ${left},${bottom - R}\n V ${TAIL_OFFSET} \n L 0,0 z`;\n}\n\nfunction topTooltipPath(width: number, height: number, shiftX: number) {\n const left = -width / 2 + shiftX;\n const right = width / 2 + shiftX;\n const top = -TAIL_OFFSET - height;\n const bottom = -TAIL_OFFSET;\n return `M 0,0 \n L ${-TAIL_OFFSET},${bottom} \n H ${left + R}\n Q ${left},${bottom} ${left},${bottom - R} \n V ${top + R} \n Q ${left},${top} ${left + R},${top}\n H ${right - R}\n Q ${right},${top} ${right},${top + R}\n V ${bottom - R}\n Q ${right},${bottom} ${right - R},${bottom}\n H ${TAIL_OFFSET} \n L 0,0 z`;\n}\n\nfunction bottomTooltipPath(width: number, height: number, shiftX: number) {\n const left = -width / 2 + shiftX;\n const right = width / 2 + shiftX;\n const bottom = TAIL_OFFSET + height;\n const top = TAIL_OFFSET;\n return `M 0,0 \n L ${-TAIL_OFFSET},${top} \n H ${left + R}\n Q ${left},${top} ${left},${top + R} \n V ${bottom - R} \n Q ${left},${bottom} ${left + R},${bottom}\n H ${right - R}\n Q ${right},${bottom} ${right},${bottom - R}\n V ${top + R}\n Q ${right},${top} ${right - R},${top}\n H ${TAIL_OFFSET} \n L 0,0 z`;\n}\n\nfunction getPath(width: number, height: number, direction: Direction, shiftX: number, shiftY: number):string {\n switch (direction) {\n case 'left': return rightTooltipPath(width, height, shiftY);\n case 'right': return leftTooltipPath(width, height, shiftY);\n case 'top': return topTooltipPath(width, height, shiftX);\n case 'bottom': return bottomTooltipPath(width, height, shiftX);\n default: exhaustive(direction, 'Unknown tooltip direction');\n }\n}\n\nfunction getDirection(width: number, height: number, x: number, y: number, offset:number, sideDistances:SideDistances , horizontal: boolean):Direction {\n if (horizontal) {\n return sideDistances.right - x - offset - TAIL_OFFSET > width ? 'right' : 'left';\n }\n return sideDistances.top + y - offset - TAIL_OFFSET > height ? 'top' : 'bottom';\n}\n\nfunction getContentTransform (direction:Direction, width: number, height: number, offset:number, shiftX: number, shiftY: number) {\n if (direction === 'left' || direction === 'right') {\n return `translate(${(direction === 'left' ? -(offset + TAIL_OFFSET + width) : (offset + TAIL_OFFSET))},${-height / 2 + shiftY})`;\n }\n return `translate(${-width / 2 + shiftX},${direction === 'top' ? -(height + offset + TAIL_OFFSET) : offset + TAIL_OFFSET})`;\n\n}\nfunction getPathTransform (direction:Direction, offset:number) {\n if (direction === 'left' || direction === 'right') {\n return `translate(${direction === 'left' ? -offset : offset},0)`;\n }\n return `translate(0,${direction === 'top' ? -offset : offset})`;\n}\n\nfunction getShiftX (direction:Direction, sideDistances: SideDistances, x: number, width: number) {\n if (direction === 'left' || direction === 'right') {\n return 0;\n }\n const rightFreeSpace = sideDistances.right - x;\n const leftFreeSpace = sideDistances.left + x;\n if (rightFreeSpace < width / 2) {\n return rightFreeSpace - width / 2;\n }\n if (leftFreeSpace < width / 2) {\n return width / 2 - leftFreeSpace;\n }\n return 0;\n}\nfunction getShiftY (direction:Direction, sideDistances: SideDistances, y: number, height: number) {\n if (direction === 'top' || direction === 'bottom') {\n return 0;\n }\n const topFreeSpace = sideDistances.top + y;\n const bottomFreeSpace = sideDistances.bottom - y;\n if (topFreeSpace < height / 2) {\n return height / 2 - topFreeSpace;\n }\n if (bottomFreeSpace < height / 2) {\n return bottomFreeSpace - height / 2;\n }\n return 0;\n}\n\nexport type TooltipsData<T> = {\n active: boolean,\n fixed: boolean,\n selectedData: T | null,\n currentFacet: string,\n onMouseEnter: (elementData:T, facetKey?:string) => void,\n onMouseLeave: () => void,\n onClose: () => void\n}\n\nexport function useTooltip<T = unknown>(onTooltipHintSwitchOuterCallback: (v:boolean) => void = () => undefined): TooltipsData<T> {\n const [selectedData, setSelectedData] = useState<T | null>(null);\n const [fixed, setFixed] = useState(false);\n const openRef = useRef(false);\n const fixedRef = useRef(false);\n const currentFacet = useRef('null');\n const hintTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const close = () => {\n setSelectedData(null);\n openRef.current = false;\n if (hintTimer.current) {\n clearTimeout(hintTimer.current);\n hintTimer.current = null;\n }\n onTooltipHintSwitchOuterCallback(false);\n };\n const closeFixed = () => {\n fixedRef.current = false;\n setFixed(false);\n close();\n };\n const onMouseEnter = useCallback((newElementData:T, facetKey?: string) => {\n if (fixedRef.current) {\n return;\n }\n setSelectedData(newElementData);\n openRef.current = true;\n currentFacet.current = facetKey ?? 'null';\n if (hintTimer.current) {\n clearTimeout(hintTimer.current);\n }\n hintTimer.current = setTimeout(() => {\n onTooltipHintSwitchOuterCallback(true);\n }, 2000);\n }, []);\n const onMouseLeave = useCallback(() => {\n if (fixedRef.current) {\n return;\n }\n close();\n }, []);\n\n const onClose = useCallback(closeFixed, []);\n\n useEffect(() => {\n function handleEnter(e:KeyboardEvent) {\n if (openRef.current && e.key === 'Enter') {\n fixedRef.current = true;\n setFixed(true);\n if (hintTimer.current) {\n clearTimeout(hintTimer.current);\n hintTimer.current = null;\n }\n onTooltipHintSwitchOuterCallback(false);\n }\n }\n function handleClickOutside(e:MouseEvent) {\n if (!fixedRef.current) {\n return;\n }\n //const tooltipNodes = Array.from(document.getElementsByClassName(TOOLTIP_CLASS));\n const tooltipNode = document.querySelector(`.${TOOLTIP_CLASS}`);\n const clickedNode = e.target;\n if (tooltipNode && clickedNode && tooltipNode.contains(clickedNode as Node)) {\n return;\n }\n closeFixed();\n }\n document.addEventListener('keydown', handleEnter);\n document.addEventListener('click', handleClickOutside);\n return () => {\n document.removeEventListener('keydown', handleEnter);\n document.removeEventListener('click', handleClickOutside);\n };\n }, []);\n\n return {\n active: selectedData !== null,\n currentFacet: currentFacet.current,\n fixed,\n selectedData,\n onMouseEnter,\n onMouseLeave,\n onClose\n };\n}\n\nexport function Tooltip({\n content,\n x,\n y,\n active,\n fixed,\n container,\n sideDistances,\n onClose = () => undefined,\n offset = POSITION_OFFSET,\n horizontal = true,\n}: {\n content: string[];\n x: number;\n y: number;\n active: boolean;\n fixed: boolean;\n sideDistances: SideDistances;\n onClose?: () => void;\n offset?: number;\n horizontal?: boolean;\n container?: Element | null;\n}) {\n const width = getTooltipWidth(content, fixed);\n const height = getTooltipHeight(content);\n const direction = getDirection(width, height, x, y, offset, sideDistances, horizontal);\n // shifts for tooltip positioning not in center if it is close to chart edges\n const shiftX = getShiftX(direction, sideDistances, x, width);\n const shiftY = getShiftY(direction, sideDistances, y, height);\n\n const firstIconPosition = `translate(${width - ICON_W - OFFSET_H},${OFFSET_V})`;\n const secondIconPosition = `translate(${width - ICON_W * 2 - ICON_OFFSET - OFFSET_H},${OFFSET_V})`;\n\n const [copied, setCopied] = useState(false);\n const [hoveredClose, setHoveredClose] = useState(false);\n const [hoveredCopy, setHoveredCopy] = useState(false);\n\n function copyToClipboard () {\n window?.navigator?.clipboard.writeText(content.join('\\n'));\n setCopied(true);\n }\n \n if (!active || (!container && container !== null)) {\n return null;\n }\n\n const tooltip = (\n <g\n className={TOOLTIP_CLASS}\n transform={`translate(${sideDistances.left + x},${sideDistances.top + y})`}\n opacity={active ? 1 : 0}\n stroke=\"none\"\n fill=\"none\"\n style={{pointerEvents: fixed ? 'all' : 'none'}}\n >\n <path\n transform={getPathTransform(direction, offset)}\n d={getPath(width, height, direction, shiftX, shiftY)}\n fill={BLACK}\n />\n <g\n fontSize=\"14px\"\n fontFamily=\"Manrope\"\n fill=\"white\"\n transform={getContentTransform(direction, width, height, offset, shiftX, shiftY)}\n >\n {content.map((str, idx) => (\n <text\n key={idx}\n x={OFFSET_H}\n y={OFFSET_V + LINE_HEIGHT * idx + LINE_HEIGHT / 2}\n dominantBaseline=\"central\"\n >\n {str}\n </text>\n ))}\n {fixed && (\n <g transform={firstIconPosition}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M4.0006 2.93945L8.0006 6.93945L12.0006 2.93945L13.0613 4.00011L9.06126 8.00011L13.0613 12.0001L12.0006 13.0608L8.0006 9.06077L4.0006 13.0608L2.93994 12.0001L6.93994 8.00011L2.93994 4.00011L4.0006 2.93945Z\"\n fill={hoveredClose ? GREY : WHITE}\n />\n <rect\n x=\"-8\"\n y=\"-8\"\n width=\"24\"\n height=\"24\"\n fill=\"transparent\"\n onClick={onClose}\n onMouseOver={() => setHoveredClose(true)}\n onMouseLeave={() => setHoveredClose(false)}\n style={{cursor: 'pointer'}}\n />\n </g>\n )}\n {fixed && (\n <g transform={secondIconPosition}>\n {copied\n ? (\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M14.0601 4.43439L6.33313 12.5477L1.93945 7.93439L3.02566 6.8999L6.33313 10.3727L12.9739 3.3999L14.0601 4.43439Z\" fill=\"#07AD3E\"/>\n )\n : (\n <g>\n <g clipPath=\"url(#clip0_16418_6183)\">\n <path d=\"M16.0005 13H14.5005V1.5H3.00049V0H14.5005C15.3289 2.86102e-06 16.0005 0.671575 16.0005 1.5V13ZM1.34717 15.9922C0.641178 15.9205 0.0799799 15.3593 0.00830078 14.6533L0.000488281 14.5V4.5C0.000488281 3.72334 0.590765 3.08461 1.34717 3.00781L1.50049 3H11.5005L11.6538 3.00781C12.4102 3.08461 13.0005 3.72334 13.0005 4.5V14.5L12.9927 14.6533C12.921 15.3593 12.3598 15.9205 11.6538 15.9922L11.5005 16H1.50049L1.34717 15.9922ZM11.5005 4.5H1.50049V14.5H11.5005V4.5Z\"\n fill={hoveredCopy ? GREY : WHITE}\n />\n </g>\n <defs>\n <clipPath id=\"clip0_16418_6183\">\n <rect width=\"16\" height=\"16\" transform=\"translate(0.000488281)\" fill=\"white\" />\n </clipPath>\n </defs>\n </g>\n )}\n <rect\n x=\"-8\"\n y=\"-8\"\n width=\"24\"\n height=\"24\"\n fill=\"transparent\"\n onClick={copyToClipboard}\n onMouseOver={() => setHoveredCopy(true)}\n onMouseLeave={() => setHoveredCopy(false)}\n style={{cursor: 'pointer'}}\n />\n </g>\n )}\n </g>\n </g>\n );\n\n return container === null ? tooltip : createPortal(\n tooltip,\n container\n );\n}\n"],"names":["OFFSET_V","OFFSET_H","LINE_HEIGHT","R","TAIL_OFFSET","POSITION_OFFSET","ICON_W","ICON_OFFSET","ICONS_WIDTH","GREY","WHITE","TOOLTIP_CLASS","getTooltipHeight","content","getTooltipWidth","hasIcons","textMeasurer","TextMeasurer","str","idx","rightTooltipPath","width","height","shiftY","left","right","top","bottom","leftTooltipPath","topTooltipPath","shiftX","bottomTooltipPath","getPath","direction","exhaustive","getDirection","x","y","offset","sideDistances","horizontal","getContentTransform","getPathTransform","getShiftX","rightFreeSpace","leftFreeSpace","getShiftY","topFreeSpace","bottomFreeSpace","useTooltip","onTooltipHintSwitchOuterCallback","selectedData","setSelectedData","useState","fixed","setFixed","openRef","useRef","fixedRef","currentFacet","hintTimer","close","closeFixed","onMouseEnter","useCallback","newElementData","facetKey","onMouseLeave","onClose","useEffect","handleEnter","e","handleClickOutside","tooltipNode","clickedNode","Tooltip","active","container","firstIconPosition","secondIconPosition","copied","setCopied","hoveredClose","setHoveredClose","hoveredCopy","setHoveredCopy","copyToClipboard","_a","tooltip","jsxs","jsx","BLACK","a","createPortal"],"mappings":";;;;;;AAcA,MAAMA,IAAW,GACXC,IAAW,IACXC,IAAc,IACdC,IAAI,GACJC,IAAc,GACdC,IAAkB,GAElBC,IAAS,IACTC,IAAc,GACdC,IAAcF,IAAS,IAAIC,IAAc,IAEzCE,IAAO,WACPC,IAAQ,QAERC,IAAgB;AAEf,SAASC,EAAiBC,GAAmB;AAChD,SAAOA,EAAQ,SAASX,IAAc,IAAIF;AAC9C;AACO,SAASc,EAAgBD,GAAmBE,IAAW,IAAO;AACjE,QAAMC,IAAe,IAAIC,EAAa,gBAAgB;AACtD,SAAO,KAAK,IAAI,GAAGJ,EAAQ,IAAI,CAACK,GAAKC,MAAQH,EAAa,aAAaE,CAAG,KAAKC,MAAQ,KAAKJ,IAAWP,IAAc,EAAE,CAAC,IAAI,IAAIP;AACpI;AAEA,SAASmB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AA,KAAC,KAAA,EACD,UAAA;AAAA,kBAAAC,gBAAAA,EAAAA,IAAC,KAAA,EAAE,UAAS,0BACR,UAAAA,gBAAAA,EAAAA;AAAAA,oBAAC;AAAA,oBAAA;AAAA,sBAAK,GAAE;AAAA,sBACF,MAAMN,IAAc3E,IAAOC;AAAAA,oBAAA;AAAA,kBAAA,GAErC;AAAA,kBAAAkF,gBAAAA,EAAA,IACK,QAAA,EACD,UAAAF,gBAAAA,EAAAA,IAAC,YAAA,EAAS,IAAG,oBACb,UAAAA,gBAAAA,MAAC,QAAA,EAAK,OAAM,MAAK,QAAO,MAAK,WAAU,0BAAyB,MAAK,QAAA,CAAQ,EAAA,CAC7E,EAAA,CACA;AAAA,gBAAA,GACJ;AAAA,gBAERA,gBAAAA,EAAAA;AAAAA,kBAAC;AAAA,kBAAA;AAAA,oBACG,GAAE;AAAA,oBACF,GAAE;AAAA,oBACF,OAAM;AAAA,oBACN,QAAO;AAAA,oBACP,MAAK;AAAA,oBACL,SAASJ;AAAAA,oBACT,aAAa,MAAMD,EAAe,EAAI;AAAA,oBACtC,cAAc,MAAMA,EAAe,EAAK;AAAA,oBACxC,OAAO,EAAC,QAAQ,UAAA;AAAA,kBAAA;AAAA,gBAAS;AAAA,cAAA,GAEjC;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAER;AAAA,EAAA;AAIR,SAAOR,MAAc,OAAOW,IAAUK,EAAAA;AAAAA,IAClCL;AAAAA,IACAX;AAAAA,EAAA;AAER;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/common/Tooltip.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { BLACK } from '../constants';\nimport { exhaustive } from '../utils';\nimport { TextMeasurer } from '../utils/TextMeasurer/TextMeasurer';\n\ntype Direction = 'left'|'right'|'top'|'bottom';\ntype SideDistances = {\n left: number;\n right: number;\n top: number;\n bottom: number;\n};\n\nconst OFFSET_V = 8;\nconst OFFSET_H = 12;\nconst LINE_HEIGHT = 20;\nconst R = 6;\nconst TAIL_OFFSET = 5;\nconst POSITION_OFFSET = 8;\n\nconst ICON_W = 16;\nconst ICON_OFFSET = 8;\nconst ICONS_WIDTH = ICON_W * 2 + ICON_OFFSET + 16;\n\nconst GREY = '#CFD1DB';\nconst WHITE = '#fff';\n\nconst TOOLTIP_CLASS = 'miplots-tooltip';\n\nexport function getTooltipHeight(content: string[]) {\n return content.length * LINE_HEIGHT + 2 * OFFSET_V;\n}\nexport function getTooltipWidth(content: string[], hasIcons = false) {\n const textMeasurer = new TextMeasurer('600 14px Arial');\n return Math.max(...content.map((str, idx) => textMeasurer.getTextWidth(str) + (idx === 0 && hasIcons ? ICONS_WIDTH : 0))) + 2 * OFFSET_H;\n}\n\nfunction rightTooltipPath(width: number, height: number, shiftY: number) {\n const left = -TAIL_OFFSET - width;\n const right = -TAIL_OFFSET;\n const top = -height / 2 + shiftY;\n const bottom = height / 2 + shiftY;\n return `M 0,0 \n L ${right},${-TAIL_OFFSET} \n V ${top + R}\n Q ${right},${top} ${right - R},${top} \n H ${left + R} \n Q ${left},${top} ${left},${top + R}\n V ${bottom - R}\n Q ${left},${bottom} ${left + R},${bottom}\n H ${right - R}\n Q ${right},${bottom} ${right},${bottom - R}\n V ${TAIL_OFFSET} \n L 0,0 z`;\n}\nfunction leftTooltipPath(width: number, height: number, shiftY: number) {\n const left = TAIL_OFFSET;\n const right = TAIL_OFFSET + width;\n const top = -height / 2 + shiftY;\n const bottom = height / 2 + shiftY;\n return `M 0,0 \n L ${left},${-TAIL_OFFSET} \n V ${top + R}\n Q ${left},${top} ${left + R},${top} \n H ${right - R} \n Q ${right},${top} ${right},${top + R}\n V ${bottom - R}\n Q ${right},${bottom} ${right - R},${bottom}\n H ${left + R}\n Q ${left},${bottom} ${left},${bottom - R}\n V ${TAIL_OFFSET} \n L 0,0 z`;\n}\n\nfunction topTooltipPath(width: number, height: number, shiftX: number) {\n const left = -width / 2 + shiftX;\n const right = width / 2 + shiftX;\n const top = -TAIL_OFFSET - height;\n const bottom = -TAIL_OFFSET;\n return `M 0,0 \n L ${-TAIL_OFFSET},${bottom} \n H ${left + R}\n Q ${left},${bottom} ${left},${bottom - R} \n V ${top + R} \n Q ${left},${top} ${left + R},${top}\n H ${right - R}\n Q ${right},${top} ${right},${top + R}\n V ${bottom - R}\n Q ${right},${bottom} ${right - R},${bottom}\n H ${TAIL_OFFSET} \n L 0,0 z`;\n}\n\nfunction bottomTooltipPath(width: number, height: number, shiftX: number) {\n const left = -width / 2 + shiftX;\n const right = width / 2 + shiftX;\n const bottom = TAIL_OFFSET + height;\n const top = TAIL_OFFSET;\n return `M 0,0 \n L ${-TAIL_OFFSET},${top} \n H ${left + R}\n Q ${left},${top} ${left},${top + R} \n V ${bottom - R} \n Q ${left},${bottom} ${left + R},${bottom}\n H ${right - R}\n Q ${right},${bottom} ${right},${bottom - R}\n V ${top + R}\n Q ${right},${top} ${right - R},${top}\n H ${TAIL_OFFSET} \n L 0,0 z`;\n}\n\nfunction getPath(width: number, height: number, direction: Direction, shiftX: number, shiftY: number):string {\n switch (direction) {\n case 'left': return rightTooltipPath(width, height, shiftY);\n case 'right': return leftTooltipPath(width, height, shiftY);\n case 'top': return topTooltipPath(width, height, shiftX);\n case 'bottom': return bottomTooltipPath(width, height, shiftX);\n default: exhaustive(direction, 'Unknown tooltip direction');\n }\n}\n\nfunction getDirection(width: number, height: number, x: number, y: number, offset:number, sideDistances:SideDistances , horizontal: boolean):Direction {\n if (horizontal) {\n return sideDistances.right - x - offset - TAIL_OFFSET > width ? 'right' : 'left';\n }\n return sideDistances.top + y - offset - TAIL_OFFSET > height ? 'top' : 'bottom';\n}\n\nfunction getContentTransform (direction:Direction, width: number, height: number, offset:number, shiftX: number, shiftY: number) {\n if (direction === 'left' || direction === 'right') {\n return `translate(${(direction === 'left' ? -(offset + TAIL_OFFSET + width) : (offset + TAIL_OFFSET))},${-height / 2 + shiftY})`;\n }\n return `translate(${-width / 2 + shiftX},${direction === 'top' ? -(height + offset + TAIL_OFFSET) : offset + TAIL_OFFSET})`;\n\n}\nfunction getPathTransform (direction:Direction, offset:number) {\n if (direction === 'left' || direction === 'right') {\n return `translate(${direction === 'left' ? -offset : offset},0)`;\n }\n return `translate(0,${direction === 'top' ? -offset : offset})`;\n}\n\nfunction getShiftX (direction:Direction, sideDistances: SideDistances, x: number, width: number) {\n if (direction === 'left' || direction === 'right') {\n return 0;\n }\n const rightFreeSpace = sideDistances.right - x;\n const leftFreeSpace = sideDistances.left + x;\n if (rightFreeSpace < width / 2) {\n return rightFreeSpace - width / 2;\n }\n if (leftFreeSpace < width / 2) {\n return width / 2 - leftFreeSpace;\n }\n return 0;\n}\nfunction getShiftY (direction:Direction, sideDistances: SideDistances, y: number, height: number) {\n if (direction === 'top' || direction === 'bottom') {\n return 0;\n }\n const topFreeSpace = sideDistances.top + y;\n const bottomFreeSpace = sideDistances.bottom - y;\n if (topFreeSpace < height / 2) {\n return height / 2 - topFreeSpace;\n }\n if (bottomFreeSpace < height / 2) {\n return bottomFreeSpace - height / 2;\n }\n return 0;\n}\n\nexport type TooltipsData<T> = {\n active: boolean,\n fixed: boolean,\n selectedData: T | null,\n currentFacet: string,\n onMouseEnter: (elementData:T, facetKey?:string) => void,\n onMouseLeave: () => void,\n onClose: () => void\n}\n\nexport function useTooltip<T = unknown>(onTooltipHintSwitchOuterCallback: (v:boolean) => void = () => undefined): TooltipsData<T> {\n const [selectedData, setSelectedData] = useState<T | null>(null);\n const [fixed, setFixed] = useState(false);\n const openRef = useRef(false);\n const fixedRef = useRef(false);\n const currentFacet = useRef('null');\n const hintTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const close = () => {\n setSelectedData(null);\n openRef.current = false;\n if (hintTimer.current) {\n clearTimeout(hintTimer.current);\n hintTimer.current = null;\n }\n onTooltipHintSwitchOuterCallback(false);\n };\n const closeFixed = () => {\n fixedRef.current = false;\n setFixed(false);\n close();\n };\n const onMouseEnter = useCallback((newElementData:T, facetKey?: string) => {\n if (fixedRef.current) {\n return;\n }\n setSelectedData(newElementData);\n openRef.current = true;\n currentFacet.current = facetKey ?? 'null';\n if (hintTimer.current) {\n clearTimeout(hintTimer.current);\n }\n hintTimer.current = setTimeout(() => {\n onTooltipHintSwitchOuterCallback(true);\n }, 2000);\n }, []);\n const onMouseLeave = useCallback(() => {\n if (fixedRef.current) {\n return;\n }\n close();\n }, []);\n\n const onClose = useCallback(closeFixed, []);\n\n useEffect(() => {\n function handleEnter(e:KeyboardEvent) {\n if (openRef.current && e.key === 'Enter') {\n fixedRef.current = true;\n setFixed(true);\n if (hintTimer.current) {\n clearTimeout(hintTimer.current);\n hintTimer.current = null;\n }\n onTooltipHintSwitchOuterCallback(false);\n }\n }\n function handleClickOutside(e:MouseEvent) {\n if (!fixedRef.current) {\n return;\n }\n //const tooltipNodes = Array.from(document.getElementsByClassName(TOOLTIP_CLASS));\n const tooltipNode = document.querySelector(`.${TOOLTIP_CLASS}`);\n const clickedNode = e.target;\n if (tooltipNode && clickedNode && tooltipNode.contains(clickedNode as Node)) {\n return;\n }\n closeFixed();\n }\n document.addEventListener('keydown', handleEnter);\n document.addEventListener('click', handleClickOutside);\n return () => {\n document.removeEventListener('keydown', handleEnter);\n document.removeEventListener('click', handleClickOutside);\n };\n }, []);\n\n return {\n active: selectedData !== null,\n currentFacet: currentFacet.current,\n fixed,\n selectedData,\n onMouseEnter,\n onMouseLeave,\n onClose\n };\n}\n\nexport function Tooltip({\n content,\n x,\n y,\n active,\n fixed,\n container,\n sideDistances,\n onClose = () => undefined,\n offset = POSITION_OFFSET,\n horizontal = true,\n}: {\n content: string[];\n x: number;\n y: number;\n active: boolean;\n fixed: boolean;\n sideDistances: SideDistances;\n onClose?: () => void;\n offset?: number;\n horizontal?: boolean;\n container?: Element | null;\n}) {\n const width = getTooltipWidth(content, fixed);\n const height = getTooltipHeight(content);\n const direction = getDirection(width, height, x, y, offset, sideDistances, horizontal);\n // shifts for tooltip positioning not in center if it is close to chart edges\n const shiftX = getShiftX(direction, sideDistances, x, width);\n const shiftY = getShiftY(direction, sideDistances, y, height);\n\n const firstIconPosition = `translate(${width - ICON_W - OFFSET_H},${OFFSET_V})`;\n const secondIconPosition = `translate(${width - ICON_W * 2 - ICON_OFFSET - OFFSET_H},${OFFSET_V})`;\n\n const [copied, setCopied] = useState(false);\n const [hoveredClose, setHoveredClose] = useState(false);\n const [hoveredCopy, setHoveredCopy] = useState(false);\n\n function copyToClipboard () {\n window?.navigator?.clipboard.writeText(content.join('\\n'));\n setCopied(true);\n }\n \n if (!active || (!container && container !== null)) {\n return null;\n }\n\n const tooltip = (\n <g\n className={TOOLTIP_CLASS}\n transform={`translate(${sideDistances.left + x},${sideDistances.top + y})`}\n opacity={active ? 1 : 0}\n stroke=\"none\"\n fill=\"none\"\n style={{pointerEvents: fixed ? 'all' : 'none'}}\n >\n <path\n transform={getPathTransform(direction, offset)}\n d={getPath(width, height, direction, shiftX, shiftY)}\n fill={BLACK}\n />\n <g\n fontSize=\"14px\"\n fontFamily=\"Manrope\"\n fill=\"white\"\n transform={getContentTransform(direction, width, height, offset, shiftX, shiftY)}\n >\n {content.map((str, idx) => (\n <text\n key={idx}\n x={OFFSET_H}\n y={OFFSET_V + LINE_HEIGHT * idx + LINE_HEIGHT / 2}\n dominantBaseline=\"central\"\n >\n {str}\n </text>\n ))}\n {fixed && (\n <g transform={firstIconPosition}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M4.0006 2.93945L8.0006 6.93945L12.0006 2.93945L13.0613 4.00011L9.06126 8.00011L13.0613 12.0001L12.0006 13.0608L8.0006 9.06077L4.0006 13.0608L2.93994 12.0001L6.93994 8.00011L2.93994 4.00011L4.0006 2.93945Z\"\n fill={hoveredClose ? GREY : WHITE}\n />\n <rect\n x=\"-8\"\n y=\"-8\"\n width=\"24\"\n height=\"24\"\n fill=\"transparent\"\n onClick={onClose}\n onMouseOver={() => setHoveredClose(true)}\n onMouseLeave={() => setHoveredClose(false)}\n style={{cursor: 'pointer'}}\n />\n </g>\n )}\n {fixed && (\n <g transform={secondIconPosition}>\n {copied\n ? (\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M14.0601 4.43439L6.33313 12.5477L1.93945 7.93439L3.02566 6.8999L6.33313 10.3727L12.9739 3.3999L14.0601 4.43439Z\" fill=\"#07AD3E\"/>\n )\n : (\n <g>\n <g clipPath=\"url(#clip0_16418_6183)\">\n <path d=\"M16.0005 13H14.5005V1.5H3.00049V0H14.5005C15.3289 2.86102e-06 16.0005 0.671575 16.0005 1.5V13ZM1.34717 15.9922C0.641178 15.9205 0.0799799 15.3593 0.00830078 14.6533L0.000488281 14.5V4.5C0.000488281 3.72334 0.590765 3.08461 1.34717 3.00781L1.50049 3H11.5005L11.6538 3.00781C12.4102 3.08461 13.0005 3.72334 13.0005 4.5V14.5L12.9927 14.6533C12.921 15.3593 12.3598 15.9205 11.6538 15.9922L11.5005 16H1.50049L1.34717 15.9922ZM11.5005 4.5H1.50049V14.5H11.5005V4.5Z\"\n fill={hoveredCopy ? GREY : WHITE}\n />\n </g>\n <defs>\n <clipPath id=\"clip0_16418_6183\">\n <rect width=\"16\" height=\"16\" transform=\"translate(0.000488281)\" fill=\"white\" />\n </clipPath>\n </defs>\n </g>\n )}\n <rect\n x=\"-8\"\n y=\"-8\"\n width=\"24\"\n height=\"24\"\n fill=\"transparent\"\n onClick={copyToClipboard}\n onMouseOver={() => setHoveredCopy(true)}\n onMouseLeave={() => setHoveredCopy(false)}\n style={{cursor: 'pointer'}}\n />\n </g>\n )}\n </g>\n </g>\n );\n\n return container === null ? tooltip : createPortal(\n tooltip,\n container\n );\n}\n"],"names":["OFFSET_V","OFFSET_H","LINE_HEIGHT","R","TAIL_OFFSET","POSITION_OFFSET","ICON_W","ICON_OFFSET","ICONS_WIDTH","GREY","WHITE","TOOLTIP_CLASS","getTooltipHeight","content","getTooltipWidth","hasIcons","textMeasurer","TextMeasurer","str","idx","rightTooltipPath","width","height","shiftY","left","right","top","bottom","leftTooltipPath","topTooltipPath","shiftX","bottomTooltipPath","getPath","direction","exhaustive","getDirection","x","y","offset","sideDistances","horizontal","getContentTransform","getPathTransform","getShiftX","rightFreeSpace","leftFreeSpace","getShiftY","topFreeSpace","bottomFreeSpace","useTooltip","onTooltipHintSwitchOuterCallback","selectedData","setSelectedData","useState","fixed","setFixed","openRef","useRef","fixedRef","currentFacet","hintTimer","close","closeFixed","onMouseEnter","useCallback","newElementData","facetKey","onMouseLeave","onClose","useEffect","handleEnter","e","handleClickOutside","tooltipNode","clickedNode","Tooltip","active","container","firstIconPosition","secondIconPosition","copied","setCopied","hoveredClose","setHoveredClose","hoveredCopy","setHoveredCopy","copyToClipboard","_a","tooltip","jsxs","jsx","BLACK","a","createPortal"],"mappings":";;;;;;AAcA,MAAMA,IAAW,GACXC,IAAW,IACXC,IAAc,IACdC,IAAI,GACJC,IAAc,GACdC,IAAkB,GAElBC,IAAS,IACTC,IAAc,GACdC,IAAcF,IAAS,IAAIC,IAAc,IAEzCE,IAAO,WACPC,IAAQ,QAERC,IAAgB;AAEf,SAASC,EAAiBC,GAAmB;AAChD,SAAOA,EAAQ,SAASX,IAAc,IAAIF;AAC9C;AACO,SAASc,EAAgBD,GAAmBE,IAAW,IAAO;AACjE,QAAMC,IAAe,IAAIC,EAAa,gBAAgB;AACtD,SAAO,KAAK,IAAI,GAAGJ,EAAQ,IAAI,CAACK,GAAKC,MAAQH,EAAa,aAAaE,CAAG,KAAKC,MAAQ,KAAKJ,IAAWP,IAAc,EAAE,CAAC,IAAI,IAAIP;AACpI;AAEA,SAASmB,EAAiBC,GAAeC,GAAgBC,GAAgB;AACrE,QAAMC,IAAO,CAACpB,IAAciB,GACtBI,IAAQ,CAACrB,GACTsB,IAAM,CAACJ,IAAS,IAAIC,GACpBI,IAASL,IAAS,IAAIC;AAC5B,SAAO;AAAA,QACHE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MN,IAAc3E,IAAOC;AAAAA,oBAAA;AAAA,kBAAA,GAErC;AAAA,kBAAAkF,gBAAAA,EAAA,IACK,QAAA,EACD,UAAAF,gBAAAA,EAAAA,IAAC,YAAA,EAAS,IAAG,oBACb,UAAAA,gBAAAA,MAAC,QAAA,EAAK,OAAM,MAAK,QAAO,MAAK,WAAU,0BAAyB,MAAK,QAAA,CAAQ,EAAA,CAC7E,EAAA,CACA;AAAA,gBAAA,GACJ;AAAA,gBAERA,gBAAAA,EAAAA;AAAAA,kBAAC;AAAA,kBAAA;AAAA,oBACG,GAAE;AAAA,oBACF,GAAE;AAAA,oBACF,OAAM;AAAA,oBACN,QAAO;AAAA,oBACP,MAAK;AAAA,oBACL,SAASJ;AAAAA,oBACT,aAAa,MAAMD,EAAe,EAAI;AAAA,oBACtC,cAAc,MAAMA,EAAe,EAAK;AAAA,oBACxC,OAAO,EAAC,QAAQ,UAAA;AAAA,kBAAA;AAAA,gBAAS;AAAA,cAAA,GAEjC;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAER;AAAA,EAAA;AAIR,SAAOR,MAAc,OAAOW,IAAUK,EAAAA;AAAAA,IAClCL;AAAAA,IACAX;AAAAA,EAAA;AAER;","x_google_ignoreList":[0]}
@@ -0,0 +1,20 @@
1
+ import { j as o } from "../node_modules/react/jsx-runtime.js";
2
+ import { r as e } from "../_virtual/index.js";
3
+ const a = e.createContext(null);
4
+ function s({
5
+ children: r,
6
+ dataFrame: t
7
+ }) {
8
+ return /* @__PURE__ */ o.jsx(a.Provider, { value: { dataFrame: t }, children: r });
9
+ }
10
+ function i() {
11
+ const r = e.useContext(a);
12
+ if (!r)
13
+ throw new Error("useDataFrame is empty");
14
+ return r.dataFrame;
15
+ }
16
+ export {
17
+ s as DataFrameProvider,
18
+ i as useDataFrame
19
+ };
20
+ //# sourceMappingURL=useDataFrame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDataFrame.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/common/useDataFrame.tsx"],"sourcesContent":["import { createContext, type PropsWithChildren, useContext } from 'react';\nimport type { DataFrame } from '../DataFrame';\n\nexport interface DataFrameContextValue {\n dataFrame: DataFrame;\n}\n\nconst DataFrameContext = createContext<DataFrameContextValue | null>(null);\n\nexport interface DataFrameProviderProps {\n dataFrame: DataFrame;\n}\n\nexport function DataFrameProvider({ \n children, \n dataFrame\n}: PropsWithChildren<DataFrameProviderProps>) {\n return (\n <DataFrameContext.Provider value={{ dataFrame }}>\n {children}\n </DataFrameContext.Provider>\n );\n}\n\nexport function useDataFrame(): DataFrame {\n const context = useContext(DataFrameContext);\n \n if (!context) {\n throw new Error('useDataFrame is empty');\n }\n \n return context.dataFrame;\n}\n"],"names":["DataFrameContext","createContext","DataFrameProvider","children","dataFrame","jsx","useDataFrame","context","useContext"],"mappings":";;AAOA,MAAMA,IAAmBC,EAAAA,cAA4C,IAAI;AAMlE,SAASC,EAAkB;AAAA,EAChC,UAAAC;AAAAA,EACA,WAAAC;AACF,GAA8C;AAC5C,SACEC,gBAAAA,EAAAA,IAACL,EAAiB,UAAjB,EAA0B,OAAO,EAAE,WAAAI,EAAAA,GACjC,UAAAD,EAAAA,CACH;AAEJ;AAEO,SAASG,IAA0B;AACxC,QAAMC,IAAUC,EAAAA,WAAWR,CAAgB;AAE3C,MAAI,CAACO;AACH,UAAM,IAAI,MAAM,uBAAuB;AAGzC,SAAOA,EAAQ;AACjB;","x_google_ignoreList":[0]}