@milaboratories/graph-maker 1.1.173 → 1.1.175

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 (26) hide show
  1. package/dist/GraphMaker/components/LassoControls/index.vue.js +3 -2
  2. package/dist/GraphMaker/components/LassoControls/index.vue.js.map +1 -1
  3. package/dist/GraphMaker/index.vue.d.ts.map +1 -1
  4. package/dist/GraphMaker/index.vue.js +139 -133
  5. package/dist/GraphMaker/index.vue.js.map +1 -1
  6. package/dist/GraphMaker/store.d.ts +1 -0
  7. package/dist/GraphMaker/store.d.ts.map +1 -1
  8. package/dist/GraphMaker/store.js +30 -29
  9. package/dist/GraphMaker/store.js.map +1 -1
  10. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +4 -4
  11. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +214 -214
  12. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
  13. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getClusters.js +20 -163
  14. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getClusters.js.map +1 -1
  15. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getDendrograms.js +47 -35
  16. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getDendrograms.js.map +1 -1
  17. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +82 -79
  18. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
  19. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/comlink/dist/esm/comlink.js +259 -0
  20. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/comlink/dist/esm/comlink.js.map +1 -0
  21. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js +52 -50
  22. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  23. package/dist/node_modules/@milaboratories/miplots4/dist/types/common.js.map +1 -1
  24. package/dist/node_modules/@milaboratories/miplots4/dist/utils/WorkerFactory.js +14 -0
  25. package/dist/node_modules/@milaboratories/miplots4/dist/utils/WorkerFactory.js.map +1 -0
  26. package/package.json +2 -2
@@ -1,110 +1,110 @@
1
- import { j as $ } from "../node_modules/react/jsx-runtime.js";
2
- import it from "../node_modules/lodash/lodash.js";
3
- import { createRoot as ot } from "../node_modules/react-dom/client.js";
1
+ import { j as O } from "../node_modules/react/jsx-runtime.js";
2
+ import ot from "../node_modules/lodash/lodash.js";
3
+ import { createRoot as it } from "../node_modules/react-dom/client.js";
4
4
  import { Error as at } from "../common/Error.js";
5
5
  import { DataFrameProvider as rt } from "../common/useDataFrame.js";
6
- import { TITLE_LINE_HEIGHT as nt, TITLE_MARGIN as lt, DEFAULT_HEIGHT as X, DEFAULT_WIDTH as Y } from "../constants.js";
6
+ import { TITLE_LINE_HEIGHT as nt, TITLE_MARGIN as lt, DEFAULT_HEIGHT as U, DEFAULT_WIDTH as Y } from "../constants.js";
7
7
  import { arrangeLegendParts as ht } from "../utils/arrangeLegendParts.js";
8
8
  import { getChartEdgeSides as ct } from "../utils/getChartEdgeSides.js";
9
9
  import { getContinuousLegendTicks as q } from "../utils/getContinuousLegendTicks.js";
10
10
  import { TextMeasurer as ut } from "../utils/TextMeasurer/TextMeasurer.js";
11
11
  import { ChartsGroup as dt } from "./components/ChartsGroup.js";
12
- import { LEGEND_OFFSET as pt, DEFAULT_AES as Q, CHART_SIDE_ELEMENTS as mt, TITLE_LINE as J, MIN_MARGIN as j } from "./constants.js";
12
+ import { LEGEND_OFFSET as pt, DEFAULT_AES as Q, CHART_SIDE_ELEMENTS as mt, TITLE_LINE as J, MIN_MARGIN as $ } from "./constants.js";
13
13
  import { calculateChartSideElementSizes as gt } from "./utils/calculateChartSideElementSizes.js";
14
14
  import { calculateSideElementsBBoxes as ft } from "./utils/calculateSideElementsBBoxes.js";
15
- import { createDiscreteColorScale as yt, createDiscreteRoundColorScale as St, createContinuousColorScale as xt } from "./utils/createColorScales.js";
15
+ import { createDiscreteColorScale as yt, createDiscreteRoundColorScale as xt, createContinuousColorScale as St } from "./utils/createColorScales.js";
16
16
  import { calculateAnnotationTitleSizes as Ct } from "./utils/calculateAnnotationTitleSizes.js";
17
17
  import { calculateCaptionTails as bt } from "./utils/calculateCaptionTails.js";
18
18
  import W from "../node_modules/d3-scale/src/ordinal.js";
19
19
  import N from "../node_modules/d3-scale/src/linear.js";
20
20
  import At from "../node_modules/d3-array/src/extent.js";
21
21
  import Z from "../node_modules/d3-hierarchy/src/cluster.js";
