@milaboratories/miplots4 1.0.133 → 1.0.135

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 (148) hide show
  1. package/dist/{discrete/components → common}/BandAxis.d.ts +2 -2
  2. package/dist/common/BandAxis.d.ts.map +1 -0
  3. package/dist/{discrete/components → common}/BandAxis.js +3 -3
  4. package/dist/common/BandAxis.js.map +1 -0
  5. package/dist/common/ContinuousGrid.d.ts +3 -3
  6. package/dist/common/ContinuousGrid.d.ts.map +1 -1
  7. package/dist/common/ContinuousGrid.js.map +1 -1
  8. package/dist/discrete/ChartRenderer.d.ts.map +1 -1
  9. package/dist/discrete/ChartRenderer.js +192 -265
  10. package/dist/discrete/ChartRenderer.js.map +1 -1
  11. package/dist/discrete/DiscreteSettingsImpl.d.ts +17 -2
  12. package/dist/discrete/DiscreteSettingsImpl.d.ts.map +1 -1
  13. package/dist/discrete/DiscreteSettingsImpl.js +93 -67
  14. package/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
  15. package/dist/discrete/components/Chart.d.ts.map +1 -1
  16. package/dist/discrete/components/Chart.js +153 -136
  17. package/dist/discrete/components/Chart.js.map +1 -1
  18. package/dist/discrete/components/Grid.d.ts +3 -3
  19. package/dist/discrete/components/Grid.d.ts.map +1 -1
  20. package/dist/discrete/components/Grid.js.map +1 -1
  21. package/dist/discrete/components/layers/StackedAreaElement.d.ts +24 -0
  22. package/dist/discrete/components/layers/StackedAreaElement.d.ts.map +1 -0
  23. package/dist/discrete/components/layers/StackedAreaElement.js +105 -0
  24. package/dist/discrete/components/layers/StackedAreaElement.js.map +1 -0
  25. package/dist/discrete/components/layers/StackedBarElement.d.ts +3 -1
  26. package/dist/discrete/components/layers/StackedBarElement.d.ts.map +1 -1
  27. package/dist/discrete/components/layers/StackedBarElement.js +67 -60
  28. package/dist/discrete/components/layers/StackedBarElement.js.map +1 -1
  29. package/dist/discrete/components/types.d.ts +5 -3
  30. package/dist/discrete/components/types.d.ts.map +1 -1
  31. package/dist/discrete/index.d.ts.map +1 -1
  32. package/dist/discrete/index.js +58 -55
  33. package/dist/discrete/index.js.map +1 -1
  34. package/dist/discrete/layers/index.d.ts +1 -0
  35. package/dist/discrete/layers/index.d.ts.map +1 -1
  36. package/dist/discrete/layers/stackedArea.d.ts +10 -0
  37. package/dist/discrete/layers/stackedArea.d.ts.map +1 -0
  38. package/dist/discrete/layers/stackedArea.js +17 -0
  39. package/dist/discrete/layers/stackedArea.js.map +1 -0
  40. package/dist/discrete/layers/types.d.ts +12 -1
  41. package/dist/discrete/layers/types.d.ts.map +1 -1
  42. package/dist/discrete/utils/index.d.ts +1 -1
  43. package/dist/discrete/utils/index.d.ts.map +1 -1
  44. package/dist/histogram/ChartRenderer.js +1 -1
  45. package/dist/index.d.ts +2 -2
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/node_modules/d3-scale/src/band.js +45 -35
  48. package/dist/node_modules/d3-scale/src/band.js.map +1 -1
  49. package/dist/scatterplot/ChartRenderer.d.ts +10 -5
  50. package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
  51. package/dist/scatterplot/ChartRenderer.js +276 -197
  52. package/dist/scatterplot/ChartRenderer.js.map +1 -1
  53. package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +5 -3
  54. package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
  55. package/dist/scatterplot/ScatterplotSettingsImpl.js +53 -53
  56. package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
  57. package/dist/scatterplot/components/Chart.d.ts +3 -1
  58. package/dist/scatterplot/components/Chart.d.ts.map +1 -1
  59. package/dist/scatterplot/components/Chart.js +23 -19
  60. package/dist/scatterplot/components/Chart.js.map +1 -1
  61. package/dist/scatterplot/components/ChartAxis.d.ts +3 -1
  62. package/dist/scatterplot/components/ChartAxis.d.ts.map +1 -1
  63. package/dist/scatterplot/components/ChartAxis.js +31 -27
  64. package/dist/scatterplot/components/ChartAxis.js.map +1 -1
  65. package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -1
  66. package/dist/scatterplot/components/ChartLayersData.js.map +1 -1
  67. package/dist/scatterplot/components/ChartTooltip.js.map +1 -1
  68. package/dist/scatterplot/components/ChartTrendsData.d.ts.map +1 -1
  69. package/dist/scatterplot/components/ChartTrendsData.js +20 -17
  70. package/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
  71. package/dist/scatterplot/components/ChartsGroup.d.ts +5 -1
  72. package/dist/scatterplot/components/ChartsGroup.d.ts.map +1 -1
  73. package/dist/scatterplot/components/ChartsGroup.js +49 -46
  74. package/dist/scatterplot/components/ChartsGroup.js.map +1 -1
  75. package/dist/scatterplot/components/Grid.d.ts +3 -3
  76. package/dist/scatterplot/components/Grid.d.ts.map +1 -1
  77. package/dist/scatterplot/components/Grid.js +31 -27
  78. package/dist/scatterplot/components/Grid.js.map +1 -1
  79. package/dist/scatterplot/components/types.d.ts +15 -5
  80. package/dist/scatterplot/components/types.d.ts.map +1 -1
  81. package/dist/scatterplot/dots.d.ts +2 -2
  82. package/dist/scatterplot/dots.d.ts.map +1 -1
  83. package/dist/scatterplot/dots.js.map +1 -1
  84. package/dist/scatterplot/getLayersData.d.ts +3 -2
  85. package/dist/scatterplot/getLayersData.d.ts.map +1 -1
  86. package/dist/scatterplot/getLayersData.js +29 -18
  87. package/dist/scatterplot/getLayersData.js.map +1 -1
  88. package/dist/scatterplot/index.d.ts +3 -0
  89. package/dist/scatterplot/index.d.ts.map +1 -1
  90. package/dist/scatterplot/index.js +73 -59
  91. package/dist/scatterplot/index.js.map +1 -1
  92. package/dist/scatterplot/linearRegression.d.ts +4 -6
  93. package/dist/scatterplot/linearRegression.d.ts.map +1 -1
  94. package/dist/scatterplot/linearRegression.js.map +1 -1
  95. package/dist/scatterplot/utils/isNumericScale.d.ts +6 -0
  96. package/dist/scatterplot/utils/isNumericScale.d.ts.map +1 -0
  97. package/dist/scatterplot/utils/isNumericScale.js +11 -0
  98. package/dist/scatterplot/utils/isNumericScale.js.map +1 -0
  99. package/dist/scatterplot-umap/ChartRenderer.js +1 -1
  100. package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  101. package/dist/scatterplot-umap/SettingsImpl.d.ts +7 -4
  102. package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
  103. package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
  104. package/dist/scatterplot-umap/components/LowerSVG.js +7 -7
  105. package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
  106. package/dist/types/bubble.d.ts +12 -12
  107. package/dist/types/common.d.ts +186 -21
  108. package/dist/types/common.d.ts.map +1 -1
  109. package/dist/types/common.js +36 -26
  110. package/dist/types/common.js.map +1 -1
  111. package/dist/types/dendro.d.ts +22 -22
  112. package/dist/types/discrete.d.ts +291 -53
  113. package/dist/types/discrete.d.ts.map +1 -1
  114. package/dist/types/discrete.js +48 -33
  115. package/dist/types/discrete.js.map +1 -1
  116. package/dist/types/heatmap.d.ts +12 -12
  117. package/dist/types/histogram.d.ts +4 -4
  118. package/dist/types/scatterplot-umap.d.ts +4 -34
  119. package/dist/types/scatterplot-umap.d.ts.map +1 -1
  120. package/dist/types/scatterplot-umap.js +1 -1
  121. package/dist/types/scatterplot-umap.js.map +1 -1
  122. package/dist/types/scatterplot.d.ts +186 -32
  123. package/dist/types/scatterplot.d.ts.map +1 -1
  124. package/dist/utils/createMultilineDiscreteLabels.d.ts +4 -0
  125. package/dist/utils/createMultilineDiscreteLabels.d.ts.map +1 -0
  126. package/dist/utils/createMultilineDiscreteLabels.js +32 -0
  127. package/dist/utils/createMultilineDiscreteLabels.js.map +1 -0
  128. package/dist/utils/getFacetRowsColumns.d.ts +3 -0
  129. package/dist/utils/getFacetRowsColumns.d.ts.map +1 -0
  130. package/dist/utils/getFacetRowsColumns.js +18 -0
  131. package/dist/utils/getFacetRowsColumns.js.map +1 -0
  132. package/dist/utils/measureMultilineDiscreteLabels.d.ts +9 -0
  133. package/dist/utils/measureMultilineDiscreteLabels.d.ts.map +1 -0
  134. package/dist/utils/measureMultilineDiscreteLabels.js +63 -0
  135. package/dist/utils/measureMultilineDiscreteLabels.js.map +1 -0
  136. package/dist/utils/splitTextByWidth.d.ts.map +1 -0
  137. package/dist/{discrete/utils → utils}/splitTextByWidth.js +1 -1
  138. package/dist/utils/splitTextByWidth.js.map +1 -0
  139. package/package.json +1 -1
  140. package/dist/discrete/components/BandAxis.d.ts.map +0 -1
  141. package/dist/discrete/components/BandAxis.js.map +0 -1
  142. package/dist/discrete/utils/splitTextByWidth.d.ts.map +0 -1
  143. package/dist/discrete/utils/splitTextByWidth.js.map +0 -1
  144. package/dist/scatterplot/components/Axis.d.ts +0 -13
  145. package/dist/scatterplot/components/Axis.d.ts.map +0 -1
  146. package/dist/scatterplot/components/Axis.js +0 -59
  147. package/dist/scatterplot/components/Axis.js.map +0 -1
  148. /package/dist/{discrete/utils → utils}/splitTextByWidth.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"scatterplot.d.ts","sourceRoot":"","sources":["../../src/types/scatterplot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,oCAAoC,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACnG,OAAO,EAGH,mCAAmC,EAMtC,MAAM,UAAU,CAAC;AAElB,KAAK,gBAAgB,CAAC,SAAS,SAAS,CAAC,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,oCAAoC,CAAC,SAAS,CAAC,CAAC,CAAC;AACxH,KAAK,iBAAiB,CAAC,SAAS,SAAS,CAAC,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,mCAAmC,CAAC,SAAS,CAAC,CAAC,CAAC;AAExH,MAAM,MAAM,wBAAwB,CAAC,SAAS,IAAI,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyDpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACtC,MAAM,EACN;IACI,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,OAAO,KAAK,SAAS,GAAG,SAAS,CAAC;IACzE,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;CACpC,CACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ScaleBand, ScalePoint } from 'd3-scale';
2
+ import { DiscreteLabelsPosition, Orientation } from '../types';
3
+ export declare function createMultilineDiscreteLabels(facetKeys: string[], labelsPosition: DiscreteLabelsPosition, labelsMap: Record<string, string>, hiddenLabels: boolean, orientation: Orientation, scalesByFacet: Record<string, ScaleBand<string> | ScalePoint<string | number>>): Record<string, Record<string, string[]>>;
4
+ //# sourceMappingURL=createMultilineDiscreteLabels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMultilineDiscreteLabels.d.ts","sourceRoot":"","sources":["../../src/utils/createMultilineDiscreteLabels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAMpE,wBAAgB,6BAA6B,CACzC,SAAS,EAAE,MAAM,EAAE,EACnB,cAAc,EAAE,sBAAsB,EACtC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,YAAY,EAAE,OAAO,EACrB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,4CAyCjF"}
@@ -0,0 +1,32 @@
1
+ import { CAPTION_LINE_HEIGHT as l } from "../discrete/constants.js";
2
+ import { splitTextByWidth as T } from "./splitTextByWidth.js";
3
+ const A = Math.sin(Math.PI / 4);
4
+ function E(h, c, a, m, I, M) {
5
+ const s = {
6
+ center: 120,
7
+ "45deg": 256,
8
+ "90deg": 320
9
+ }, _ = I === "vertical";
10
+ function g(t, n) {
11
+ return t === "center" ? 1 / 0 : Math.floor(t === "45deg" ? n * A / l : n / l);
12
+ }
13
+ return h.reduce((t, n) => {
14
+ const o = M[n], u = o.step(), f = s[c], p = c === "center" ? Math.min(f, u) : f;
15
+ return t[n] = o.domain().reduce((e, r) => {
16
+ if (m)
17
+ return e[r] = [], e;
18
+ const i = a[r];
19
+ if (!_)
20
+ e[r] = [i];
21
+ else {
22
+ const L = g(c, u), d = T(i, p, 14);
23
+ e[r] = d.length > L ? [i] : d;
24
+ }
25
+ return e;
26
+ }, {}), t;
27
+ }, {});
28
+ }
29
+ export {
30
+ E as createMultilineDiscreteLabels
31
+ };
32
+ //# sourceMappingURL=createMultilineDiscreteLabels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMultilineDiscreteLabels.js","sources":["../../src/utils/createMultilineDiscreteLabels.ts"],"sourcesContent":["import type { ScaleBand, ScalePoint } from 'd3-scale';\nimport type { DiscreteLabelsPosition, Orientation } from '../types';\nimport { CAPTION_LINE_HEIGHT } from '../discrete/constants';\nimport { splitTextByWidth } from './splitTextByWidth';\n\nconst SIN_PI_4 = Math.sin(Math.PI / 4);\n\nexport function createMultilineDiscreteLabels(\n facetKeys: string[],\n labelsPosition: DiscreteLabelsPosition,\n labelsMap: Record<string, string>,\n hiddenLabels: boolean,\n orientation: Orientation,\n scalesByFacet: Record<string, ScaleBand<string> | ScalePoint<string | number>>\n) {\n const DEFAULT_MAX_WIDTH = {\n 'center': 120,\n '45deg': 256,\n '90deg': 320,\n };\n const isVertical = orientation === 'vertical';\n\n function getMaxLinesCount(labelsPosition: 'center' | '45deg' | '90deg', bandwidth: number) {\n if (labelsPosition === 'center') {\n return Infinity;\n }\n if (labelsPosition === '45deg') {\n return Math.floor((bandwidth * SIN_PI_4) / CAPTION_LINE_HEIGHT);\n }\n return Math.floor(bandwidth / CAPTION_LINE_HEIGHT);\n }\n\n return facetKeys.reduce((res: Record<string, Record<string, string[]>>, facetKey) => {\n const scale = scalesByFacet[facetKey];\n const bandwidth = scale.step();\n const defaultWidth = DEFAULT_MAX_WIDTH[labelsPosition];\n const width = labelsPosition === 'center' ? Math.min(defaultWidth, bandwidth) : defaultWidth;\n res[facetKey] = scale.domain().reduce((res2: Record<string, string[]>, axisKey) => {\n if (hiddenLabels) {\n res2[axisKey] = [];\n return res2;\n }\n const label = labelsMap[axisKey];\n if (!isVertical) {\n res2[axisKey] = [label];\n } else {\n const maxLinesCount = getMaxLinesCount(labelsPosition, bandwidth);\n const multilineKey = splitTextByWidth(label, width, 14);\n res2[axisKey] = multilineKey.length > maxLinesCount ? [label] : multilineKey;\n }\n return res2;\n }, {});\n return res;\n }, {});\n}"],"names":["SIN_PI_4","createMultilineDiscreteLabels","facetKeys","labelsPosition","labelsMap","hiddenLabels","orientation","scalesByFacet","DEFAULT_MAX_WIDTH","isVertical","getMaxLinesCount","bandwidth","CAPTION_LINE_HEIGHT","res","facetKey","scale","defaultWidth","width","res2","axisKey","label","maxLinesCount","multilineKey","splitTextByWidth"],"mappings":";;AAKA,MAAMA,IAAW,KAAK,IAAI,KAAK,KAAK,CAAC;AAE9B,SAASC,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACF;AACG,QAAMC,IAAoB;AAAA,IACvB,QAAU;AAAA,IACV,SAAS;AAAA,IACT,SAAS;AAAA,EAAA,GAEPC,IAAaH,MAAgB;AAEnC,WAASI,EAAiBP,GAA8CQ,GAAmB;AACvF,WAAIR,MAAmB,WACZ,QAGA,KAAK,MADZA,MAAmB,UACAQ,IAAYX,IAAYY,IAE7BD,IAAYC,CAFoC;AAAA,EAGtE;AAEA,SAAOV,EAAU,OAAO,CAACW,GAA+CC,MAAa;AACjF,UAAMC,IAAQR,EAAcO,CAAQ,GAC9BH,IAAYI,EAAM,KAAA,GAClBC,IAAeR,EAAkBL,CAAc,GAC/Cc,IAAQd,MAAmB,WAAW,KAAK,IAAIa,GAAcL,CAAS,IAAIK;AAChF,WAAAH,EAAIC,CAAQ,IAAIC,EAAM,OAAA,EAAS,OAAO,CAACG,GAAgCC,MAAY;AAC/E,UAAId;AACA,eAAAa,EAAKC,CAAO,IAAI,CAAA,GACTD;AAEX,YAAME,IAAQhB,EAAUe,CAAO;AAC/B,UAAI,CAACV;AACD,QAAAS,EAAKC,CAAO,IAAI,CAACC,CAAK;AAAA,WACnB;AACH,cAAMC,IAAgBX,EAAiBP,GAAgBQ,CAAS,GAC1DW,IAAeC,EAAiBH,GAAOH,GAAO,EAAE;AACtD,QAAAC,EAAKC,CAAO,IAAIG,EAAa,SAASD,IAAgB,CAACD,CAAK,IAAIE;AAAA,MACpE;AACA,aAAOJ;AAAA,IACX,GAAG,CAAA,CAAE,GACEL;AAAA,EACX,GAAG,CAAA,CAAE;AACT;"}
@@ -0,0 +1,3 @@
1
+ export declare function getFacetColumns(facetKeys: string[], nRows: number, nColumns: number): string[][];
2
+ export declare function getFacetRows(facetKeys: string[], nRows: number, nColumns: number): string[][];
3
+ //# sourceMappingURL=getFacetRowsColumns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFacetRowsColumns.d.ts","sourceRoot":"","sources":["../../src/utils/getFacetRowsColumns.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAWhG;AAGD,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAM7F"}
@@ -0,0 +1,18 @@
1
+ function o(c, i, e) {
2
+ const r = new Array(e).fill(null).map(() => []);
3
+ for (let t = 0; t < e; t++)
4
+ for (let f = 0; f < i; f++)
5
+ f * e + t < c.length && r[t].push(c[f * e + t]);
6
+ return r;
7
+ }
8
+ function a(c, i, e) {
9
+ const r = [];
10
+ for (let t = 0; t < i; t++)
11
+ r.push(c.slice(t * e, t * e + e));
12
+ return r;
13
+ }
14
+ export {
15
+ o as getFacetColumns,
16
+ a as getFacetRows
17
+ };
18
+ //# sourceMappingURL=getFacetRowsColumns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFacetRowsColumns.js","sources":["../../src/utils/getFacetRowsColumns.ts"],"sourcesContent":["\n// facet keys grouped by columns\nexport function getFacetColumns(facetKeys: string[], nRows: number, nColumns: number): string[][] {\n const result: string[][] = new Array(nColumns).fill(null).map(() => []);\n for (let i = 0; i < nColumns; i++) {\n for (let j = 0; j < nRows; j++) {\n const facetIdx = j * nColumns + i;\n if (facetIdx < facetKeys.length) {\n result[i].push(facetKeys[j * nColumns + i]);\n }\n }\n }\n return result;\n}\n\n// facet keys grouped by rows\nexport function getFacetRows(facetKeys: string[], nRows: number, nColumns: number): string[][] {\n const result: string[][] = [];\n for (let i = 0; i < nRows; i++) {\n result.push(facetKeys.slice(i * nColumns, i * nColumns + nColumns));\n }\n return result;\n}"],"names":["getFacetColumns","facetKeys","nRows","nColumns","result","i","j","getFacetRows"],"mappings":"AAEO,SAASA,EAAgBC,GAAqBC,GAAeC,GAA8B;AAC9F,QAAMC,IAAqB,IAAI,MAAMD,CAAQ,EAAE,KAAK,IAAI,EAAE,IAAI,MAAM,EAAE;AACtE,WAASE,IAAI,GAAGA,IAAIF,GAAUE;AAC1B,aAASC,IAAI,GAAGA,IAAIJ,GAAOI;AAEvB,MADiBA,IAAIH,IAAWE,IACjBJ,EAAU,UACrBG,EAAOC,CAAC,EAAE,KAAKJ,EAAUK,IAAIH,IAAWE,CAAC,CAAC;AAItD,SAAOD;AACX;AAGO,SAASG,EAAaN,GAAqBC,GAAeC,GAA8B;AAC3F,QAAMC,IAAqB,CAAA;AAC3B,WAASC,IAAI,GAAGA,IAAIH,GAAOG;AACvB,IAAAD,EAAO,KAAKH,EAAU,MAAMI,IAAIF,GAAUE,IAAIF,IAAWA,CAAQ,CAAC;AAEtE,SAAOC;AACX;"}
@@ -0,0 +1,9 @@
1
+ import { ScaleBand, ScalePoint } from 'd3-scale';
2
+ import { DiscreteLabelsPosition, Orientation } from '../types';
3
+ export declare function measureMultilineDiscreteLabels(facetKeys: string[], rowsCount: number, columnsCount: number, labelsPosition: DiscreteLabelsPosition, axisLabels: Record<string, Record<string, string[]>>, orientation: Orientation, scalesByFacet: Record<string, ScaleBand<string> | ScalePoint<string | number>>): {
4
+ axisCaptionsWidthByRows: number[];
5
+ axisCaptionsWidthByColumns: number[];
6
+ xTail: number;
7
+ yTail: number;
8
+ };
9
+ //# sourceMappingURL=measureMultilineDiscreteLabels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measureMultilineDiscreteLabels.d.ts","sourceRoot":"","sources":["../../src/utils/measureMultilineDiscreteLabels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAOpE,wBAAgB,8BAA8B,CACtC,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,sBAAsB,EACtC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,EACpD,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;;;;;EA+GjF"}
@@ -0,0 +1,63 @@
1
+ import { CAPTION_LINE_HEIGHT as B } from "../discrete/constants.js";
2
+ import { TextMeasurer as F } from "./TextMeasurer/TextMeasurer.js";
3
+ import { getFacetRows as O, getFacetColumns as k } from "./getFacetRowsColumns.js";
4
+ const W = Math.sin(Math.PI / 4);
5
+ function D(d, f, l, m, o, L, h) {
6
+ const N = new F("600 14px Manrope"), A = L === "vertical";
7
+ function x(t) {
8
+ return t.length ? Math.max(...t.map((n) => N.getTextWidth(n))) : 0;
9
+ }
10
+ function s(t) {
11
+ return t.length ? Math.max(...t.map(x)) : 0;
12
+ }
13
+ let u = [], c = [], T = 0, _ = 0;
14
+ const p = O(d, f, l), M = k(d, f, l);
15
+ function C(t) {
16
+ return t.map(
17
+ (n) => Math.max(
18
+ ...n.map(
19
+ (e) => Math.max(
20
+ ...h[e].domain().map(
21
+ (i) => i ? o[e][i].length * B : 0
22
+ )
23
+ )
24
+ )
25
+ )
26
+ );
27
+ }
28
+ function E(t) {
29
+ return t.map((n) => Math.max(
30
+ ...n.map((e) => {
31
+ const i = h[e].domain().map((a) => o[e][a]), r = s(i);
32
+ return r > 0 ? r * W + 14 : 0;
33
+ })
34
+ ));
35
+ }
36
+ function S(t) {
37
+ return t.map(
38
+ (n) => Math.max(
39
+ ...n.map(
40
+ (e) => s(
41
+ h[e].domain().map((i) => o[e][i])
42
+ )
43
+ )
44
+ )
45
+ );
46
+ }
47
+ function I(t, n = !0) {
48
+ const e = n ? t[0] : t[t.length - 1];
49
+ return Math.max(
50
+ ...e.map((i) => {
51
+ const r = h[i], a = r.domain(), Z = (g) => r(a[n ? g : a.length - g - 1]) + r.bandwidth() / 2;
52
+ return Math.max(
53
+ ...a.map((g, z) => x(o[i][g]) * W - Z(z) + 14)
54
+ );
55
+ })
56
+ );
57
+ }
58
+ return A ? (m === "center" && (u = C(p)), m === "45deg" && (u = E(p), T = I(p, !0)), m === "90deg" && (u = S(p))) : m === "45deg" ? (c = E(M), _ = I(M, !1)) : c = S(M), { axisCaptionsWidthByRows: u, axisCaptionsWidthByColumns: c, xTail: T, yTail: _ };
59
+ }
60
+ export {
61
+ D as measureMultilineDiscreteLabels
62
+ };
63
+ //# sourceMappingURL=measureMultilineDiscreteLabels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measureMultilineDiscreteLabels.js","sources":["../../src/utils/measureMultilineDiscreteLabels.ts"],"sourcesContent":["import type { ScaleBand, ScalePoint } from 'd3-scale';\nimport { CAPTION_LINE_HEIGHT } from '../discrete/constants';\nimport type { DiscreteLabelsPosition, Orientation } from '../types';\nimport { TextMeasurer } from './TextMeasurer/TextMeasurer';\nimport { getFacetColumns, getFacetRows } from './getFacetRowsColumns';\nimport { ZodNumber } from 'zod';\n\nconst SIN_45 = Math.sin(Math.PI / 4);\n\nexport function measureMultilineDiscreteLabels (\n facetKeys: string[],\n rowsCount: number,\n columnsCount: number,\n labelsPosition: DiscreteLabelsPosition,\n axisLabels: Record<string, Record<string, string[]>>,\n orientation: Orientation,\n scalesByFacet: Record<string, ScaleBand<string> | ScalePoint<string | number>>\n ) {\n const LABEL_FONT_SIZE = 14;\n const textMeasurer = new TextMeasurer(`600 ${LABEL_FONT_SIZE}px Manrope`);\n const isVertical = orientation === 'vertical';\n\n function getMaxStrWidth(strs: string[]) {\n if (!strs.length) {\n return 0;\n }\n return Math.max(...strs.map(str => textMeasurer.getTextWidth(str)));\n }\n\n function getMultilineMaxStrWidth(strs: string[][]) {\n if (!strs.length) {\n return 0;\n }\n return Math.max(...strs.map(getMaxStrWidth));\n }\n\n // x ticks are always strings and can have variable width in different facets, and can be rotated;\n // for x we consider the widest tick caption in row (column for horizontal orientation);\n // y ticks are always numbers, and we consider only the widest number of all facets\n // because numbers sizes are closer to each other, and it makes more equal facets grid without superwide empty offsets\n let axisCaptionsWidthByRows: number[] = [];\n let axisCaptionsWidthByColumns: number[] = [];\n let xTail = 0;\n let yTail = 0;\n\n const facetRows = getFacetRows(facetKeys, rowsCount, columnsCount);\n const facetColumns = getFacetColumns(facetKeys, rowsCount, columnsCount);\n\n function getSizeWithPositionCenter(columnOrRowKeys:string[][]) {\n return columnOrRowKeys.map(keys =>\n Math.max(\n ...keys.map(facetKey =>\n Math.max(\n ...scalesByFacet[facetKey]\n .domain()\n // do not consider empty ticks captions, for example - single group\n .map(axisKey =>\n axisKey ? axisLabels[facetKey][axisKey].length * CAPTION_LINE_HEIGHT : 0\n )\n )\n )\n )\n );\n }\n function getSizeWithPosition45deg(columnOrRowKeys:string[][]) {\n return columnOrRowKeys.map(keys => {\n return Math.max(\n ...keys.map(key => {\n const labels = scalesByFacet[key]\n .domain()\n .map(axisKey => axisLabels[key][axisKey]);\n const ticksWidth = getMultilineMaxStrWidth(labels);\n return ticksWidth > 0 ? ticksWidth * SIN_45 + LABEL_FONT_SIZE : 0;\n })\n );\n });\n }\n function getSizeWithPosition90deg(columnOrRowKeys:string[][]) {\n return columnOrRowKeys\n // max of ticks width in every facet's column\n .map(keys =>\n Math.max(\n ...keys.map(facetKey =>\n getMultilineMaxStrWidth(\n scalesByFacet[facetKey]\n .domain()\n .map(axisKey => axisLabels[facetKey][axisKey])\n )\n )\n )\n );\n }\n function getTail(columnOrRowKeys:string[][], first = true) {\n const keys = first ? columnOrRowKeys[0] : columnOrRowKeys[columnOrRowKeys.length - 1];\n return Math.max(\n ...keys.map(facetKey => {\n const scale = scalesByFacet[facetKey];\n const ticks = scale.domain();\n const pos = (idx:number) => (scale(ticks[first ? idx : ticks.length - idx - 1] as string) as number) + scale.bandwidth() / 2;\n return Math.max(\n ...ticks.map((tick, idx) => getMaxStrWidth(axisLabels[facetKey][tick]) * SIN_45 - pos(idx) + LABEL_FONT_SIZE)\n );\n })\n );\n }\n if (!isVertical) {\n if (labelsPosition === '45deg') {\n axisCaptionsWidthByColumns = getSizeWithPosition45deg(facetColumns);\n yTail = getTail(facetColumns, false);\n } else {\n // with horizontal chart orientation X ticks are always in horizontal position\n axisCaptionsWidthByColumns = getSizeWithPosition90deg(facetColumns);\n }\n } else {\n if (labelsPosition === 'center') {\n axisCaptionsWidthByRows = getSizeWithPositionCenter(facetRows);\n }\n if (labelsPosition === '45deg') {\n axisCaptionsWidthByRows = getSizeWithPosition45deg(facetRows);\n xTail = getTail(facetRows, true);\n }\n if (labelsPosition === '90deg') {\n axisCaptionsWidthByRows = getSizeWithPosition90deg(facetRows);\n }\n }\n\n return {axisCaptionsWidthByRows, axisCaptionsWidthByColumns, xTail, yTail};\n }"],"names":["SIN_45","measureMultilineDiscreteLabels","facetKeys","rowsCount","columnsCount","labelsPosition","axisLabels","orientation","scalesByFacet","textMeasurer","TextMeasurer","isVertical","getMaxStrWidth","strs","str","getMultilineMaxStrWidth","axisCaptionsWidthByRows","axisCaptionsWidthByColumns","xTail","yTail","facetRows","getFacetRows","facetColumns","getFacetColumns","getSizeWithPositionCenter","columnOrRowKeys","keys","facetKey","axisKey","CAPTION_LINE_HEIGHT","getSizeWithPosition45deg","key","labels","ticksWidth","getSizeWithPosition90deg","getTail","first","sc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AN,GAAyB,4BAAAC,GAA4B,OAAAC,GAAO,OAAAC,EAAA;AACxE;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splitTextByWidth.d.ts","sourceRoot":"","sources":["../../src/utils/splitTextByWidth.ts"],"names":[],"mappings":"AAmDA,wBAAgB,gBAAgB,CAAE,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YA0ChF"}
@@ -1,4 +1,4 @@
1
- import { TextMeasurer as f } from "../../utils/TextMeasurer/TextMeasurer.js";
1
+ import { TextMeasurer as f } from "./TextMeasurer/TextMeasurer.js";
2
2
  function x(o, l, h, u = 14) {
3
3
  const i = new f(`600 ${u}px Manrope`), n = [];
4
4
  o.split(new RegExp("(?=[_-])|(?<=[_-])")).forEach((r) => {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splitTextByWidth.js","sources":["../../src/utils/splitTextByWidth.ts"],"sourcesContent":["import { TextMeasurer } from './TextMeasurer/TextMeasurer';\n\nfunction splitWord(word:string, startLineLength:number, maxLength:number, fontSize = 14) {\n const textMeasurer = new TextMeasurer(`600 ${fontSize}px Manrope`);\n // \"_\" and \"-\" symbols have priority as separation bounds, if this is not enough split by single symbols\n const parts:string[] = [];\n word\n .split(/(?=[_-])|(?<=[_-])/)\n .forEach((part) => {\n const length = textMeasurer.getTextWidth(part);\n if (length > maxLength) {\n parts.push(...part.split(''));\n } else {\n parts.push(part);\n }\n });\n let currentLine = '';\n let currentLineLength = 0;\n let i = 0;\n let firstPart = '';\n while (currentLineLength <= startLineLength) {\n const nextLength = textMeasurer.getTextWidth(currentLine + parts[i]);\n if (nextLength < startLineLength) {\n currentLine += parts[i];\n firstPart = currentLine;\n i++;\n }\n currentLineLength = nextLength;\n }\n currentLine = '';\n currentLineLength = 0;\n const lines:string[] = [];\n for (i; i < parts.length; i++) {\n const nextLength = textMeasurer.getTextWidth(currentLine + parts[i]);\n if (nextLength < maxLength) {\n currentLine += parts[i];\n currentLineLength = nextLength;\n } else {\n lines.push(currentLine);\n currentLine = parts[i];\n currentLineLength = textMeasurer.getTextWidth(parts[i]);\n }\n }\n return {\n firstPart,\n lines,\n lastPart: currentLine,\n lastPartLength: currentLineLength\n };\n}\n\nexport function splitTextByWidth (text:string, maxWidth: number, fontSize: number) {\n const textMeasurer = new TextMeasurer(`600 ${fontSize}px Manrope`);\n if (text.trim() === '') {\n return [];\n }\n if (textMeasurer.getTextWidth(text) <= maxWidth) {\n return [text];\n }\n const words = text.split(/\\s+/);\n const result:string[] = [];\n let currentLine = '';\n let currentLineLength = 0;\n for (let i = 0; i < words.length; i++) {\n const tempLine = `${currentLine} ${words[i]}`;\n const tempLineLength = textMeasurer.getTextWidth(tempLine);\n if (tempLineLength <= maxWidth) {\n currentLine = tempLine;\n currentLineLength = tempLineLength;\n } else {\n const wordLength = textMeasurer.getTextWidth(words[i]);\n if (wordLength > maxWidth) {\n const {\n firstPart,\n lines,\n lastPart,\n lastPartLength\n } = splitWord(words[i], maxWidth - currentLineLength, maxWidth, fontSize);\n result.push(`${currentLine} ${firstPart}`);\n result.push(...lines);\n currentLine = lastPart;\n currentLineLength = lastPartLength;\n } else {\n result.push(currentLine);\n currentLine = words[i];\n currentLineLength = wordLength;\n }\n }\n }\n result.push(currentLine);\n return result.filter((line) => {\n return line.length > 0;\n });\n}\n"],"names":["splitWord","word","startLineLength","maxLength","fontSize","textMeasurer","TextMeasurer","parts","part","currentLine","currentLineLength","i","firstPart","nextLength","lines","splitTextByWidth","text","maxWidth","words","result","tempLine","tempLineLength","wordLength","lastPart","lastPartLength","line"],"mappings":";AAEA,SAASA,EAAUC,GAAaC,GAAwBC,GAAkBC,IAAW,IAAI;AACrF,QAAMC,IAAe,IAAIC,EAAa,OAAOF,CAAQ,YAAY,GAE3DG,IAAiB,CAAA;AACvB,EAAAN,EACK,MAAM,WAAA,oBAAoB,GAC1B,QAAQ,CAACO,MAAS;AAEf,IADeH,EAAa,aAAaG,CAAI,IAChCL,IACTI,EA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,QAAIC,KAAkBJ;AAClB,MAAAR,IAAcW,GACdV,IAAoBW;AAAA,SACjB;AACH,YAAMC,IAAajB,EAAa,aAAaa,EAAMP,CAAC,CAAC;AACrD,UAAIW,IAAaL,GAAU;AACvB,cAAM;AAAA,UACF,WAAAL;AAAA,UACA,OAAAE;AAAA,UACA,UAAAS;AAAA,UACA,gBAAAC;AAAA,QAAA,IACAxB,EAAUkB,EAAMP,CAAC,GAAGM,IAAWP,GAAmBO,GAAUb,CAAQ;AACxE,QAAAe,EAAO,KAAK,GAAGV,CAAW,IAAIG,CAAS,EAAE,GACzCO,EAAO,KAAK,GAAGL,CAAK,GACpBL,IAAcc,GACdb,IAAoBc;AAAA,MACxB;AACI,QAAAL,EAAO,KAAKV,CAAW,GACvBA,IAAcS,EAAMP,CAAC,GACrBD,IAAoBY;AAAA,IAE5B;AAAA,EACJ;AACA,SAAAH,EAAO,KAAKV,CAAW,GAChBU,EAAO,OAAO,CAACM,MACXA,EAAK,SAAS,CACxB;AACL;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/miplots4",
3
- "version": "1.0.133",
3
+ "version": "1.0.135",
4
4
  "description": "Data visualization library",
5
5
  "author": "erohinaelena",
6
6
  "license": "ISC",
@@ -1 +0,0 @@
1
- {"version":3,"file":"BandAxis.d.ts","sourceRoot":"","sources":["../../../src/discrete/components/BandAxis.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAExC,KAAK,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAC/B,KAAK,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AA0ChC,eAAO,MAAM,QAAQ,GAAI,2EAQtB;IACC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;CACjD,4CA0DA,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BandAxis.js","sources":["../../../src/discrete/components/BandAxis.tsx"],"sourcesContent":["import {BLACK} from '../../constants';\nimport {TICK_OFFSET} from '../constants';\nimport React from 'react';\nimport type {ScaleBand} from 'd3-scale';\n\ntype Scale = ScaleBand<string>;\ntype Orient = 'left' | 'bottom';\n\nfunction translateX(x: number) {\n return `translate(${x},0)`;\n}\n\nfunction translateY(y: number) {\n return `translate(0,${y})`;\n}\n\ntype LabelsPosition = 'center' | '45deg' | '90deg';\n\nconst FONT_HEIGHT = 21;\nfunction getRotationTransform(labelsPosition: LabelsPosition, orient: 'left' | 'bottom') {\n if (labelsPosition === '45deg') {\n const x = orient === 'left' ? -FONT_HEIGHT / 2 : 0;\n const y = orient === 'bottom' ? FONT_HEIGHT / 2 : -FONT_HEIGHT / 2;\n return `translate(${x},${y}) rotate(-45)`;\n }\n if (labelsPosition === '90deg' && orient === 'bottom') {\n return `translate(${-FONT_HEIGHT / 2},${TICK_OFFSET + FONT_HEIGHT / 2}) rotate(-90)`;\n }\n return orient === 'bottom' ? `translate(0,${TICK_OFFSET})` : `translate(${-TICK_OFFSET},0)`;\n}\n\nfunction getDominantBaseline(labelsPosition: LabelsPosition, orient: 'left' | 'bottom') {\n if (orient === 'left' || (orient === 'bottom' && labelsPosition === '90deg')) {\n return 'central';\n }\n if (labelsPosition === 'center') {\n return 'hanging';\n }\n return 'auto';\n}\n\nfunction getTextAnchor(labelsPosition: LabelsPosition, orient: 'left' | 'bottom') {\n if (orient === 'left' || (orient === 'bottom' && labelsPosition !== 'center')) {\n return 'end';\n }\n return 'middle';\n}\n\nexport const BandAxis = ({\n scale,\n tickSize = 6,\n tickPadding = TICK_OFFSET,\n orient = 'bottom',\n labelsPosition = 'center',\n labels = {},\n offset = typeof window !== 'undefined' && window.devicePixelRatio > 1 ? 0 : 0.5,\n}: {\n scale: Scale;\n tickSize?: number;\n tickPadding?: number;\n offset?: number;\n orient?: Orient;\n labels?: Record<string, string[]>;\n labelsPosition?: 'center' | '45deg' | '90deg';\n}) => {\n function center(scale: Scale, offset: number) {\n if (scale.bandwidth) {\n offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;\n }\n if (scale?.round()) {\n offset = Math.round(offset);\n }\n return (d: string) => {\n const value = scale(d);\n return value === undefined ? 0 : value + offset;\n };\n }\n\n const values = scale.domain();\n const getLabel = (tick: string) => labels[tick] ?? [];\n const spacing = Math.max(tickSize, 0) + tickPadding;\n const position = center(scale.copy(), offset);\n\n const transform = orient === 'bottom' ? translateX : translateY;\n const k = orient === 'left' ? -1 : 1;\n\n const lineProps = {\n [(orient === 'left' ? 'x' : 'y') + '2']: k * tickSize,\n };\n\n const textProps = {\n [orient === 'left' ? 'x' : 'y']: k * spacing,\n };\n\n return (\n <g>\n {values.map((tick: string, i: number) => (\n <g className=\"tick\" key={i} transform={transform(position(tick) + offset)}>\n <line stroke={BLACK} {...lineProps} />\n <g transform={getRotationTransform(labelsPosition, orient)}>\n {getLabel(tick).map((line, idx) => {\n return (\n <text\n key={`${line}_${idx}`}\n fill={BLACK}\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n dominantBaseline={getDominantBaseline(labelsPosition, orient)}\n textAnchor={getTextAnchor(labelsPosition, orient)}\n dy={20 * idx}\n {...textProps}\n >\n {line}\n </text>\n );\n })}\n </g>\n </g>\n ))}\n </g>\n );\n};\n"],"names":["translateX","x","translateY","y","FONT_HEIGHT","getRotationTransform","labelsPosition","orient","TICK_OFFSET","getDominantBaseline","getTextAnchor","BandAxis","scale","tickSize","tickPadding","labels","offset","center","d","value","values","getLabel","tick","spacing","position","transform","k","lineProps","textProps","i","jsxs","js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EAAA,KApBqBL,CAqBzB,CACH,GACL;AAER;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"splitTextByWidth.d.ts","sourceRoot":"","sources":["../../../src/discrete/utils/splitTextByWidth.ts"],"names":[],"mappings":"AAmDA,wBAAgB,gBAAgB,CAAE,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YA0ChF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"splitTextByWidth.js","sources":["../../../src/discrete/utils/splitTextByWidth.ts"],"sourcesContent":["import { TextMeasurer } from '../../utils/TextMeasurer/TextMeasurer';\n\nfunction splitWord(word:string, startLineLength:number, maxLength:number, fontSize = 14) {\n const textMeasurer = new TextMeasurer(`600 ${fontSize}px Manrope`);\n // \"_\" and \"-\" symbols have priority as separation bounds, if this is not enough split by single symbols\n const parts:string[] = [];\n word\n .split(/(?=[_-])|(?<=[_-])/)\n .forEach((part) => {\n const length = textMeasurer.getTextWidth(part);\n if (length > maxLength) {\n parts.push(...part.split(''));\n } else {\n parts.push(part);\n }\n });\n let currentLine = '';\n let currentLineLength = 0;\n let i = 0;\n let firstPart = '';\n while (currentLineLength <= startLineLength) {\n const nextLength = textMeasurer.getTextWidth(currentLine + parts[i]);\n if (nextLength < startLineLength) {\n currentLine += parts[i];\n firstPart = currentLine;\n i++;\n }\n currentLineLength = nextLength;\n }\n currentLine = '';\n currentLineLength = 0;\n const lines:string[] = [];\n for (i; i < parts.length; i++) {\n const nextLength = textMeasurer.getTextWidth(currentLine + parts[i]);\n if (nextLength < maxLength) {\n currentLine += parts[i];\n currentLineLength = nextLength;\n } else {\n lines.push(currentLine);\n currentLine = parts[i];\n currentLineLength = textMeasurer.getTextWidth(parts[i]);\n }\n }\n return {\n firstPart,\n lines,\n lastPart: currentLine,\n lastPartLength: currentLineLength\n };\n}\n\nexport function splitTextByWidth (text:string, maxWidth: number, fontSize: number) {\n const textMeasurer = new TextMeasurer(`600 ${fontSize}px Manrope`);\n if (text.trim() === '') {\n return [];\n }\n if (textMeasurer.getTextWidth(text) <= maxWidth) {\n return [text];\n }\n const words = text.split(/\\s+/);\n const result:string[] = [];\n let currentLine = '';\n let currentLineLength = 0;\n for (let i = 0; i < words.length; i++) {\n const tempLine = `${currentLine} ${words[i]}`;\n const tempLineLength = textMeasurer.getTextWidth(tempLine);\n if (tempLineLength <= maxWidth) {\n currentLine = tempLine;\n currentLineLength = tempLineLength;\n } else {\n const wordLength = textMeasurer.getTextWidth(words[i]);\n if (wordLength > maxWidth) {\n const {\n firstPart,\n lines,\n lastPart,\n lastPartLength\n } = splitWord(words[i], maxWidth - currentLineLength, maxWidth, fontSize);\n result.push(`${currentLine} ${firstPart}`);\n result.push(...lines);\n currentLine = lastPart;\n currentLineLength = lastPartLength;\n } else {\n result.push(currentLine);\n currentLine = words[i];\n currentLineLength = wordLength;\n }\n }\n }\n result.push(currentLine);\n return result.filter((line) => {\n return line.length > 0;\n });\n}\n"],"names":["splitWord","word","startLineLength","maxLength","fontSize","textMeasurer","TextMeasurer","parts","part","currentLine","currentLineLength","i","firstPart","nextLength","lines","splitTextByWidth","text","maxWidth","words","result","tempLine","tempLineLength","wordLength","lastPart","lastPartLength","line"],"mappings":";AAEA,SAASA,EAAUC,GAAaC,GAAwBC,GAAkBC,IAAW,IAAI;AACrF,QAAMC,IAAe,IAAIC,EAAa,OAAOF,CAAQ,YAAY,GAE3DG,IAAiB,CAAA;AACvB,EAAAN,EACK,MAAM,WAAA,oBAAoB,GAC1B,QAAQ,CAACO,MAAS;AAEf,IADeH,EAAa,aAAaG,CAAI,IAChCL,IACTI,EAAM,KAAK,GAAGC,EAAK,MAAM,EAAE,CAAC,IAE5BD,EAAM,KAAKC,CAAI;AAAA,EAEvB,CAAC;AACL,MAAIC,IAAc,IACdC,IAAoB,GACpBC,IAAI,GACJC,IAAY;AAChB,SAAOF,KAAqBR,KAAiB;AACzC,UAAMW,IAAaR,EAAa,aAAaI,IAAcF,EAAMI,CAAC,CAAC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A,QAAA,IACAxB,EAAUkB,EAAMP,CAAC,GAAGM,IAAWP,GAAmBO,GAAUb,CAAQ;AACxE,QAAAe,EAAO,KAAK,GAAGV,CAAW,IAAIG,CAAS,EAAE,GACzCO,EAAO,KAAK,GAAGL,CAAK,GACpBL,IAAcc,GACdb,IAAoBc;AAAA,MACxB;AACI,QAAAL,EAAO,KAAKV,CAAW,GACvBA,IAAcS,EAAMP,CAAC,GACrBD,IAAoBY;AAAA,IAE5B;AAAA,EACJ;AACA,SAAAH,EAAO,KAAKV,CAAW,GAChBU,EAAO,OAAO,CAACM,MACXA,EAAK,SAAS,CACxB;AACL;"}
@@ -1,13 +0,0 @@
1
- import { ScaleLinear, ScaleLogarithmic } from 'd3-scale';
2
- type Scale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>;
3
- type Orient = 'left' | 'bottom';
4
- export declare const Axis: ({ scale, tickSize, tickPadding, orient, onlyPositive, offset, }: {
5
- scale: Scale;
6
- tickSize?: number;
7
- tickPadding?: number;
8
- offset?: number;
9
- orient?: Orient;
10
- onlyPositive?: boolean;
11
- }) => import("react/jsx-runtime").JSX.Element;
12
- export {};
13
- //# sourceMappingURL=Axis.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Axis.d.ts","sourceRoot":"","sources":["../../../src/scatterplot/components/Axis.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAE5D,KAAK,KAAK,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC5E,KAAK,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAsBhC,eAAO,MAAM,IAAI,GAAI,iEAOlB;IACC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,4CA4CA,CAAC"}
@@ -1,59 +0,0 @@
1
- import { j as o } from "../../node_modules/react/jsx-runtime.js";
2
- import { BLACK as l } from "../../constants.js";
3
- import { TICK_OFFSET as s } from "../../discrete/constants.js";
4
- import { getTicksAndFormat as A } from "../utils/getTicksAndFormat.js";
5
- function T(t) {
6
- return `translate(${t},0)`;
7
- }
8
- function v(t) {
9
- return `translate(0,${t})`;
10
- }
11
- function w(t) {
12
- return t === "bottom" ? `translate(0,${s})` : `translate(${-s},0)`;
13
- }
14
- function F(t) {
15
- return t === "bottom" ? "hanging" : "central";
16
- }
17
- function $(t) {
18
- return t === "bottom" ? "middle" : "end";
19
- }
20
- const C = ({
21
- scale: t,
22
- tickSize: a = 6,
23
- tickPadding: c = s,
24
- orient: n = "bottom",
25
- onlyPositive: f = !1,
26
- offset: u = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5
27
- }) => {
28
- function x(r) {
29
- return (e) => {
30
- const m = r(e);
31
- return m === void 0 ? 0 : +m;
32
- };
33
- }
34
- const { ticks: d, format: p } = A(t, f, n === "bottom"), g = Math.max(a, 0) + c, h = x(t.copy()), b = n === "bottom" ? T : v, i = n === "left" ? -1 : 1, j = {
35
- [(n === "left" ? "x" : "y") + "2"]: i * a
36
- }, y = {
37
- [n === "left" ? "x" : "y"]: i * g
38
- };
39
- return /* @__PURE__ */ o.jsx("g", { children: d.map((r, e) => /* @__PURE__ */ o.jsxs("g", { className: "tick", transform: b(h(r) + u), children: [
40
- /* @__PURE__ */ o.jsx("line", { stroke: l, ...j }),
41
- /* @__PURE__ */ o.jsx("g", { transform: w(n), children: /* @__PURE__ */ o.jsx(
42
- "text",
43
- {
44
- fill: l,
45
- fontSize: "14px",
46
- fontWeight: "500",
47
- fontFamily: "Manrope",
48
- dominantBaseline: F(n),
49
- textAnchor: $(n),
50
- ...y,
51
- children: p(r)
52
- }
53
- ) })
54
- ] }, e)) });
55
- };
56
- export {
57
- C as Axis
58
- };
59
- //# sourceMappingURL=Axis.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Axis.js","sources":["../../../src/scatterplot/components/Axis.tsx"],"sourcesContent":["import {BLACK} from '../../constants';\nimport {TICK_OFFSET} from '../../discrete/constants';\nimport {getTicksAndFormat} from '../utils/getTicksAndFormat';\nimport React from 'react';\nimport type {ScaleLinear, ScaleLogarithmic} from 'd3-scale';\n\ntype Scale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>;\ntype Orient = 'left' | 'bottom';\n\nfunction translateX(x: number) {\n return `translate(${x},0)`;\n}\n\nfunction translateY(y: number) {\n return `translate(0,${y})`;\n}\n\nfunction getRotationTransform(orient: 'left' | 'bottom') {\n return orient === 'bottom' ? `translate(0,${TICK_OFFSET})` : `translate(${-TICK_OFFSET},0)`;\n}\n\nfunction getDominantBaseline(orient: 'left' | 'bottom') {\n return orient === 'bottom' ? 'hanging' : 'central';\n}\n\nfunction getTextAnchor( orient: 'left' | 'bottom') {\n return orient === 'bottom' ? 'middle' : 'end';\n}\n\nexport const Axis = ({\n scale,\n tickSize = 6,\n tickPadding = TICK_OFFSET,\n orient = 'bottom',\n onlyPositive = false,\n offset = typeof window !== 'undefined' && window.devicePixelRatio > 1 ? 0 : 0.5,\n}: {\n scale: Scale;\n tickSize?: number;\n tickPadding?: number;\n offset?: number;\n orient?: Orient;\n onlyPositive?: boolean;\n}) => {\n function number(scale: Scale) {\n return (d: number) => {\n const value = scale(d);\n return value === undefined ? 0 : +value;\n };\n }\n const {ticks: values, format} = getTicksAndFormat(scale, onlyPositive, orient === 'bottom');\n const spacing = Math.max(tickSize, 0) + tickPadding,\n position = (number)(scale.copy());\n\n const transform = orient === 'bottom' ? translateX : translateY;\n const k = orient === 'left' ? -1 : 1;\n\n const lineProps = {\n [(orient === 'left' ? 'x' : 'y') + '2']: k * tickSize,\n };\n\n const textProps = {\n [orient === 'left' ? 'x' : 'y']: k * spacing,\n };\n\n return (\n <g>\n {values.map((tick: number, i: number) => (\n <g className=\"tick\" key={i} transform={transform(position(tick) + offset)}>\n <line stroke={BLACK} {...lineProps} />\n <g transform={getRotationTransform(orient)}>\n <text\n fill={BLACK}\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n dominantBaseline={getDominantBaseline(orient)}\n textAnchor={getTextAnchor(orient)}\n {...textProps}\n >\n {format(tick)}\n </text>\n </g>\n </g>\n ))}\n </g>\n );\n};\n"],"names":["translateX","x","translateY","y","getRotationTransform","orient","TICK_OFFSET","getDominantBaseline","getTextAnchor","Axis","scale","tickSize","tickPadding","onlyPositive","offset","number","d","value","values","format","getTicksAndFormat","spacing","position","transform","k","lineProps","textProps","tick","i","jsxs","jsx","BLACK"],"mappings":";;;;AASA,SAASA,EAAWC,GAAW;AAC3B,SAAO,aAAaA,CAAC;AACzB;AAEA,SAASC,EAAWC,GAAW;AAC3B,SAAO,eAAeA,CAAC;AAC3B;AAEA,SAASC,EAAqBC,GAA2B;AACrD,SAAOA,MAAW,WAAW,eAAeC,CAAW,MAAM,aAAa,CAACA,CAAW;AAC1F;AAEA,SAASC,EAAoBF,GAA2B;AACpD,SAAOA,MAAW,WAAW,YAAY;AAC7C;AAEA,SAASG,EAAeH,GAA2B;AAC/C,SAAQA,MAAW,WAAW,WAAW;AAC7C;AAEO,MAAMI,IAAO,CAAC;AAAA,EAClB,OAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,aAAAC,IAAcN;AAAA,EACd,QAAAD,IAAS;AAAA,EACT,cAAAQ,IAAe;AAAA,EACf,QAAAC,IAAS,OAAO,SAAW,OAAe,OAAO,mBAAmB,IAAI,IAAI;AAC/E,MAOM;AACF,WAASC,EAAOL,GAAc;AAC1B,WAAO,CAACM,MAAc;AAClB,YAAMC,IAAQP,EAAMM,CAAC;AACrB,aAAOC,MAAU,SAAY,IAAI,CAACA;AAAA,IACtC;AAAA,E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