@genome-spy/app 0.88.0 → 0.89.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 (43) hide show
  1. package/dist/{agentApi-BYFBKiRQ.js → agentApi-BUcXm-JC.js} +5544 -6449
  2. package/dist/agentApi.es.js +3328 -4255
  3. package/dist/agentShared.es.js +9 -9
  4. package/dist/{canvas2d-BVQ7-2eJ.js → canvas2d-CGuVGvQk.js} +117 -106
  5. package/dist/{canvas2d-D7SZK3xv.js → canvas2d-DgF0kstG.js} +99 -88
  6. package/dist/{canvasSizeHelper-7h_8rOcx.js → canvasSizeHelper-foL2YvGL.js} +15 -8
  7. package/dist/{clipOptions-DTMcB_9z.js → clipOptions-8BPf0WMZ.js} +1013 -755
  8. package/dist/{clipOptions-BWHr3aTa.js → clipOptions-DBJX_W31.js} +1033 -775
  9. package/dist/{debug-CVpoEOWx.js → debug-BEWbYuZD.js} +2 -2
  10. package/dist/{debug-DYAMZZKl.js → debug-DQj_7mFm.js} +2 -2
  11. package/dist/index.es.js +65 -65
  12. package/dist/index.js +406 -364
  13. package/dist/{indexer-DAH_ruVn.js → indexer-Cdt_U05k.js} +1 -1
  14. package/dist/{indexer-CXjZDo2Q.js → indexer-D8Bgkkb8.js} +1 -1
  15. package/dist/order-BPOzLe80.js +1056 -0
  16. package/dist/order-DIxlclRN.js +1056 -0
  17. package/dist/rasterExport-Bl6w9t3J.js +51 -0
  18. package/dist/rasterExport-DRvNAH-r.js +51 -0
  19. package/dist/rasterization-D0tOoKu_.js +62 -0
  20. package/dist/rectangle-DE98gIxF.js +108 -0
  21. package/dist/{renderCanvas2D-DxturTEW.js → renderCanvas2D-Ct95auF3.js} +60 -59
  22. package/dist/{renderCanvas2D-DtcJjqpB.js → renderCanvas2D-LdEYFnRo.js} +71 -70
  23. package/dist/schema.json +588 -116
  24. package/dist/{svg-CyrLfa9e.js → svg-Ag36-h_I.js} +394 -382
  25. package/dist/{svg-SDJMzL--.js → svg-pkTPD4bv.js} +368 -356
  26. package/dist/{svgRasterizer-f7DJ3UO0.js → svgRasterizer-CksK4QTB.js} +6 -5
  27. package/dist/{svgRasterizer-mWK7HTkx.js → svgRasterizer-DrtJ9nLk.js} +6 -5
  28. package/dist/{vega-scale-CypF85iS.js → vega-scale-BJaDSHBJ.js} +891 -959
  29. package/dist/{vega-scale-DLKCwWRs.js → vega-scale-BWBFykuI.js} +692 -760
  30. package/dist/{viewIdentityRegistry-DIDo44XQ.js → viewIdentityRegistry-B-snqI3y.js} +1 -1
  31. package/dist/{viewIdentityRegistry-Dl-vMN9I.js → viewIdentityRegistry-BvCJajXG.js} +1 -1
  32. package/dist/{viewSelectors-CymbZyE6.js → viewSelectors-BlvzvG-z.js} +445 -380
  33. package/dist/{viewSelectors-DNiDip5e.js → viewSelectors-C5q3qBiR.js} +364 -299
  34. package/dist/{viewUtils-BrJLIj2o.js → viewUtils-C3vBtSvE.js} +1714 -1689
  35. package/dist/{webgl-CqTDifWM.js → webgl-CZX2pe5v.js} +2322 -971
  36. package/dist/{webgl-jaC2m0Zr.js → webgl-CexXSw_I.js} +2374 -1023
  37. package/package.json +5 -5
  38. package/dist/order-C5CzA37O.js +0 -918
  39. package/dist/order-DvY7KNcu.js +0 -918
  40. package/dist/rasterExport-BgZ98e6U.js +0 -44
  41. package/dist/rasterExport-DEr8fOLm.js +0 -44
  42. package/dist/rasterization-CFogVB3B.js +0 -50
  43. 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 { ct as e, et as t, hn as n, o as r, s as i } from "./clipOptions-DBJX_W31.js";