22
- var Gt = Object.defineProperty, zt = (m, s, e) => s in m ? Gt(m, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[s] = e, A = (m, s, e) => zt(m, typeof s != "symbol" ? s + "" : s, e);
23
- const Lt = Math.cos(Math.PI / 4), Tt = 5;
22
+ var Gt = Object.defineProperty, zt = (m, s, e) => s in m ? Gt(m, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[s] = e, b = (m, s, e) => zt(m, typeof s != "symbol" ? s + "" : s, e);
23
+ const Et = Math.cos(Math.PI / 4), vt = 5;
24
24
  function tt(m, s, e) {
25
- function t(r) {
26
- r[e] = s(r.data.height), r.children && r.children.forEach(t);
25
+ function t(a) {
26
+ a[e] = s(a.data.height), a.children && a.children.forEach(t);
27
27
  }
28
28
  t(m);
29
29
  }
30
30
  function et(m, s, e, t = e) {
31
- function r(o) {
32
- o[t] = o[e] + s, o.children && o.children.forEach(r);
31
+ function a(i) {
32
+ i[t] = i[e] + s, i.children && i.children.forEach(a);
33
33
  }
34
- r(m);
34
+ a(m);
35
35
  }
36
- const Et = (m, s) => {
36
+ const Lt = (m, s) => {
37
37
  const e = Math.min(...s), t = Math.max(...s);
38
38
  if (e === t) {
39
- const n = m % 2 === 0 ? [] : [e];
40
- for (let l = 1; l < m / 2 + 1; l++)
41
- n.push(e + l), n.unshift(e - l);
42
- return n;
39
+ const r = m % 2 === 0 ? [] : [e];
40
+ for (let n = 1; n < m / 2 + 1; n++)
41
+ r.push(e + n), r.unshift(e - n);
42
+ return r;
43
43
  }
44
44
  if (m < 2)
45
45
  return [e, t];
46
- const r = (t - e) / (m - 1), o = [];
47
- for (let n = 0; n < m - 1; n++)
48
- o.push(e + r * n);
49
- return o.push(t), o;
46
+ const a = (t - e) / (m - 1), i = [];
47
+ for (let r = 0; r < m - 1; r++)
48
+ i.push(e + a * r);
49
+ return i.push(t), i;
50
50
  };
51
51
  function st(m, s, e) {
52
52
  let t = e;
53
- return m && (m.colorRange && (t = m.colorRange), m.method === "standardScaling" && (t = [-2, 2]), m.method === "meanNormalization" && (t = [-0.75, 0.75])), Et(s, t);
53
+ return m && (m.colorRange && (t = m.colorRange), m.method === "standardScaling" && (t = [-2, 2]), m.method === "meanNormalization" && (t = [-0.75, 0.75])), Lt(s, t);
54
54
  }
55
55
  function k(m, s, e) {
56
56
  let t = 0;
57
- for (const r of m) {
58
- if (s[r] === void 0) continue;
59
- const o = e.getTextWidth(s[r]);
60
- o > t && (t = o);
57
+ for (const a of m) {
58
+ if (s[a] === void 0) continue;
59
+ const i = e.getTextWidth(s[a]);
60
+ i > t && (t = i);
61
61
  }
62
62
  return t;
63
63
  }
64
64
  function F(m, s) {
65
- return s === 90 ? m : s === 45 ? m * Lt + (m > 0 ? 2 * Tt : 0) : J;
65
+ return s === 90 ? m : s === 45 ? m * Et + (m > 0 ? 2 * vt : 0) : J;
66
66
  }
67
- class Ut {
67
+ class Jt {
68
68
  constructor() {
69
- A(this, "reactRoot", null), A(this, "parentNode", null), A(this, "rootNode", null), A(this, "component", /* @__PURE__ */ $.jsx($.Fragment, {})), A(this, "chartsDimensions", {}), A(this, "chartSizes", {
69
+ b(this, "reactRoot", null), b(this, "parentNode", null), b(this, "rootNode", null), b(this, "component", /* @__PURE__ */ O.jsx(O.Fragment, {})), b(this, "chartsDimensions", {}), b(this, "chartSizes", {
70
70
  chartWidth: Y,
71
71
  // width of single chart
72
- chartHeight: X,
72
+ chartHeight: U,
73
73
  // height of single chart
74
74
  chartsWidth: Y,
75
75
  // width of all charts in charts row
76
- chartsHeight: X,
76
+ chartsHeight: U,
77
77
  // width of all charts in charts column, without axes
78
78
  totalWidth: Y,
79
79
  // width of all charts in charts row, plus left axis, plus legend
80
- totalHeight: X
80
+ totalHeight: U
81
81
  // width of all charts in charts height, plus bottom axis, plus top title
82
- }), A(this, "margins", {
83
- top: j,
84
- bottom: j,
85
- left: j,
86
- right: j
87
- }), A(this, "captionsSizes", {
82
+ }), b(this, "margins", {
83
+ top: $,
84
+ bottom: $,
85
+ left: $,
86
+ right: $
87
+ }), b(this, "captionsSizes", {
88
88
  xAxisCaptions: 100,
89
89
  yAxisCaptions: 100,
90
90
  xGroupCaptions: J,
91
91
  yGroupCaptions: J,
92
92
  xCaptionTail: 0,
93
93
  yCaptionTail: 0
94
- }), A(this, "labelAngles", {
94
+ }), b(this, "labelAngles", {
95
95
  xAxisLabels: 0,
96
96
  yAxisLabels: 0,
97
97
  xGroupLabels: 0,
98
98
  yGroupLabels: 0
99
- }), A(this, "columnsCount", 1), A(this, "rowsCount", 1), A(this, "scales", {
99
+ }), b(this, "columnsCount", 1), b(this, "rowsCount", 1), b(this, "scales", {
100
100
  // scales grouped by facet
101
101
  x: { null: W().domain(["null"]).range([1]) },
102
102
  y: { null: W().domain(["null"]).range([1]) }
103
- }), A(this, "step", { x: {}, y: {} }), A(this, "colorScale", N().domain([0, 1]).range(["white", "black"])), A(this, "annotationColorScales", {}), A(this, "dendrogramAesScales", {}), A(this, "legend", {
103
+ }), b(this, "step", { x: {}, y: {} }), b(this, "colorScale", N().domain([0, 1]).range(["white", "black"])), b(this, "annotationColorScales", {}), b(this, "dendrogramAesScales", {}), b(this, "legend", {
104
104
  width: 0,
105
105
  height: 0,
106
106
  items: []
107
- }), A(this, "dendrograms", {});
107
+ }), b(this, "dendrograms", {});
108
108
  }
109
109
  clear() {
110
110
  var s;
@@ -114,7 +114,7 @@ class Ut {
114
114
  });
115
115
  }
116
116
  init(s) {
117
- this.parentNode === null && (this.parentNode = s, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = ot(this.rootNode));
117
+ this.parentNode === null && (this.parentNode = s, this.rootNode = document.createElement("div"), this.parentNode.appendChild(this.rootNode), this.reactRoot = it(this.rootNode));
118
118
  }
119
119
  updateMargins(s, e) {
120
120
  this.margins = {
@@ -124,222 +124,222 @@ class Ut {
124
124
  right: this.legend.width + e.outerOffset
125
125
  }, this.chartSizes.totalWidth = this.margins.left + this.chartSizes.chartsWidth + this.margins.right, this.chartSizes.totalHeight = this.margins.top + Math.max(this.chartSizes.chartsHeight + this.margins.bottom, this.legend.height);
126
126
  }
127
- updateLegendSize(s, e, t, r, o) {
127
+ updateLegendSize(s, e, t, a, i) {
128
128
  if (!e.show) {
129
129
  this.legend = { width: 0, height: 0, items: [] };
130
130
  return;
131
131
  }
132
- const n = this.chartSizes.chartHeight, l = [], u = { width: 0, height: 0, left: 0, top: 0 }, f = (c) => c.reduce((h, i) => (h[i] = String(i), h), {});
132
+ const r = this.chartSizes.chartHeight, n = [], d = { width: 0, height: 0, left: 0, top: 0 }, y = (l) => l.reduce((h, o) => (h[o] = String(o), h), {});
133
133
  if (s === "continuous") {
134
- const c = this.colorScale, h = q(c, o), i = N([h[0], h[h.length - 1]], [n, 0]), a = r.label ?? r.value;
135
- l.push({
136
- ...u,
134
+ const l = this.colorScale, h = q(l, i), o = N([h[0], h[h.length - 1]], [r, 0]), c = a.label ?? a.value;
135
+ n.push({
136
+ ...d,
137
137
  type: "continuous",
138
138
  id: "heatmapValue",
139
- scale: c,
139
+ scale: l,
140
140
  values: h,
141
- title: a,
142
- tickPositionScale: i
141
+ title: c,
142
+ tickPositionScale: o
143
143
  });
144
144
  } else if (s === "discrete") {
145
- const c = this.colorScale, h = r.label ?? r.value, i = c.domain(), a = f(i);
146
- l.push({ ...u, type: "discreteColor", id: "heatmapValue", title: h, scale: c, values: i, labels: a });
145
+ const l = this.colorScale, h = a.label ?? a.value, o = l.domain(), c = y(o);
146
+ n.push({ ...d, type: "discreteColor", id: "heatmapValue", title: h, scale: l, values: o, labels: c });
147
147
  }
148
- if (t.forEach((c) => {
149
- const h = c.valueColumn.label ?? c.valueColumn.value;
150
- if (c.type === "continuous") {
151
- const i = this.annotationColorScales[c.id].scale, a = q(i, o), y = N([a[0], a[a.length - 1]], [n, 0]);
152
- l.push({ ...u, type: "continuous", id: c.id, tickPositionScale: y, title: h, scale: i, values: a });
148
+ if (t.forEach((l) => {
149
+ const h = l.valueColumn.label ?? l.valueColumn.value;
150
+ if (l.type === "continuous") {
151
+ const o = this.annotationColorScales[l.id].scale, c = q(o, i), f = N([c[0], c[c.length - 1]], [r, 0]);
152
+ n.push({ ...d, type: "continuous", id: l.id, tickPositionScale: f, title: h, scale: o, values: c });
153
153
  }
154
- if (c.type === "discrete") {
155
- const i = this.annotationColorScales[c.id].scale, a = i.domain(), y = f(a);
156
- l.push({ ...u, type: "discreteColor", id: c.id, title: h, scale: i, values: a, labels: y });
154
+ if (l.type === "discrete") {
155
+ const o = this.annotationColorScales[l.id].scale, c = o.domain(), f = y(c);
156
+ n.push({ ...d, type: "discreteColor", id: l.id, title: h, scale: o, values: c, labels: f });
157
157
  }
158
- }), !l.length) {
158
+ }), !n.length) {
159
159
  this.legend = { width: 0, height: 0, items: [] };
160
160
  return;
161
161
  }
162
- const d = ht(l, this.chartSizes.chartHeight), p = d[d.length - 1], L = p.left + p.width + pt;
162
+ const p = ht(n, this.chartSizes.chartHeight), u = p[p.length - 1], A = u.left + u.width + pt;
163
163
  this.legend = {
164
- width: L,
165
- height: n,
166
- items: d
164
+ width: A,
165
+ height: r,
166
+ items: p
167
167
  };
168
168
  }
169
- updateCaptionsSize(s, e, t, r) {
170
- const o = new ut("bold 16px Manrope"), { xGroupKeys: n, yGroupKeys: l, xGroupLabels: u, yGroupLabels: f, xKeysByGroups: d, yKeysByGroups: p, xLabels: L, yLabels: c } = s.meta;
169
+ updateCaptionsSize(s, e, t, a) {
170
+ const i = new ut("bold 16px Manrope"), { xGroupKeys: r, yGroupKeys: n, xGroupLabels: d, yGroupLabels: y, xKeysByGroups: p, yKeysByGroups: u, xLabels: A, yLabels: l } = s.meta;
171
171
  this.labelAngles = {
172
172
  xAxisLabels: e.axisLabelsAngle,
173
173
  yAxisLabels: t.axisLabelsAngle,
174
174
  xGroupLabels: e.groupLabelsAngle,
175
175
  yGroupLabels: t.groupLabelsAngle
176
176
  };
177
- const h = n.reduce((C, g) => Math.max(C, k(d[g], L, o)), 0), i = l.reduce((C, g) => Math.max(C, k(p[g], c, o)), 0), a = k(n, u, o), y = k(l, f, o), { xCaptionTail: x, yCaptionTail: E } = bt(
177
+ const h = r.reduce((S, g) => Math.max(S, k(p[g], A, i)), 0), o = n.reduce((S, g) => Math.max(S, k(u[g], l, i)), 0), c = k(r, d, i), f = k(n, y, i), { xCaptionTail: E, yCaptionTail: K } = bt(
178
178
  this.labelAngles,
179
- r,
179
+ a,
180
180
  this.scales,
181
181
  this.step,
182
182
  s,
183
- o
183
+ i
184
184
  );
185
185
  this.captionsSizes = {
186
- xCaptionTail: x,
187
- yCaptionTail: E,
188
- xGroupCaptions: F(a, this.labelAngles.xGroupLabels),
189
- yGroupCaptions: F(y, this.labelAngles.yGroupLabels),
186
+ xCaptionTail: E,
187
+ yCaptionTail: K,
188
+ xGroupCaptions: F(c, this.labelAngles.xGroupLabels),
189
+ yGroupCaptions: F(f, this.labelAngles.yGroupLabels),
190
190
  xAxisCaptions: F(h, this.labelAngles.xAxisLabels),
191
- yAxisCaptions: F(i, this.labelAngles.yAxisLabels)
191
+ yAxisCaptions: F(o, this.labelAngles.yAxisLabels)
192
192
  };
193
193
  }
194
- updateChartDimensions(s, e, t, r, o, n, l, u, f, d) {
195
- const p = e.length, L = Math.min(o.nRows ?? p, p), c = Math.min(o.nCols ?? p, p);
196
- this.columnsCount = o.nRows ? Math.ceil(p / L) : c, this.rowsCount = Math.ceil(p / this.columnsCount);
197
- const { sharedX: h, sharedY: i } = o;
194
+ updateChartDimensions(s, e, t, a, i, r, n, d, y, p) {
195
+ const u = e.length, A = Math.min(i.nRows ?? u, u), l = Math.min(i.nCols ?? u, u);
196
+ this.columnsCount = i.nRows ? Math.ceil(u / A) : l, this.rowsCount = Math.ceil(u / this.columnsCount);
197
+ const { sharedX: h, sharedY: o } = i;
198
198
  this.chartsDimensions = {};
199
- let a = 0, y = 0;
200
- e.forEach((C, g) => {
201
- const b = g % this.columnsCount + 1, S = ct(g, e.length, this.columnsCount, this.rowsCount), G = this.step.x[C], M = this.step.y[C], w = gt(
199
+ let c = 0, f = 0;
200
+ e.forEach((S, g) => {
201
+ const C = g % this.columnsCount + 1, x = ct(g, e.length, this.columnsCount, this.rowsCount), G = this.step.x[S], w = this.step.y[S], M = gt(
202
+ r,
202
203
  n,
203
- l,
204
204
  this.captionsSizes,
205
- u,
206
- f,
207
205
  d,
208
- S,
206
+ y,
207
+ p,
208
+ x,
209
209
  h,
210
- i,
210
+ o,
211
211
  e,
212
212
  t,
213
- r,
213
+ a,
214
214
  G,
215
- M
216
- ), D = Ct(u, S, h, i);
217
- function v(B) {
215
+ w
216
+ ), H = Ct(d, x, h, o);
217
+ function L(B) {
218
218
  return Math.max(
219
- mt[B].reduce((O, _) => O + w[B][_], 0),
220
- D[B],
219
+ mt[B].reduce((_, j) => _ + M[B][j], 0),
220
+ H[B],
221
221
  s.innerOffset
222
222
  );
223
223
  }
224
- const T = {
225
- left: v("left"),
226
- right: v("right"),
227
- top: v("top"),
228
- bottom: v("bottom")
224
+ const v = {
225
+ left: L("left"),
226
+ right: L("right"),
227
+ top: L("top"),
228
+ bottom: L("bottom")
229
229
  };
230
- T.left < this.captionsSizes.xCaptionTail && (T.left = this.captionsSizes.xCaptionTail), T.bottom < this.captionsSizes.yCaptionTail && (T.bottom = this.captionsSizes.yCaptionTail);
231
- const H = ft(w, this.chartSizes.chartWidth, this.chartSizes.chartHeight), R = this.chartSizes.chartWidth + T.left + T.right, I = this.chartSizes.chartHeight + T.top + T.bottom;
232
- this.chartsDimensions[C] = {
233
- left: a,
234
- top: y,
230
+ v.left < this.captionsSizes.xCaptionTail && (v.left = this.captionsSizes.xCaptionTail), v.bottom < this.captionsSizes.yCaptionTail && (v.bottom = this.captionsSizes.yCaptionTail);
231
+ const D = ft(M, this.chartSizes.chartWidth, this.chartSizes.chartHeight), R = this.chartSizes.chartWidth + v.left + v.right, I = this.chartSizes.chartHeight + v.top + v.bottom;
232
+ this.chartsDimensions[S] = {
233
+ left: c,
234
+ top: f,
235
235
  inner: { width: this.chartSizes.chartWidth, height: this.chartSizes.chartHeight },
236
236
  outer: { width: R, height: I },
237
- padding: T,
238
- sideElementBBoxes: H,
239
- chartEdgeSides: S
240
- }, a += R, b === this.columnsCount && (a = 0, y += I);
237
+ padding: v,
238
+ sideElementBBoxes: D,
239
+ chartEdgeSides: x
240
+ }, c += R, C === this.columnsCount && (c = 0, f += I);
241
241
  });
242
- const x = e.slice(0, this.columnsCount).reduce((C, g) => C + this.chartsDimensions[g].outer.width, 0), E = e.filter((C, g) => g % this.columnsCount === 0).reduce((C, g) => C + this.chartsDimensions[g].outer.height, 0);
243
- this.chartSizes.chartsWidth = x, this.chartSizes.chartsHeight = E;
242
+ const E = e.slice(0, this.columnsCount).reduce((S, g) => S + this.chartsDimensions[g].outer.width, 0), K = e.filter((S, g) => g % this.columnsCount === 0).reduce((S, g) => S + this.chartsDimensions[g].outer.height, 0);
243
+ this.chartSizes.chartsWidth = E, this.chartSizes.chartsHeight = K;
244
244
  }
245
- updateChartsSizes(s, e, t, r) {
246
- const { width: o, height: n, cellWidth: l, cellHeight: u } = s, f = t.meta.facetKeys[0];
247
- if (l && e.sharedX && f) {
248
- const d = t.facets[f].xKeys.length, p = t.meta.xGroupKeys.length;
249
- this.chartSizes.chartWidth = d * l + r * (p - 1);
245
+ updateChartsSizes(s, e, t, a) {
246
+ const { width: i, height: r, cellWidth: n, cellHeight: d } = s, y = t.meta.facetKeys[0];
247
+ if (n && e.sharedX && y) {
248
+ const p = t.facets[y].xKeys.length, u = t.meta.xGroupKeys.length;
249
+ this.chartSizes.chartWidth = p * n + a * (u - 1);
250
250
  } else
251
- this.chartSizes.chartWidth = o;
252
- if (u && e.sharedY && f) {
253
- const d = t.facets[f].yKeys.length, p = t.meta.yGroupKeys.length;
254
- this.chartSizes.chartHeight = d * u + r * (p - 1);
251
+ this.chartSizes.chartWidth = i;
252
+ if (d && e.sharedY && y) {
253
+ const p = t.facets[y].yKeys.length, u = t.meta.yGroupKeys.length;
254
+ this.chartSizes.chartHeight = p * d + a * (u - 1);
255
255
  } else
256
- this.chartSizes.chartHeight = n;
256
+ this.chartSizes.chartHeight = r;
257
257
  }
258
258
  // update scales for cell positions, x and y for each facet
259
- updateScales(s, e, t, r, o, n, l, u, f, d) {
260
- const { width: p, height: L, cellWidth: c, cellHeight: h } = o, { meta: i, facets: a } = e, { sharedX: y, sharedY: x } = r, E = (g, b = {}) => g.sort(
261
- (S, G) => n.sorting === "asc" ? (b[S] ?? S).localeCompare(b[G] ?? G, "en", { numeric: !0 }) : (b[G] ?? G).localeCompare(b[S] ?? S, "en", { numeric: !0 })
262
- ), C = (g, b = {}) => g.sort(
263
- (S, G) => l.sorting === "asc" ? (b[S] ?? S).localeCompare(b[G] ?? G, "en", { numeric: !0 }) : (b[G] ?? G).localeCompare(b[S] ?? S, "en", { numeric: !0 })
259
+ updateScales(s, e, t, a, i, r, n, d, y, p) {
260
+ const { width: u, height: A, cellWidth: l, cellHeight: h } = i, { meta: o, facets: c } = e, { sharedX: f, sharedY: E } = a, K = (g, C = {}) => g.sort(
261
+ (x, G) => r.sorting === "asc" ? (C[x] ?? x).localeCompare(C[G] ?? G, "en", { numeric: !0 }) : (C[G] ?? G).localeCompare(C[x] ?? x, "en", { numeric: !0 })
262
+ ), S = (g, C = {}) => g.sort(
263
+ (x, G) => n.sorting === "asc" ? (C[x] ?? x).localeCompare(C[G] ?? G, "en", { numeric: !0 }) : (C[G] ?? G).localeCompare(C[x] ?? x, "en", { numeric: !0 })
264
264
  );
265
265
  s.forEach((g) => {
266
- const b = a[g], S = d.xGroup ? i.xGroupKeys : E(i.xGroupKeys), G = d.yGroup ? i.yGroupKeys : C(i.yGroupKeys), { xKeysByGroups: M } = y ? i : b, { yKeysByGroups: w } = x ? i : b, D = S.map((z) => M[z].length), v = G.map((z) => w[z].length), T = D.reduce((z, K) => z + K, 0), H = v.reduce((z, K) => z + K, 0), R = y && c ? c : (p - (D.filter((z) => z > 0).length - 1) * t) / T, I = x && h ? h : (L - (v.filter((z) => z > 0).length - 1) * t) / H, B = [], O = [];
267
- let _ = 0;
268
- S.forEach((z) => {
269
- const K = u || d.x ? M[z] : E(M[z], i.xLabels);
270
- O.push(...K), K.forEach(() => {
271
- B.push(_), _ += R;
272
- }), K.length > 0 && (_ += t);
266
+ const C = c[g], x = p.xGroup ? o.xGroupKeys : K(o.xGroupKeys), G = p.yGroup ? o.yGroupKeys : S(o.yGroupKeys), { xKeysByGroups: w } = f ? o : C, { yKeysByGroups: M } = E ? o : C, H = x.map((z) => w[z].length), L = G.map((z) => M[z].length), v = H.reduce((z, T) => z + T, 0), D = L.reduce((z, T) => z + T, 0), R = f && l ? l : (u - (H.filter((z) => z > 0).length - 1) * t) / v, I = E && h ? h : (A - (L.filter((z) => z > 0).length - 1) * t) / D, B = [];
267
+ let _ = [], j = 0;
268
+ x.forEach((z) => {
269
+ const T = d || p.x ? w[z] : K(w[z], o.xLabels);
270
+ _ = _.concat(T), T.forEach(() => {
271
+ B.push(j), j += R;
272
+ }), T.length > 0 && (j += t);
273
273
  });
274
- const U = [], V = [];
275
- let P = 0;
274
+ const V = [];
275
+ let P = [], X = 0;
276
276
  G.forEach((z) => {
277
- const K = f || d.y ? w[z] : C(w[z], i.yLabels);
278
- V.push(...K), K.forEach(() => {
279
- U.push(P), P += I;
280
- }), K.length > 0 && (P += t);
281
- }), this.scales.x[g] = W().domain(O).range(B), this.scales.y[g] = W().domain(V).range(U), this.step.x[g] = R, this.step.y[g] = I;
277
+ const T = y || p.y ? M[z] : S(M[z], o.yLabels);
278
+ P = P.concat(T), T.forEach(() => {
279
+ V.push(X), X += I;
280
+ }), T.length > 0 && (X += t);
281
+ }), this.scales.x[g] = W().domain(_).range(B), this.scales.y[g] = W().domain(P).range(V), this.step.x[g] = R, this.step.y[g] = I;
282
282
  });
283
283
  }
284
- updateAesScale(s, e, t, r, o, n, l) {
284
+ updateAesScale(s, e, t, a, i, r, n) {
285
285
  if (s === "continuous")
286
- t.valueColors ? this.colorScale = N().domain(t.valuesByColors ?? st(l, t.valueColors.length, e)).range(t.valueColors) : t.colorsList && (this.colorScale = N().domain(st(l, t.colorsList.length, e)).range(t.colorsList));
286
+ t.valueColors ? this.colorScale = N().domain(t.valuesByColors ?? st(n, t.valueColors.length, e)).range(t.valueColors) : t.colorsList && (this.colorScale = N().domain(st(n, t.colorsList.length, e)).range(t.colorsList));
287
287
  else if (t.colorsMap) {
288
- const d = Object.entries(t.colorsMap);
289
- this.colorScale = W().domain(d.map((p) => p[0])).range(d.map((p) => p[1])).unknown("#ccc");
290
- } else t.colorsList && (this.colorScale = yt(t.colorsList, n.map(String)));
291
- const { xDataByKeys: u, yDataByKeys: f } = o.meta;
292
- r.forEach((d) => {
293
- const { colors: p, type: L, axis: c, valueColumn: h } = d, i = (c === "x" ? u : f)[h.valueLabels ?? h.value];
294
- if (L === "discrete") {
295
- const a = it.uniq(Object.values(i).map(String)).sort();
296
- this.annotationColorScales[d.id] = {
288
+ const p = Object.entries(t.colorsMap);
289
+ this.colorScale = W().domain(p.map((u) => u[0])).range(p.map((u) => u[1])).unknown("#ccc");
290
+ } else t.colorsList && (this.colorScale = yt(t.colorsList, r.map(String)));
291
+ const { xDataByKeys: d, yDataByKeys: y } = i.meta;
292
+ a.forEach((p) => {
293
+ const { colors: u, type: A, axis: l, valueColumn: h } = p, o = (l === "x" ? d : y)[h.valueLabels ?? h.value];
294
+ if (A === "discrete") {
295
+ const c = ot.uniq(Object.values(o).map(String)).sort();
296
+ this.annotationColorScales[p.id] = {
297
297
  type: "discrete",
298
- scale: St(p, a)
298
+ scale: xt(u, c)
299
299
  };
300
300
  } else {
301
- const a = Object.values(i).map(Number);
302
- if (!a.length)
301
+ const c = Object.values(o).map(Number);
302
+ if (!c.length)
303
303
  return;
304
- const [y = a[0], x = a[0]] = At(a);
305
- this.annotationColorScales[d.id] = {
304
+ const [f = c[0], E = c[0]] = At(c);
305
+ this.annotationColorScales[p.id] = {
306
306
  type: "continuous",
307
- scale: xt(p, y, x, 0, 0.5, 1)
307
+ scale: St(u, f, E, 0, 0.5, 1)
308
308
  };
309
309
  }
310
310
  });
311
311
  }
312
- updateDendrogram(s, e, t, r, o, n, l) {
313
- s.forEach((u) => {
314
- this.dendrograms[u] = { x: { treesByGroupKey: {}, data: n }, y: { treesByGroupKey: {}, data: l } };
315
- const { xKeysByGroups: f, yKeysByGroups: d } = r[u], { hierarchyByGroupX: p, hierarchyByGroupY: L } = o[u];
316
- if (n) {
317
- const c = e.reduce((h, i) => {
318
- var a;
319
- return Math.max(h, (a = p[i]) == null ? void 0 : a.data.height);
312
+ updateDendrogram(s, e, t, a, i, r, n) {
313
+ s.forEach((d) => {
314
+ this.dendrograms[d] = { x: { treesByGroupKey: {}, data: r }, y: { treesByGroupKey: {}, data: n } };
315
+ const { xKeysByGroups: y, yKeysByGroups: p } = a[d];
316
+ if (r) {
317
+ const { hierarchyByGroupX: u } = i[d], A = e.reduce((l, h) => {
318
+ var o;
319
+ return Math.max(l, (o = u[h]) == null ? void 0 : o.data.height);
320
320
  }, 0);
321
- this.dendrograms[u].x.treesByGroupKey = e.reduce((h, i) => {
322
- const a = p[i], y = f[i];
323
- Z().separation(() => 1).size([y.length * this.step.x[u], n.size])(
324
- a
321
+ this.dendrograms[d].x.treesByGroupKey = e.reduce((l, h) => {
322
+ const o = u[h], c = y[h];
323
+ Z().separation(() => 1).size([c.length * this.step.x[d], r.size])(
324
+ o
325
325
  );
326
- const x = a, E = N().domain(n.position === "top" ? [0, c] : [c, 0]).range([n.size, 0]);
327
- return tt(x, E, "y"), et(x, this.scales.x[u](y[0]), "x"), h[i] = x, h;
328
- }, {}), this.dendrograms[u].x.data = n;
326
+ const f = o, E = N().domain(r.position === "top" ? [0, A] : [A, 0]).range([r.size, 0]);
327
+ return tt(f, E, "y"), et(f, this.scales.x[d](c[0]), "x"), l[h] = f, l;
328
+ }, {}), this.dendrograms[d].x.data = r;
329
329
  }
330
- if (l) {
331
- const c = t.reduce((h, i) => {
332
- var a;
333
- return Math.max(h, (a = L[i]) == null ? void 0 : a.data.height);
330
+ if (n) {
331
+ const { hierarchyByGroupY: u } = i[d], A = t.reduce((l, h) => {
332
+ var o;
333
+ return Math.max(l, (o = u[h]) == null ? void 0 : o.data.height);
334
334
  }, 0);
335
- this.dendrograms[u].y.treesByGroupKey = t.reduce((h, i) => {
336
- const a = L[i], y = d[i];
337
- Z().separation(() => 1).size([y.length * this.step.y[u], l.size])(
338
- a
335
+ this.dendrograms[d].y.treesByGroupKey = t.reduce((l, h) => {
336
+ const o = u[h], c = p[h];
337
+ Z().separation(() => 1).size([c.length * this.step.y[d], n.size])(
338
+ o
339
339
  );
340
- const x = a, E = N().domain(l.position === "left" ? [0, c] : [c, 0]).range([l.size, 0]);
341
- return et(x, this.scales.y[u](y[0]), "x", "y"), tt(x, E, "x"), h[i] = x, h;
342
- }, {}), this.dendrograms[u].y.data = l;
340
+ const f = o, E = N().domain(n.position === "left" ? [0, A] : [A, 0]).range([n.size, 0]);
341
+ return et(f, this.scales.y[d](c[0]), "x", "y"), tt(f, E, "x"), l[h] = f, l;
342
+ }, {}), this.dendrograms[d].y.data = n;
343
343
  }
344
344
  });
345
345
  }
@@ -347,39 +347,39 @@ class Ut {
347
347
  if (!s)
348
348
  return;
349
349
  const e = Object.keys(s);
350
- this.dendrogramAesScales = e.reduce((t, r) => {
351
- const o = s[r], n = Object.keys(o);
352
- return t[r] = W().domain(n).range(
353
- n.map((l) => ({
350
+ this.dendrogramAesScales = e.reduce((t, a) => {
351
+ const i = s[a], r = Object.keys(i);
352
+ return t[a] = W().domain(r).range(
353
+ r.map((n) => ({
354
354
  ...Q,
355
- ...o[l]
355
+ ...i[n]
356
356
  }))
357
357
  ).unknown(Q), t;
358
358
  }, {});
359
359
  }
360
- render(s, e, t, r, o, n, l, u, f, d, p, L, c, h, i, a, y) {
361
- var x;
362
- const { meta: E, facets: C } = n, { facetKeys: g, xGroupKeys: b, yGroupKeys: S, valueExtent: G } = E, { xAxis: M, yAxis: w, title: D, size: v, valueType: T } = t;
363
- this.updateChartsSizes(v, r, n, o.groupGap), this.updateAesScale(T, G.dataSource, o, l, n, c, h), this.updateScales(g, n, o.groupGap, r, v, t.xAxis, t.yAxis, f, d, a), this.updateCaptionsSize(n, M, w, r), this.updateChartDimensions(
364
- v,
360
+ render(s, e, t, a, i, r, n, d, y, p, u, A, l, h, o, c, f) {
361
+ var E;
362
+ const { meta: K, facets: S } = r, { facetKeys: g, xGroupKeys: C, yGroupKeys: x, valueExtent: G } = K, { xAxis: w, yAxis: M, title: H, size: L, valueType: v } = t;
363
+ this.updateChartsSizes(L, a, r, i.groupGap), this.updateAesScale(v, G.dataSource, i, n, r, l, h), this.updateScales(g, r, i.groupGap, a, L, t.xAxis, t.yAxis, y, p, c), this.updateCaptionsSize(r, w, M, a), this.updateChartDimensions(
364
+ L,
365
365
  g,
366
- b,
367
- S,
368
- r,
369
- M,
366
+ C,
367
+ x,
368
+ a,
370
369
  w,
371
- l,
372
- f,
373
- d
374
- ), this.updateLegendSize(T, t.legend, l, u, G.dataSource), this.updateMargins(D, v), this.updateDendrogram(g, b, S, C, p, f, d), this.updateDendrogramAesScales(L);
375
- const H = /* @__PURE__ */ $.jsx(rt, { dataFrame: s, children: /* @__PURE__ */ $.jsx(
370
+ M,
371
+ n,
372
+ y,
373
+ p
374
+ ), this.updateLegendSize(v, t.legend, n, d, G.dataSource), this.updateMargins(H, L), this.updateDendrogram(g, C, x, S, u, y, p), this.updateDendrogramAesScales(A);
375
+ const D = /* @__PURE__ */ O.jsx(rt, { dataFrame: s, children: /* @__PURE__ */ O.jsx(
376
376
  dt,
377
377
  {
378
- aes: o,
379
- annotations: l,
378
+ aes: i,
379
+ annotations: n,
380
380
  annotationColorScales: this.annotationColorScales,
381
381
  captionsSizes: this.captionsSizes,
382
- cellsMeta: E,
382
+ cellsMeta: K,
383
383
  columnsCount: this.columnsCount,
384
384
  chartsDimensions: this.chartsDimensions,
385
385
  chartSettings: t,
@@ -388,28 +388,28 @@ class Ut {
388
388
  dendrogramAesScales: this.dendrogramAesScales,
389
389
  dendrograms: this.dendrograms,
390
390
  facetKeys: g,
391
- facetSettings: r,
392
- groupedCells: C,
391
+ facetSettings: a,
392
+ groupedCells: S,
393
393
  labelAngles: this.labelAngles,
394
394
  legend: this.legend,
395
395
  margins: this.margins,
396
396
  scales: this.scales,
397
397
  settingsId: e,
398
398
  step: this.step,
399
- xGroupKeys: b,
400
- yGroupKeys: S,
401
- onTooltipHintSwitch: i,
402
- cellsRenderingMode: y
399
+ xGroupKeys: C,
400
+ yGroupKeys: x,
401
+ onTooltipHintSwitch: o,
402
+ cellsRenderingMode: f
403
403
  }
404
404
  ) });
405
- this.component = H, (x = this.reactRoot) == null || x.render(H);
405
+ this.component = D, (E = this.reactRoot) == null || E.render(D);
406
406
  }
407
407
  renderError(s) {
408
408
  var e;
409
- (e = this.reactRoot) == null || e.render(/* @__PURE__ */ $.jsx(at, { message: s }));
409
+ (e = this.reactRoot) == null || e.render(/* @__PURE__ */ O.jsx(at, { message: s }));
410
410
  }
411
411
  }
412
412
  export {
413
- Ut as default
413
+ Jt as default
414
414
  };
415
415
  //# sourceMappingURL=ChartRenderer.js.map