@genome-spy/app 0.88.1 → 0.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/{agentApi-BIpg3JKh.js → agentApi-Z65dw-sD.js} +5976 -6711
  2. package/dist/agentApi.es.js +3580 -4470
  3. package/dist/agentShared.es.js +742 -683
  4. package/dist/{canvas2d-BVQ7-2eJ.js → canvas2d-DiPQvNtZ.js} +122 -109
  5. package/dist/{canvas2d-D7SZK3xv.js → canvas2d-t_N10CeW.js} +114 -101
  6. package/dist/{canvasSizeHelper-7h_8rOcx.js → canvasSizeHelper-foL2YvGL.js} +15 -8
  7. package/dist/{clipOptions-DTMcB_9z.js → clipOptions-B5PibDq3.js} +1610 -1342
  8. package/dist/{clipOptions-BWHr3aTa.js → clipOptions-Cba4I0AO.js} +1872 -1644
  9. package/dist/{componentStyles-FsNmIb22.js → componentStyles-DGtQXvwc.js} +17 -15
  10. package/dist/{debug-CVpoEOWx.js → debug-CVAlrcZt.js} +2 -2
  11. package/dist/{debug-DYAMZZKl.js → debug-DP4WzTNo.js} +2 -2
  12. package/dist/dialog.es.js +4 -3
  13. package/dist/esm-BiqrFjMh.js +443 -0
  14. package/dist/{esm-lwYrRdbg.js → esm-Bv7Frz7C.js} +142 -79
  15. package/dist/{esm-VvpZ9hsq.js → esm-C3A-AuRi.js} +1 -1
  16. package/dist/esm-CvpR1OcU.js +322 -0
  17. package/dist/esm-DFHFX1sH.js +1526 -0
  18. package/dist/esm-Dndm-NaA.js +1193 -0
  19. package/dist/{esm-CcDLRSvC.js → esm-DtNElqRr.js} +64 -63
  20. package/dist/esm-L53qjcYH.js +1155 -0
  21. package/dist/esm-VFJeyk9i.js +249 -0
  22. package/dist/{esm-BdLYkz-m.js → esm-_xCtpDwm.js} +1 -1
  23. package/dist/index.es.js +4203 -3910
  24. package/dist/index.js +971 -482
  25. package/dist/{indexer-CXjZDo2Q.js → indexer-DbFTKGlm.js} +1 -1
  26. package/dist/{indexer-DAH_ruVn.js → indexer-En7gpvLN.js} +1 -1
  27. package/dist/{lit-ByuJ0FJ4.js → lit-CoXp9NFX.js} +12 -10
  28. package/dist/order-BkYCnwD7.js +1062 -0
  29. package/dist/order-R043xTpC.js +1062 -0
  30. package/dist/{parquetRead-Cs2xRrvz.js → parquetRead-0hFIa3Cc.js} +532 -350
  31. package/dist/rasterExport-C_FcNBkC.js +52 -0
  32. package/dist/rasterExport-Z7gs5346.js +52 -0
  33. package/dist/rasterization-_-9JmSas.js +63 -0
  34. package/dist/rectangle-DE98gIxF.js +108 -0
  35. package/dist/{renderCanvas2D-DxturTEW.js → renderCanvas2D-DK1c9TFK.js} +68 -67
  36. package/dist/{renderCanvas2D-DtcJjqpB.js → renderCanvas2D-IM-A9DYG.js} +57 -56
  37. package/dist/schema.json +599 -116
  38. package/dist/{src-DjOlFqSn.js → src-DJtvThVC.js} +3 -5
  39. package/dist/style.css +1 -1
  40. package/dist/{svg-SDJMzL--.js → svg-DW3tfUmm.js} +339 -326
  41. package/dist/{svg-CyrLfa9e.js → svg-PabUdcDi.js} +365 -352
  42. package/dist/{svgRasterizer-f7DJ3UO0.js → svgRasterizer-B6YtWLJs.js} +6 -5
  43. package/dist/{svgRasterizer-mWK7HTkx.js → svgRasterizer-BEVDyyS3.js} +6 -5
  44. package/dist/{vega-scale-DLKCwWRs.js → vega-scale-Byaw1K8O.js} +823 -780
  45. package/dist/{vega-scale-CypF85iS.js → vega-scale-Ctz_wa3z.js} +963 -923
  46. package/dist/{viewIdentityRegistry-Dl-vMN9I.js → viewIdentityRegistry-BW415b3o.js} +1 -1
  47. package/dist/{viewIdentityRegistry-DIDo44XQ.js → viewIdentityRegistry-_F0E7nkA.js} +1 -1
  48. package/dist/{viewSelectors-CymbZyE6.js → viewSelectors-DYz-PhTO.js} +407 -340
  49. package/dist/{viewSelectors-DNiDip5e.js → viewSelectors-KtD-QSN0.js} +349 -282
  50. package/dist/{viewUtils-BrJLIj2o.js → viewUtils-BZGPseMx.js} +2052 -1871
  51. package/dist/{webgl-tZfZ8y3q.js → webgl-BKSGqHaz.js} +2144 -784
  52. package/dist/{webgl-CTJt7jQd.js → webgl-tdKf9SlZ.js} +2386 -1026
  53. package/package.json +5 -5
  54. package/dist/esm-80V4xF_D.js +0 -1098
  55. package/dist/esm-BA6yMcc-.js +0 -1222
  56. package/dist/esm-BdT7qUL-.js +0 -157
  57. package/dist/esm-CfYZhLHN.js +0 -1367
  58. package/dist/esm-D-iG_TIX.js +0 -441
  59. package/dist/esm-JAiZmFIS.js +0 -128
  60. package/dist/order-C5CzA37O.js +0 -918
  61. package/dist/order-DvY7KNcu.js +0 -918
  62. package/dist/rasterExport-BgZ98e6U.js +0 -44
  63. package/dist/rasterExport-DEr8fOLm.js +0 -44
  64. package/dist/rasterization-CFogVB3B.js +0 -50
  65. package/dist/rectangle-DKnrAmKs.js +0 -142