2
+ import { v as a } from "./vega-scale-BJaDSHBJ.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-DIxlclRN.js";
8
+ import { n as j, t as M } from "./renderCanvas2D-LdEYFnRo.js";
9
+ import { t as N } from "./canvasSizeHelper-foL2YvGL.js";
10
+ import { exportCanvas as P, exportRaster as F } from "./rasterExport-Bl6w9t3J.js";
11
+ import { createCanvas2DSvgRasterizer as I } from "./svgRasterizer-CksK4QTB.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);
@@ -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,20 +276,21 @@ 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);
285
+ let e = n(this.#e);
281
286
  if (!e) throw Error("No current view in software picking rendering context.");
282
287
  return e.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, n, 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
295
  let u = n[0], d = (n[1] - n[0]) / e, f = (n, r) => {
291
296
  let i = (n - u) / d, a = Math.floor(i);
@@ -343,12 +348,12 @@ function de(e, n, r, i = r) {
343
348
  }
344
349
  //#endregion
345
350
  //#region ../core/src/rendering/xIndex/markXIndex.js
346
- function fe(e, t, n = 0) {
351
+ function me(e, t, n = 0) {
347
352
  if (!t.length) return;
348
- let r = de(Math.min(256, Math.ceil(Math.sqrt(t.length))), e.indexDomain, e.xAccessor, e.x2Accessor);
353
+ let r = pe(Math.min(256, Math.ceil(Math.sqrt(t.length))), e.indexDomain, e.xAccessor, e.x2Accessor);
349
354
  return t.forEach((e, t) => r(e, n + t, n + t + 1)), r.getIndex();
350
355
  }
351
- function pe(t) {
356
+ function he(t) {
352
357
  let n = t.encoders?.x, r = t.encoders?.x2;
353
358
  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
359
  let i = t.getType();
@@ -366,7 +371,7 @@ function pe(t) {
366
371
  domainStartOffset: ["index", "locus"].includes(n.scale.type) ? -1 : 0
367
372
  };
368
373
  }
369
- function me(e, t) {
374
+ function Z(e, t) {
370
375
  let n = e.scaleResolution.getScale().domain();
371
376
  if (n.length !== 2 || !Number.isFinite(n[0]) || !Number.isFinite(n[1]) || n[1] <= n[0]) return !1;
372
377
  let r = n[1] - n[0];
@@ -374,7 +379,7 @@ function me(e, t) {
374
379
  }
375
380
  //#endregion
376
381
  //#region ../core/src/rendering/canvas2d/canvasXIndexManager.js
377
- var he = class {
382
+ var ge = class {
378
383
  #e = /* @__PURE__ */ new WeakMap();
379
384
  #t = [0, 0];
380
385
  #n;
@@ -382,7 +387,7 @@ var he = class {
382
387
  if (this.#n = void 0, e.encoders.facetIndex) return this.#r();
383
388
  let t = e.unitView.getCollector(), n = e.unitView.getScaleResolution("x"), r = n?.zoomExtent, i = this.#e.get(e);
384
389
  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);
390
+ let a = he(e);
386
391
  i = {
387
392
  collector: t,
388
393
  dataRevision: t.dataRevision,
@@ -396,21 +401,21 @@ var he = class {
396
401
  }, this.#e.set(e, i);
397
402
  }
398
403
  let a = i.spec;
399
- return !a || !me(a, this.#t) ? this.#r() : (this.#n = i, !0);
404
+ return !a || !Z(a, this.#t) ? this.#r() : (this.#n = i, !0);
400
405
  }
401
406
  query(e, t) {
402
407
  let n = this.#n;
403
408
  if (!n?.spec) throw Error("Canvas x-index query was not prepared.");
404
409
  u("canvasXIndexNativeItems", e.length);
405
410
  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();
411
+ 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
412
  }
408
413
  #r() {
409
414
  return u("canvasXIndexFallbackQueries"), !1;
410
415
  }
411
- }, Z = class {
416
+ }, _e = class {
412
417
  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 = [];
418
+ 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
419
  }
415
420
  computeLayout() {
416
421
  this.broadcast("layout"), this.surface.invalidateSize();
@@ -433,7 +438,7 @@ var he = class {
433
438
  let n = c();
434
439
  n?.beginFrame("canvas");
435
440
  try {
436
- l("render", () => j({
441
+ l("render", () => M({
437
442
  layoutResult: e,
438
443
  context: this.context,
439
444
  width: t.width,
@@ -441,6 +446,7 @@ var he = class {
441
446
  devicePixelRatio: this.surface.getDevicePixelRatio(),
442
447
  background: this.getBackground(),
443
448
  paint: !0,
449
+ textMetrics: this.textMetrics,
444
450
  xIndexManager: this.xIndexManager,
445
451
  opacityLayers: this.opacityLayers
446
452
  })), this.dirtyPickingBuffer = !0;
@@ -454,16 +460,17 @@ var he = class {
454
460
  let t = this.surface.getLogicalCanvasSize();
455
461
  if (isNaN(t.width) || isNaN(t.height)) return;
456
462
  this.surface.clearPickingBuffer();
457
- let n = this.pickingRasterizer, r = !1, i = new le({
463
+ let n = this.pickingRasterizer, r = !1, i = new de({
458
464
  width: t.width,
459
465
  height: t.height,
460
466
  devicePixelRatio: this.surface.getDevicePixelRatio(),
461
- getRasterizer: () => (n || (n = new R(this.surface.getPickingBuffer()), this.pickingRasterizer = n), r ||= (n.resetClip(), n.resetStatistics(), !0), n),
467
+ textMetrics: this.textMetrics,
468
+ getRasterizer: () => (n || (n = new z(this.surface.getPickingBuffer()), this.pickingRasterizer = n), r ||= (n.resetClip(), n.resetStatistics(), !0), n),
462
469
  xIndexManager: this.xIndexManager
463
470
  }), a = c();
464
471
  a?.beginFrame("canvas", "picking");
465
472
  try {
466
- l("picking", () => e.collectRenderCommands(i)), this.dirtyPickingBuffer = !1, r && ge(n, a);
473
+ l("picking", () => e.collectRenderCommands(i)), this.dirtyPickingBuffer = !1, r && ve(n, a);
467
474
  } finally {
468
475
  a?.endFrame();
469
476
  }
@@ -479,14 +486,14 @@ var he = class {
479
486
  });
480
487
  }
481
488
  };
482
- function ge(e, t) {
489
+ function ve(e, t) {
483
490
  if (!t) return;
484
491
  let n = e.getStatistics();
485
492
  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
493
  }
487
494
  //#endregion
488
495
  //#region ../core/src/rendering/canvas2d/picking/softwarePickingBuffer.js
489
- var Q = /* @__PURE__ */ new Uint32Array(), _e = class {
496
+ var Q = /* @__PURE__ */ new Uint32Array(), ye = class {
490
497
  #e = Q;
491
498
  width = 0;
492
499
  height = 0;
@@ -521,7 +528,7 @@ function $(e, t) {
521
528
  }
522
529
  //#endregion
523
530
  //#region ../core/src/rendering/canvas2d/canvas2DSurface.js
524
- var ve = class {
531
+ var be = class {
525
532
  #e;
526
533
  #t;
527
534
  #n;
@@ -531,7 +538,7 @@ var ve = class {
531
538
  if (!n) throw Error("Unable to initialize a Canvas2D rendering context.");
532
539
  this.canvas = t, this.context = n, e.container.appendChild(t);
533
540
  try {
534
- this.#e = new M(e.container, t, e.sizeSource, () => {
541
+ this.#e = new N(e.container, t, e.sizeSource, () => {
535
542
  this.#i() && e.onCanvasResize();
536
543
  }), this.#i();
537
544
  } catch (e) {
@@ -559,7 +566,7 @@ var ve = class {
559
566
  getPickingBuffer() {
560
567
  if (this.#r) throw Error("Canvas2D surface has been finalized.");
561
568
  let e = this.getLogicalCanvasSize();
562
- return this.#n ??= new _e(e.width, e.height), this.#n;
569
+ return this.#n ??= new ye(e.width, e.height), this.#n;
563
570
  }
564
571
  clearPickingBuffer() {
565
572
  this.#n?.clear();
@@ -593,28 +600,32 @@ var ve = class {
593
600
  };
594
601
  //#endregion
595
602
  //#region ../core/src/rendering/canvas2d/index.js
596
- function ye(e) {
597
- let t = new ve(e);
603
+ function xe(e) {
604
+ let t = new be(e), n = ne(e.container.ownerDocument);
598
605
  return {
599
606
  surface: t,
600
- createRenderCoordinator: (e) => new Z({
607
+ textMetrics: n,
608
+ createRenderCoordinator: (e) => new _e({
601
609
  ...e,
602
610
  surface: t,
603
- context: t.context
611
+ context: t.context,
612
+ textMetrics: n
604
613
  }),
605
- exportCanvas: (e) => N({
614
+ exportCanvas: (e) => P({
606
615
  ...e,
607
616
  liveSize: t.getLogicalCanvasSize(),
608
- liveDevicePixelRatio: t.getDevicePixelRatio()
617
+ liveDevicePixelRatio: t.getDevicePixelRatio(),
618
+ textMetrics: n
609
619
  }),
610
- exportRaster: (e) => P({
620
+ exportRaster: (e) => F({
611
621
  ...e,
612
622
  liveSize: t.getLogicalCanvasSize(),
613
- liveDevicePixelRatio: t.getDevicePixelRatio()
623
+ liveDevicePixelRatio: t.getDevicePixelRatio(),
624
+ textMetrics: n
614
625
  }),
615
- rasterizeSvgRuns: (e) => F()(e),
626
+ rasterizeSvgRuns: (e) => I()(e),
616
627
  readPickingId: (e, n) => t.readPickingId(e, n)
617
628
  };
618
629
  }
619
630
  //#endregion
620
- export { ye as createCanvas2DRenderingBackend };
631
+ 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;