@@ -1,16 +1,16 @@
1
- import { ct as e, et as t, o as n, s as r, un as i } from "./clipOptions-BWHr3aTa.js";
2
- import { v as a } from "./vega-scale-CypF85iS.js";
1
+ import { Kt as e, ct as t, et as n, o as r, s as i } from "./clipOptions-B5PibDq3.js";
2
+ import { v as a } from "./vega-scale-Ctz_wa3z.js";
3
3
  import { t as o } from "./warning-CpIIpk8e.js";
4
- import { t as s } from "./rectangle-DKnrAmKs.js";
4
+ import { t as s } from "./rectangle-DE98gIxF.js";
5
5
  import { n as c, r as l, t as u } from "./performanceProfiler-CPLEjApa.js";
6
6
  import { n as d, t as f } from "./layoutResult-D50MSHXR.js";
7
- import { A as p, C as m, E as h, M as g, N as _, O as v, S as y, _ as b, a as x, b as S, c as C, f as w, h as T, k as E, l as D, m as O, o as ee, p as te, s as ne, u as re, v as ie, y as k } from "./order-C5CzA37O.js";
8
- import { n as A, t as j } from "./renderCanvas2D-DxturTEW.js";
9
- import { t as M } from "./canvasSizeHelper-7h_8rOcx.js";
10
- import { exportCanvas as N, exportRaster as P } from "./rasterExport-DEr8fOLm.js";
11
- import { createCanvas2DSvgRasterizer as F } from "./svgRasterizer-mWK7HTkx.js";
7
+ import { C as p, E as m, F as h, I as g, M as _, N as v, S as y, T as b, _ as x, b as S, c as C, d as w, f as T, g as E, h as ee, i as D, j as O, k, l as te, n as ne, p as re, u as ie, v as ae, x as A } from "./order-BkYCnwD7.js";
8
+ import { n as j, t as M } from "./renderCanvas2D-DK1c9TFK.js";
9
+ import { t as N } from "./canvasSizeHelper-foL2YvGL.js";
10
+ import { exportCanvas as P, exportRaster as F } from "./rasterExport-C_FcNBkC.js";
11
+ import { createCanvas2DSvgRasterizer as I } from "./svgRasterizer-B6YtWLJs.js";
12
12
  //#region ../core/src/rendering/canvas2d/picking/softwarePickingRasterizer.js
13
- var I = 12, L = .5, R = class {
13
+ var L = 12, R = .5, z = class {
14
14
  #e = [];
15
15
  #t = [];
16
16
  #n = [
@@ -50,7 +50,7 @@ var I = 12, L = .5, R = class {
50
50
  }
51
51
  setClip(e, t, n, r) {
52
52
  if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r)) throw RangeError("Software picking clip must be finite.");
53
- this.#r = H(Math.floor(Math.min(e, n)), 0, this.buffer.width), this.#i = H(Math.floor(Math.min(t, r)), 0, this.buffer.height), this.#a = H(Math.ceil(Math.max(e, n)), this.#r, this.buffer.width), this.#o = H(Math.ceil(Math.max(t, r)), this.#i, this.buffer.height);
53
+ this.#r = U(Math.floor(Math.min(e, n)), 0, this.buffer.width), this.#i = U(Math.floor(Math.min(t, r)), 0, this.buffer.height), this.#a = U(Math.ceil(Math.max(e, n)), this.#r, this.buffer.width), this.#o = U(Math.ceil(Math.max(t, r)), this.#i, this.buffer.height);
54
54
  }
55
55
  fillRect(e, t, n, r, i) {
56
56
  this.#s++, this.#p(e, t, n, r, i);
@@ -62,7 +62,7 @@ var I = 12, L = .5, R = class {
62
62
  if (!(s >= l || c >= u)) for (let t = c; t < u; t++) this.#m(e, t, s, l);
63
63
  }
64
64
  fillSquare(e, t, n, r) {
65
- !Number.isFinite(t) || !Number.isFinite(n) || !(r > 0) || !Number.isFinite(r) || (this.#c++, this.#h(e, t, n, r));
65
+ Number.isFinite(t) && Number.isFinite(n) && r > 0 && Number.isFinite(r) && (this.#c++, this.#h(e, t, n, r));
66
66
  }
67
67
  fillConvexPolygon(e, t) {
68
68
  if (t.length < 6 || t.length % 2 != 0) throw Error("A convex picking polygon requires at least three x/y pairs.");
@@ -95,7 +95,7 @@ var I = 12, L = .5, R = class {
95
95
  if (!(a > 0) || !Number.isFinite(a)) return;
96
96
  this.#u++;
97
97
  let s = a / 2, c = this.#n;
98
- if (!z(t, n, r, i, this.#r - s, this.#i - s, this.#a + s, this.#o + s, c)) return;
98
+ if (!B(t, n, r, i, this.#r - s, this.#i - s, this.#a + s, this.#o + s, c)) return;
99
99
  let l = c[2] - c[0], u = c[3] - c[1], d = Math.ceil(Math.max(Math.abs(l), Math.abs(u)));
100
100
  if (d == 0) {
101
101
  this.#h(e, c[0], c[1], s, o);
@@ -106,13 +106,13 @@ var I = 12, L = .5, R = class {
106
106
  this.#h(e, c[0] + l * n, c[1] + u * n, s, o);
107
107
  }
108
108
  }
109
- strokeCubic(e, t, n, r, i, a, o, s, c, l, u = L, d) {
109
+ strokeCubic(e, t, n, r, i, a, o, s, c, l, u = R, d) {
110
110
  if (!(l > 0) || !Number.isFinite(l) || !(u > 0) || !Number.isFinite(u) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r) || !Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c)) return;
111
111
  this.#d++;
112
112
  let f = this.#e;
113
113
  for (f.length = 0, f.push(t, n, r, i, a, o, s, c, 0); f.length;) {
114
114
  let t = f.pop(), n = f.pop(), r = f.pop(), i = f.pop(), a = f.pop(), o = f.pop(), s = f.pop(), c = f.pop(), p = f.pop();
115
- if (t >= I || B(p, c, s, o, a, i, r, n, u)) {
115
+ if (t >= L || V(p, c, s, o, a, i, r, n, u)) {
116
116
  this.strokeSegment(e, p, c, r, n, l, d);
117
117
  continue;
118
118
  }
@@ -138,7 +138,7 @@ var I = 12, L = .5, R = class {
138
138
  }
139
139
  }
140
140
  };
141
- function z(e, t, n, r, i, a, o, s, c) {
141
+ function B(e, t, n, r, i, a, o, s, c) {
142
142
  if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r)) return !1;
143
143
  let l = n - e, u = r - t, d = 0, f = 1;
144
144
  if (l == 0) {
@@ -155,67 +155,71 @@ function z(e, t, n, r, i, a, o, s, c) {
155
155
  }
156
156
  return d > f ? !1 : (c[0] = e + d * l, c[1] = t + d * u, c[2] = e + f * l, c[3] = t + f * u, !0);
157
157
  }
158
- function B(e, t, n, r, i, a, o, s, c) {
158
+ function V(e, t, n, r, i, a, o, s, c) {
159
159
  let l = o - e, u = s - t, d = l * l + u * u, f = c * c;
160
160
  if (d == 0) {
161
- let o = V(e, t, n, r), s = V(e, t, i, a);
161
+ let o = H(e, t, n, r), s = H(e, t, i, a);
162
162
  return Math.max(o, s) <= f;
163
163
  }
164
164
  let p = u * (n - e) - l * (r - t), m = u * (i - e) - l * (a - t);
165
165
  return Math.max(p * p, m * m) <= f * d;
166
166
  }
167
- function V(e, t, n, r) {
167
+ function H(e, t, n, r) {
168
168
  let i = n - e, a = r - t;
169
169
  return i * i + a * a;
170
170
  }
171
- function H(e, t, n) {
171
+ function U(e, t, n) {
172
172
  return Math.max(t, Math.min(n, e));
173
173
  }
174
174
  //#endregion
175
175
  //#region ../core/src/rendering/canvas2d/picking/renderers/index.js
176
- var U = 1;
177
- function W(e, t) {
176
+ var W = 1;
177
+ function G(e, t) {
178
178
  let n = e.getType();
179
- return n == "arrow" ? K(e, t) : n == "rect" ? q(e, t) : n == "point" ? J(e, t) : n == "rule" || n == "tick" ? ae(e, t) : n == "link" ? oe(e, t) : n == "text" ? se(e, t) : 0;
179
+ return n == "arrow" ? q(e, t) : n == "rect" ? J(e, t) : n == "point" ? oe(e, t) : n == "rule" || n == "tick" ? se(e, t) : n == "link" ? ce(e, t) : n == "text" ? le(e, t) : 0;
180
180
  }
181
- function G(e) {
181
+ function K(e) {
182
182
  let t = e.getType();
183
183
  return t == "rect" || t == "arrow" || t == "point" || t == "rule" || t == "tick" || t == "link" || t == "text";
184
184
  }
185
- function K(e, t) {
186
- let n = e, r = k(n), i = Array(8).fill(0);
187
- return y(n, r, t, (e) => {
185
+ function q(e, t) {
186
+ let n = e, r = y(n), i = Array(8).fill(0);
187
+ return b(n, r, t, (e) => {
188
188
  let a = Y(n, e.datum), o = e.strokeWidth / 2;
189
- r.stem && t.rasterizer.strokeSegment(a, e.tail.x, e.tail.y, e.tip.x, e.tip.y, e.stemHalfWidth * 2 + e.strokeWidth), S(e, (n, r) => {
190
- let s = e.headHalfWidth + o, c = n + e.tangent.x * o, l = r + e.tangent.y * o, u = e.headRepeatFootprint + o, d = n - e.tangent.x * u, f = r - e.tangent.y * u;
191
- ce(i, c, l, d, f, e.normal.x, e.normal.y, s), t.rasterizer.fillConvexPolygon(a, i);
189
+ r.stem && t.rasterizer.strokeSegment(a, e.tail.x, e.tail.y, e.tip.x, e.tip.y, e.stemHalfWidth * 2 + e.strokeWidth), p(e, (n, r, s, c) => {
190
+ let l = e.headHalfWidth + o, u = n + s.x * o, d = r + s.y * o, f = e.headRepeatFootprint + o, p = n - s.x * f, m = r - s.y * f;
191
+ ue(i, u, d, p, m, c.x, c.y, l), t.rasterizer.fillConvexPolygon(a, i);
192
192
  });
193
193
  });
194
194
  }
195
- function q(e, t) {
195
+ function J(e, t) {
196
196
  let n = e;
197
- return re(n, D(n), t, (e) => t.rasterizer.fillRect(Y(n, e.datum), e.x, e.y, e.width, e.height));
197
+ return re(n, T(n), t, (e) => t.rasterizer.fillRect(Y(n, e.datum), e.x, e.y, e.width, e.height));
198
198
  }
199
- function J(e, t) {
200
- let n = e, r = h(n, n.properties.minPickingSize);
201
- return te(n, w(n), t, (e) => t.rasterizer.fillSquare(Y(n, e.datum), e.x, e.y, Math.max(e.boundsRadius, r / 2)));
199
+ function oe(e, t) {
200
+ let n = e, r = k(n, n.properties.minPickingSize);
201
+ return E(n, ee(n), t, (e) => t.rasterizer.fillSquare(Y(n, e.datum), e.x, e.y, Math.max(e.boundsRadius, r / 2)));
202
202
  }
203
- function ae(e, t) {
203
+ function se(e, t) {
204
204
  let n = e;
205
- return C(n, ne(n), t, (e) => t.rasterizer.strokeSegment(Y(n, e.datum), e.x1, e.y1, e.x2, e.y2, Math.max(e.strokeWidth, U)));
205
+ return w(n, ie(n), t, (e) => t.rasterizer.strokeSegment(Y(n, e.datum), e.x1, e.y1, e.x2, e.y2, Math.max(e.strokeWidth, W)));
206
206
  }
207
- function oe(e, t) {
208
- let n = e, r = h(n, n.properties.minPickingSize), i = O(n), a = ie(n, i.shape);
209
- return T(n, i, t, (e) => {
210
- let [i, o, s, c] = e.points, l = a && b(i, c, a);
207
+ function ce(e, t) {
208
+ let n = e, r = k(n, n.properties.minPickingSize), i = x(n), a = A(n, i.shape);
209
+ return ae(n, i, t, (e) => {
210
+ let [i, o, s, c] = e.points, l = a && S(i, c, a);
211
211
  t.rasterizer.strokeCubic(Y(n, e.datum), i[0], i[1], o[0], o[1], s[0], s[1], c[0], c[1], Math.max(e.strokeWidth, r), void 0, l ? (e, t) => Math.abs(l.normalX * e + l.normalY * t - l.offset) < l.end : void 0);
212
212
  });
213
213
  }
214
- function se(e, t) {
215
- let n = e;
216
- return ee(n, x(n), t, (e) => t.rasterizer.fillConvexPolygon(Y(n, e.datum), e.boundsQuad));
214
+ function le(e, t) {
215
+ let n = e, r = t.textMetrics ?? n.unitView.context.textMetrics, i = r.requestFont(n.properties), a = D(r, n.properties);
216
+ return te(n, C(n), {
217
+ ...t,
218
+ fontMeasurement: i,
219
+ measureLogoInkBounds: a
220
+ }, (e) => t.rasterizer.fillConvexPolygon(Y(n, e.datum), e.boundsQuad));
217
221
  }
218
- function ce(e, t, n, r, i, a, o, s) {
222
+ function ue(e, t, n, r, i, a, o, s) {
219
223
  let c = a * s, l = o * s;
220
224
  e[0] = t + c, e[1] = n + l, e[2] = r + c, e[3] = i + l, e[4] = r - c, e[5] = i - l, e[6] = t - c, e[7] = n - l;
221
225
  }
@@ -225,15 +229,15 @@ function Y(e, t) {
225
229
  }
226
230
  //#endregion
227
231
  //#region ../core/src/rendering/canvas2d/picking/softwarePickingViewRenderingContext.js
228
- var le = class extends d {
232
+ var de = class extends d {
229
233
  #e = [];
230
234
  #t = /* @__PURE__ */ new Set();
231
235
  #n;
232
- #r = new g();
236
+ #r = new h();
233
237
  #i;
234
238
  #a = [0, 0];
235
239
  constructor(e) {
236
- super({ picking: !0 }), this.width = e.width, this.height = e.height, this.devicePixelRatio = e.devicePixelRatio, this.getRasterizer = e.getRasterizer, this.#n = c(), this.#i = e.xIndexManager;
240
+ super({ picking: !0 }), this.width = e.width, this.height = e.height, this.devicePixelRatio = e.devicePixelRatio, this.getRasterizer = e.getRasterizer, this.textMetrics = e.textMetrics, this.#n = c(), this.#i = e.xIndexManager;
237
241
  }
238
242
  getDevicePixelRatio() {
239
243
  return this.devicePixelRatio;
@@ -248,23 +252,23 @@ var le = class extends d {
248
252
  if (this.#e.pop()?.view !== e) throw Error("Unbalanced software picking view rendering context stack.");
249
253
  }
250
254
  renderMark(e, t) {
251
- if (!e.isPickingParticipant() || !G(e)) return;
252
- let i = t.sampleFacetRenderingOptions;
253
- if (i && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !A(i))) {
255
+ if (!e.isPickingParticipant() || !K(e)) return;
256
+ let n = t.sampleFacetRenderingOptions;
257
+ if (n && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !j(n))) {
254
258
  this.#n?.addCount("canvasCulledSampleFacetOccurrences");
255
259
  return;
256
260
  }
257
261
  let a = e.unitView.getEffectiveOpacity();
258
262
  if (a <= 0) return;
259
- let s = this.currentCoords, c = n(t), l = r(c, e.properties.clip, s), u = E(this.width, this.height, l);
260
- if (!p(u)) return;
261
- let d = v(s, c, e.properties.cullByVisibleRange), f = this.#i?.prepare(e) ?? !1;
262
- _(e, t, s, this.#r, (t, n) => {
263
+ let s = this.currentCoords, c = r(t), l = i(c, e.properties.clip, s), u = _(this.width, this.height, l);
264
+ if (!v(u)) return;
265
+ let d = O(s, c, e.properties.cullByVisibleRange), f = this.#i?.prepare(e) ?? !1;
266
+ g(e, t, s, this.#r, (t, n) => {
263
267
  if (n.length == 0) return;
264
268
  let r = 0, i = n.length;
265
269
  if (f && this.#i.query(n, this.#a) && (r = this.#a[0], i = this.#a[1], r === i)) return;
266
270
  let o = this.getRasterizer();
267
- o.setClip(u.x1, u.y1, u.x2, u.y2), W(e, {
271
+ o.setClip(u.x1, u.y1, u.x2, u.y2), G(e, {
268
272
  rasterizer: o,
269
273
  coords: t,
270
274
  data: n,
@@ -272,24 +276,25 @@ var le = class extends d {
272
276
  end: i,
273
277
  visibleBounds: u,
274
278
  anchorCullBounds: d,
275
- viewOpacity: a
279
+ viewOpacity: a,
280
+ textMetrics: this.textMetrics
276
281
  });
277
282
  }, (t) => o(`Canvas2D picking could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`));
278
283
  }
279
284
  get currentCoords() {
280
- let e = i(this.#e);
281
- if (!e) throw Error("No current view in software picking rendering context.");
282
- return e.coords;
285
+ let t = e(this.#e);
286
+ if (!t) throw Error("No current view in software picking rendering context.");
287
+ return t.coords;
283
288
  }
284
- }, X = 2 ** 31 - 1, ue = -(2 ** 31);
285
- function de(e, n, r, i = r) {
289
+ }, X = 2 ** 31 - 1, fe = -(2 ** 31);
290
+ function pe(e, t, r, i = r) {
286
291
  let a = Array(e);
287
292
  a.fill(X);
288
- let o = ue, s = -Infinity, c = !1, l = Array(e);
293
+ let o = fe, s = -Infinity, c = !1, l = Array(e);
289
294
  l.fill(0);
290
- let u = n[0], d = (n[1] - n[0]) / e, f = (n, r) => {
291
- let i = (n - u) / d, a = Math.floor(i);
292
- return t(r && a == i ? a - 1 : a, 0, e - 1);
295
+ let u = t[0], d = (t[1] - t[0]) / e, f = (t, r) => {
296
+ let i = (t - u) / d, a = Math.floor(i);
297
+ return n(r && a == i ? a - 1 : a, 0, e - 1);
293
298
  };
294
299
  function p(e, t, n) {
295
300
  if (c) return;
@@ -318,10 +323,12 @@ function de(e, n, r, i = r) {
318
323
  if (!Number.isFinite(u) || !Number.isFinite(d)) {
319
324
  c = !0;
320
325
  return;
321
- } else if (u < s) {
326
+ }
327
+ if (u < s) {
322
328
  c = !0;
323
329
  return;
324
- } else if (d < u) {
330
+ }
331
+ if (d < u) {
325
332
  c = !0;
326
333
  return;
327
334
  }
@@ -343,21 +350,21 @@ function de(e, n, r, i = r) {
343
350
  }
344
351
  //#endregion
345
352
  //#region ../core/src/rendering/xIndex/markXIndex.js
346
- function fe(e, t, n = 0) {
353
+ function me(e, t, n = 0) {
347
354
  if (!t.length) return;
348
- let r = de(Math.min(256, Math.ceil(Math.sqrt(t.length))), e.indexDomain, e.xAccessor, e.x2Accessor);
355
+ let r = pe(Math.min(256, Math.ceil(Math.sqrt(t.length))), e.indexDomain, e.xAccessor, e.x2Accessor);
349
356
  return t.forEach((e, t) => r(e, n + t, n + t + 1)), r.getIndex();
350
357
  }
351
- function pe(t) {
352
- let n = t.encoders?.x, r = t.encoders?.x2;
358
+ function he(e) {
359
+ let n = e.encoders?.x, r = e.encoders?.x2;
353
360
  if (!n?.channelDef || !("buildIndex" in n.channelDef) || !n.channelDef.buildIndex || !n.scale || !a(n.scale.type) && !["index", "locus"].includes(n.scale.type) || n.branches.length !== 1) return;
354
- let i = t.getType();
361
+ let i = e.getType();
355
362
  if (i !== "point" && i !== "rect") return;
356
- let o = e(n)?.asNumberAccessor();
363
+ let o = t(n)?.asNumberAccessor();
357
364
  if (!o) return;
358
365
  let s;
359
- if (r && (r.scale !== n.scale || r.branches.length !== 1 || (s = e(r)?.asNumberAccessor(), !s))) return;
360
- let c = t.unitView.getScaleResolution("x"), l = c?.zoomExtent;
366
+ if (r && (r.scale !== n.scale || r.branches.length !== 1 || (s = t(r)?.asNumberAccessor(), !s))) return;
367
+ let c = e.unitView.getScaleResolution("x"), l = c?.zoomExtent;
361
368
  if (!(!c || !l || !Number.isFinite(l[0]) || !Number.isFinite(l[1]) || l[1] <= l[0])) return {
362
369
  xAccessor: o,
363
370
  x2Accessor: s,
@@ -366,7 +373,7 @@ function pe(t) {
366
373
  domainStartOffset: ["index", "locus"].includes(n.scale.type) ? -1 : 0
367
374
  };
368
375
  }
369
- function me(e, t) {
376
+ function Z(e, t) {
370
377
  let n = e.scaleResolution.getScale().domain();
371
378
  if (n.length !== 2 || !Number.isFinite(n[0]) || !Number.isFinite(n[1]) || n[1] <= n[0]) return !1;
372
379
  let r = n[1] - n[0];
@@ -374,7 +381,7 @@ function me(e, t) {
374
381
  }
375
382
  //#endregion
376
383
  //#region ../core/src/rendering/canvas2d/canvasXIndexManager.js
377
- var he = class {
384
+ var ge = class {
378
385
  #e = /* @__PURE__ */ new WeakMap();
379
386
  #t = [0, 0];
380
387
  #n;
@@ -382,7 +389,7 @@ var he = class {
382
389
  if (this.#n = void 0, e.encoders.facetIndex) return this.#r();
383
390
  let t = e.unitView.getCollector(), n = e.unitView.getScaleResolution("x"), r = n?.zoomExtent, i = this.#e.get(e);
384
391
  if (!i || i.collector !== t || i.dataRevision !== t.dataRevision || i.xEncoder !== e.encoders.x || i.x2Encoder !== e.encoders.x2 || i.xScaleResolution !== n || i.xIndexDomainStart !== r?.[0] || i.xIndexDomainEnd !== r?.[1]) {
385
- let a = pe(e);
392
+ let a = he(e);
386
393
  i = {
387
394
  collector: t,
388
395
  dataRevision: t.dataRevision,
@@ -396,21 +403,21 @@ var he = class {
396
403
  }, this.#e.set(e, i);
397
404
  }
398
405
  let a = i.spec;
399
- return !a || !me(a, this.#t) ? this.#r() : (this.#n = i, !0);
406
+ return !a || !Z(a, this.#t) ? this.#r() : (this.#n = i, !0);
400
407
  }
401
408
  query(e, t) {
402
409
  let n = this.#n;
403
410
  if (!n?.spec) throw Error("Canvas x-index query was not prepared.");
404
411
  u("canvasXIndexNativeItems", e.length);
405
412
  let r = n.batches.get(e);
406
- return r === void 0 && (r = fe(n.spec, e) ?? null, n.batches.set(e, r), u("canvasXIndexBuilds"), r || u("canvasXIndexRejectedBuilds")), r ? (r(this.#t[0], this.#t[1], t), u("canvasXIndexQueries"), u("canvasXIndexCandidateItems", t[1] - t[0]), t[0] === t[1] && u("canvasXIndexEmptyRanges"), !0) : this.#r();
413
+ return r === void 0 && (r = me(n.spec, e) ?? null, n.batches.set(e, r), u("canvasXIndexBuilds"), r || u("canvasXIndexRejectedBuilds")), r ? (r(this.#t[0], this.#t[1], t), u("canvasXIndexQueries"), u("canvasXIndexCandidateItems", t[1] - t[0]), t[0] === t[1] && u("canvasXIndexEmptyRanges"), !0) : this.#r();
407
414
  }
408
415
  #r() {
409
416
  return u("canvasXIndexFallbackQueries"), !1;
410
417
  }
411
- }, Z = class {
418
+ }, _e = class {
412
419
  constructor(e) {
413
- this.viewRoot = e.viewRoot, this.context = e.context, this.surface = e.surface, this.getBackground = e.getBackground, this.broadcast = e.broadcast, this.onLayoutComputed = e.onLayoutComputed, this.layoutResult = void 0, this.pickingRasterizer = void 0, this.dirtyPickingBuffer = !0, this.xIndexManager = new he(), this.opacityLayers = [];
420
+ this.viewRoot = e.viewRoot, this.context = e.context, this.surface = e.surface, this.textMetrics = e.textMetrics, this.getBackground = e.getBackground, this.broadcast = e.broadcast, this.onLayoutComputed = e.onLayoutComputed, this.layoutResult = void 0, this.pickingRasterizer = void 0, this.dirtyPickingBuffer = !0, this.xIndexManager = new ge(), this.opacityLayers = [];
414
421
  }
415
422
  computeLayout() {
416
423
  this.broadcast("layout"), this.surface.invalidateSize();
@@ -433,7 +440,7 @@ var he = class {
433
440
  let n = c();
434
441
  n?.beginFrame("canvas");
435
442
  try {
436
- l("render", () => j({
443
+ l("render", () => M({
437
444
  layoutResult: e,
438
445
  context: this.context,
439
446
  width: t.width,
@@ -441,6 +448,7 @@ var he = class {
441
448
  devicePixelRatio: this.surface.getDevicePixelRatio(),
442
449
  background: this.getBackground(),
443
450
  paint: !0,
451
+ textMetrics: this.textMetrics,
444
452
  xIndexManager: this.xIndexManager,
445
453
  opacityLayers: this.opacityLayers
446
454
  })), this.dirtyPickingBuffer = !0;
@@ -454,16 +462,17 @@ var he = class {
454
462
  let t = this.surface.getLogicalCanvasSize();
455
463
  if (isNaN(t.width) || isNaN(t.height)) return;
456
464
  this.surface.clearPickingBuffer();
457
- let n = this.pickingRasterizer, r = !1, i = new le({
465
+ let n = this.pickingRasterizer, r = !1, i = new de({
458
466
  width: t.width,
459
467
  height: t.height,
460
468
  devicePixelRatio: this.surface.getDevicePixelRatio(),
461
- getRasterizer: () => (n || (n = new R(this.surface.getPickingBuffer()), this.pickingRasterizer = n), r ||= (n.resetClip(), n.resetStatistics(), !0), n),
469
+ textMetrics: this.textMetrics,
470
+ getRasterizer: () => (n || (n = new z(this.surface.getPickingBuffer()), this.pickingRasterizer = n), r ||= (n.resetClip(), n.resetStatistics(), !0), n),
462
471
  xIndexManager: this.xIndexManager
463
472
  }), a = c();
464
473
  a?.beginFrame("canvas", "picking");
465
474
  try {
466
- l("picking", () => e.collectRenderCommands(i)), this.dirtyPickingBuffer = !1, r && ge(n, a);
475
+ l("picking", () => e.collectRenderCommands(i)), this.dirtyPickingBuffer = !1, r && ve(n, a);
467
476
  } finally {
468
477
  a?.endFrame();
469
478
  }
@@ -479,14 +488,14 @@ var he = class {
479
488
  });
480
489
  }
481
490
  };
482
- function ge(e, t) {
491
+ function ve(e, t) {
483
492
  if (!t) return;
484
493
  let n = e.getStatistics();
485
494
  t.addCount("pickingRectangles", n.rectangles), t.addCount("pickingSquares", n.squares), t.addCount("pickingPolygons", n.polygons), t.addCount("pickingSegments", n.segments), t.addCount("pickingCubics", n.cubics), t.addCount("pickingSpans", n.spans);
486
495
  }
487
496
  //#endregion
488
497
  //#region ../core/src/rendering/canvas2d/picking/softwarePickingBuffer.js
489
- var Q = /* @__PURE__ */ new Uint32Array(), _e = class {
498
+ var Q = /* @__PURE__ */ new Uint32Array(), ye = class {
490
499
  #e = Q;
491
500
  width = 0;
492
501
  height = 0;
@@ -521,7 +530,7 @@ function $(e, t) {
521
530
  }
522
531
  //#endregion
523
532
  //#region ../core/src/rendering/canvas2d/canvas2DSurface.js
524
- var ve = class {
533
+ var be = class {
525
534
  #e;
526
535
  #t;
527
536
  #n;
@@ -531,7 +540,7 @@ var ve = class {
531
540
  if (!n) throw Error("Unable to initialize a Canvas2D rendering context.");
532
541
  this.canvas = t, this.context = n, e.container.appendChild(t);
533
542
  try {
534
- this.#e = new M(e.container, t, e.sizeSource, () => {
543
+ this.#e = new N(e.container, t, e.sizeSource, () => {
535
544
  this.#i() && e.onCanvasResize();
536
545
  }), this.#i();
537
546
  } catch (e) {
@@ -559,7 +568,7 @@ var ve = class {
559
568
  getPickingBuffer() {
560
569
  if (this.#r) throw Error("Canvas2D surface has been finalized.");
561
570
  let e = this.getLogicalCanvasSize();
562
- return this.#n ??= new _e(e.width, e.height), this.#n;
571
+ return this.#n ??= new ye(e.width, e.height), this.#n;
563
572
  }
564
573
  clearPickingBuffer() {
565
574
  this.#n?.clear();
@@ -593,28 +602,32 @@ var ve = class {
593
602
  };
594
603
  //#endregion
595
604
  //#region ../core/src/rendering/canvas2d/index.js
596
- function ye(e) {
597
- let t = new ve(e);
605
+ function xe(e) {
606
+ let t = new be(e), n = ne(e.container.ownerDocument);
598
607
  return {
599
608
  surface: t,
600
- createRenderCoordinator: (e) => new Z({
609
+ textMetrics: n,
610
+ createRenderCoordinator: (e) => new _e({
601
611
  ...e,
602
612
  surface: t,
603
- context: t.context
613
+ context: t.context,
614
+ textMetrics: n
604
615
  }),
605
- exportCanvas: (e) => N({
616
+ exportCanvas: (e) => P({
606
617
  ...e,
607
618
  liveSize: t.getLogicalCanvasSize(),
608
- liveDevicePixelRatio: t.getDevicePixelRatio()
619
+ liveDevicePixelRatio: t.getDevicePixelRatio(),
620
+ textMetrics: n
609
621
  }),
610
- exportRaster: (e) => P({
622
+ exportRaster: (e) => F({
611
623
  ...e,
612
624
  liveSize: t.getLogicalCanvasSize(),
613
- liveDevicePixelRatio: t.getDevicePixelRatio()
625
+ liveDevicePixelRatio: t.getDevicePixelRatio(),
626
+ textMetrics: n
614
627
  }),
615
- rasterizeSvgRuns: (e) => F()(e),
628
+ rasterizeSvgRuns: (e) => I()(e),
616
629
  readPickingId: (e, n) => t.readPickingId(e, n)
617
630
  };
618
631
  }
619
632
  //#endregion
620
- export { ye as createCanvas2DRenderingBackend };
633
+ export { xe as createCanvas2DRenderingBackend };
@@ -4,15 +4,15 @@ var e = class {
4
4
  this._container = e, this._canvas = t, this._sizeSource = n, this._onPhysicalSizeChange = r ?? (() => {}), this._logicalCanvasSize = void 0, this._devicePixelContentBoxSize = void 0, this._devicePixelContentBoxObserver = void 0, this._observeDevicePixelContentBox();
5
5
  }
6
6
  invalidate() {
7
- this._logicalCanvasSize = void 0, this._devicePixelContentBoxSize = void 0;
7
+ this._logicalCanvasSize = void 0;
8
8
  }
9
9
  finalize() {
10
10
  this._devicePixelContentBoxObserver && this._devicePixelContentBoxObserver.disconnect();
11
11
  }
12
12
  getPhysicalCanvasSize(e) {
13
- if (this._devicePixelContentBoxSize) return this._devicePixelContentBoxSize;
14
- let t = window.devicePixelRatio ?? 1;
15
- return e ||= this.getLogicalCanvasSize(), {
13
+ e ||= this.getLogicalCanvasSize();
14
+ let t = window.devicePixelRatio ?? 1, n = this._devicePixelContentBoxSize;
15
+ return n && n.logical.width == e.width && n.logical.height == e.height && n.dpr == t ? n.physical : {
16
16
  width: Math.round(e.width * t),
17
17
  height: Math.round(e.height * t)
18
18
  };
@@ -40,10 +40,17 @@ var e = class {
40
40
  let r = Array.isArray(n) ? n[0] : n;
41
41
  if (!r) return;
42
42
  let i = {
43
- width: r.inlineSize,
44
- height: r.blockSize
45
- };
46
- this._devicePixelContentBoxSize && this._devicePixelContentBoxSize.width == i.width && this._devicePixelContentBoxSize.height == i.height || (this._devicePixelContentBoxSize = i, this._onPhysicalSizeChange());
43
+ physical: {
44
+ width: r.inlineSize,
45
+ height: r.blockSize
46
+ },
47
+ logical: {
48
+ width: t.contentRect.width,
49
+ height: t.contentRect.height
50
+ },
51
+ dpr: window.devicePixelRatio ?? 1
52
+ }, a = this._devicePixelContentBoxSize;
53
+ this._devicePixelContentBoxSize = i, !(a && a.physical.width == i.physical.width && a.physical.height == i.physical.height && a.logical.width == i.logical.width && a.logical.height == i.logical.height && a.dpr == i.dpr) && this._onPhysicalSizeChange();
47
54
  });
48
55
  try {
49
56
  e.observe(this._canvas, { box: "device-pixel-content-box" }), this._devicePixelContentBoxObserver = e;