@genome-spy/app 0.85.0 → 0.86.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 (56) hide show
  1. package/README.md +28 -0
  2. package/dist/{agentApi-Cz0hCnVp.js → agentApi-DgopQbMV.js} +5019 -6824
  3. package/dist/agentApi.es.js +2757 -2852
  4. package/dist/agentShared.es.js +15 -14
  5. package/dist/canvas2d-8uxuN_vx.js +619 -0
  6. package/dist/canvas2d-BtQC7Xr8.js +619 -0
  7. package/dist/{arrayUtils-LJpQOu-U.js → clipOptions-BQfNhxgP.js} +625 -561
  8. package/dist/{paramUtils-BYI4rwyL.js → clipOptions-taFzEljc.js} +192 -128
  9. package/dist/{debug-BvCZWumf.js → debug-Bzc3SoRg.js} +8 -8
  10. package/dist/{debug-CgDtmspT.js → debug-D_VtWQ6l.js} +8 -8
  11. package/dist/index.es.js +2992 -2915
  12. package/dist/index.js +2006 -2004
  13. package/dist/indexer-qiFctgR3.js +72 -0
  14. package/dist/indexer-qy_dq5l5.js +72 -0
  15. package/dist/layoutResult-D50MSHXR.js +97 -0
  16. package/dist/{nativeText-m5AUINMq.js → nativeText-DFV5XIx8.js} +247 -193
  17. package/dist/{nativeText-DMO8gLt7.js → nativeText-vT3AWE14.js} +244 -190
  18. package/dist/performanceProfiler-CPLEjApa.js +20 -0
  19. package/dist/rasterExport-B8pVoOsj.js +44 -0
  20. package/dist/rasterExport-C4r4xjQT.js +44 -0
  21. package/dist/rasterImage-B4rPLaW9.js +18 -0
  22. package/dist/rasterization-CFogVB3B.js +50 -0
  23. package/dist/rectangle-DKnrAmKs.js +142 -0
  24. package/dist/renderCanvas2D-BQrRWp2Z.js +271 -0
  25. package/dist/renderCanvas2D-CHVNfIUz.js +271 -0
  26. package/dist/schema.json +71 -131
  27. package/dist/{svg-CCu8kYy2.js → svg-C-Sw6E6G.js} +286 -277
  28. package/dist/{svg-yFj875aX.js → svg-CKHwwKRt.js} +278 -269
  29. package/dist/svgRasterizer-BgD72AmG.js +40 -0
  30. package/dist/svgRasterizer-BgSNqI3L.js +40 -0
  31. package/dist/vega-scale-CK0_al6O.js +2700 -0
  32. package/dist/vega-scale-D46-iCaL.js +2700 -0
  33. package/dist/viewError-BiR9VCgL.js +29 -0
  34. package/dist/{viewIdentityRegistry-D3oPbN4O.js → viewIdentityRegistry-B-VGlez1.js} +1 -1
  35. package/dist/{viewIdentityRegistry-BUdkK9zT.js → viewIdentityRegistry-CDtVktJD.js} +1 -1
  36. package/dist/viewSelectors-CKfxF_LM.js +1817 -0
  37. package/dist/viewSelectors-D_imtq5Z.js +1817 -0
  38. package/dist/viewUtils-nCJ7AoaI.js +5782 -0
  39. package/dist/webgl-BaA3jSa2.js +4128 -0
  40. package/dist/webgl-FP-4EsBL.js +4128 -0
  41. package/package.json +7 -6
  42. package/dist/bmFontMetrics-CuNB-kNN.js +0 -31
  43. package/dist/canvas2d-DoAXEiF9.js +0 -309
  44. package/dist/canvas2d-f5jl4A5D.js +0 -310
  45. package/dist/clipOptions-gqdb3fvW.js +0 -43
  46. package/dist/color-W5zffv-z.js +0 -335
  47. package/dist/framebufferReadback-CCLOjStu.js +0 -148
  48. package/dist/framebufferReadback-THWwFqs8.js +0 -1994
  49. package/dist/twgl-full.module-DB2UdP1k.js +0 -1849
  50. package/dist/viewRenderingContext-HtpqwS_x.js +0 -120
  51. package/dist/viewSelectors-DGCspRN3.js +0 -4198
  52. package/dist/viewSelectors-U5oLCLHV.js +0 -4195
  53. package/dist/viewUtils-Dg4RA40Q.js +0 -7503
  54. package/dist/warning-DRGdb6BF.js +0 -59
  55. package/dist/webgl-Ci6ZhCCf.js +0 -54
  56. package/dist/webgl-Dpz8a3TI.js +0 -53
@@ -0,0 +1,271 @@
1
+ import { Jt as e, a as t, o as n, s as r } from "./clipOptions-taFzEljc.js";
2
+ import { t as i } from "./warning-CpIIpk8e.js";
3
+ import { n as a } from "./performanceProfiler-CPLEjApa.js";
4
+ import { n as o } from "./layoutResult-D50MSHXR.js";
5
+ import { C as s, E as c, O as l, S as u, T as d, _ as f, a as p, c as m, d as h, f as g, h as _, i as v, k as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, w as k, y as A } from "./nativeText-vT3AWE14.js";
6
+ //#region ../core/src/rendering/canvas2d/renderers/arrow.js
7
+ function j(e, t) {
8
+ let n = e, r = t.context, i = n.encoders, a = _(n);
9
+ r.lineJoin = "miter";
10
+ let o, c;
11
+ return f(n, a, t, (e) => {
12
+ e.headShapeFallback && t.warn(`Canvas2D rendered unsupported arrow headShape "${a.headShape}" as a triangle.`), r.beginPath();
13
+ for (let t of e.boundaryLoops) {
14
+ let e = t[0];
15
+ r.moveTo(e.x, e.y);
16
+ for (let e = 1; e < t.length; e++) r.lineTo(t[e].x, t[e].y);
17
+ r.closePath();
18
+ }
19
+ let n = s(i.fill(e.datum)), l = A(i.fillOpacity, e.datum) * t.viewOpacity;
20
+ n != "none" && l > 0 && (o != n && (r.fillStyle = n, o = n), r.globalAlpha = l, r.fill());
21
+ let u = s(i.stroke(e.datum)), d = A(i.strokeOpacity, e.datum) * t.viewOpacity;
22
+ u != "none" && d > 0 && e.strokeWidth > 0 && (c != u && (r.strokeStyle = u, c = u), r.globalAlpha = d, r.lineWidth = e.strokeWidth, r.stroke());
23
+ });
24
+ }
25
+ //#endregion
26
+ //#region ../core/src/rendering/canvas2d/renderers/link.js
27
+ function M(e, t) {
28
+ let n = e, r = t.context, i = n.encoders, a = u(n, n.properties.arcFadingDistance), o = w(n);
29
+ o.shape == "arc" && a !== !1 && a[0] > 0 && a[1] > 0 && t.warn("Canvas2D ignored unsupported link arc fading."), r.lineCap = "butt";
30
+ let c;
31
+ return x(n, o, t, (e) => {
32
+ let n = s(i.color(e.datum)), a = A(i.opacity, e.datum) * t.viewOpacity;
33
+ if (n == "none" || a <= 0 || e.strokeWidth <= 0) return;
34
+ c != n && (r.strokeStyle = n, c = n), r.globalAlpha = a, r.lineWidth = e.strokeWidth;
35
+ let [o, l, u, d] = e.points;
36
+ r.beginPath(), r.moveTo(o[0], o[1]), r.bezierCurveTo(l[0], l[1], u[0], u[1], d[0], d[1]), r.stroke();
37
+ });
38
+ }
39
+ //#endregion
40
+ //#region ../core/src/rendering/canvas2d/renderers/point.js
41
+ function N(e, t) {
42
+ let n = e;
43
+ u(n, n.properties.fillGradientStrength) && t.warn("Canvas2D ignored unsupported point property fillGradientStrength."), n.properties.geometricZoomBound && t.warn("Canvas2D ignored unsupported point property geometricZoomBound.");
44
+ let r = h(n), i = t.context, a = n.encoders, o, c;
45
+ return g(n, r, t, (e) => {
46
+ let n = e.datum, r = e.lineShape, l = s(a.fill(n)), u = A(a.fillOpacity, n) * t.viewOpacity, d = s(a.stroke(n)), f = A(a.strokeOpacity, n) * t.viewOpacity;
47
+ r && (d == "none" || f <= 0) && (d = l, f = u), i.beginPath();
48
+ let p = e.angle != 0 && e.shape != "circle";
49
+ p && (i.save(), i.translate(e.x, e.y), i.rotate(e.angle * Math.PI / 180));
50
+ let m = p ? 0 : e.x, h = p ? 0 : e.y, g = !0;
51
+ if (e.shape == "circle") i.arc(m, h, e.geometryRadius, 0, Math.PI * 2);
52
+ else if (e.shape == "square") {
53
+ let t = e.geometryRadius * 2;
54
+ i.rect(m - e.geometryRadius, h - e.geometryRadius, t, t);
55
+ } else g = O(e.shape, m, h, e.geometryRadius, i);
56
+ p && i.restore(), g || (t.warn(`Canvas2D rendered unsupported point shape "${e.shape}" as a circle.`), i.arc(e.x, e.y, e.geometryRadius, 0, Math.PI * 2)), !r && l != "none" && u > 0 && (o != l && (i.fillStyle = l, o = l), P(i, u), i.fill()), d != "none" && f > 0 && e.strokeWidth > 0 && (r && i.lineCap != "butt" && (i.lineCap = "butt"), c != d && (i.strokeStyle = d, c = d), P(i, f), F(i, e.strokeWidth), i.stroke());
57
+ });
58
+ }
59
+ function P(e, t) {
60
+ e.globalAlpha != t && (e.globalAlpha = t);
61
+ }
62
+ function F(e, t) {
63
+ e.lineWidth != t && (e.lineWidth = t);
64
+ }
65
+ //#endregion
66
+ //#region ../core/src/rendering/canvas2d/renderers/rect.js
67
+ function I(e, t) {
68
+ let n = e, r = m(n);
69
+ r.hatch != "none" && t.warn("Canvas2D ignored unsupported rect hatch.");
70
+ let i = t.start ?? 0;
71
+ if (i === (t.end ?? t.data.length)) return 0;
72
+ let a = t.context, o = n.encoders, c, l, u = [
73
+ 0,
74
+ 0,
75
+ 0,
76
+ 0
77
+ ], d = o.stroke.constant, f = o.strokeOpacity.constant, p = d ? s(o.stroke(t.data[i])) : "none", h = d && p == "none", g = !h && f ? A(o.strokeOpacity, t.data[i]) : 0;
78
+ return b(n, r, t, (e) => {
79
+ r.shadow.opacity > 0 && L(e, r.shadow, t, u);
80
+ let n = e.opacityFactor, i = e.fill != "none" && e.fillOpacity > 0, m = d ? p : s(o.stroke(e.datum)), _ = (f ? g : A(o.strokeOpacity, e.datum)) * t.viewOpacity * n, v = !h && m != "none" && _ > 0 && e.strokeWidth > 0, y = r.hasCornerRadii && (e.radii.topLeft != 0 || e.radii.topRight != 0 || e.radii.bottomRight != 0 || e.radii.bottomLeft != 0);
81
+ y && (i || v) && (u[0] = e.radii.topLeft, u[1] = e.radii.topRight, u[2] = e.radii.bottomRight, u[3] = e.radii.bottomLeft, a.beginPath(), a.roundRect(e.x, e.y, e.width, e.height, u)), i && (c != e.fill && (a.fillStyle = e.fill, c = e.fill), R(a, e.fillOpacity * n), y ? a.fill() : a.fillRect(e.x, e.y, e.width, e.height)), v && (l != m && (a.strokeStyle = m, l = m), R(a, _), z(a, e.strokeWidth), y ? a.stroke() : a.strokeRect(e.x, e.y, e.width, e.height));
82
+ });
83
+ }
84
+ function L(e, t, n, r) {
85
+ let { context: i, devicePixelRatio: a, visibleBounds: o } = n, s = e.strokeWidth / 2, c = e.x - s, l = e.y - s, u = e.width + s * 2, d = e.height + s * 2;
86
+ r[0] = e.radii.topLeft + s, r[1] = e.radii.topRight + s, r[2] = e.radii.bottomRight + s, r[3] = e.radii.bottomLeft + s, i.save();
87
+ try {
88
+ i.beginPath(), i.rect(o.x1, o.y1, o.x2 - o.x1, o.y2 - o.y1), i.roundRect(c, l, u, d, r), i.clip("evenodd"), i.shadowBlur = Math.max(t.blur / 2.5, .25) * 2 * a, i.shadowOffsetX = t.offsetX * a, i.shadowOffsetY = t.offsetY * a, i.shadowColor = t.color, i.globalAlpha = t.opacity * n.viewOpacity, i.fillStyle = "black", i.beginPath(), i.roundRect(c, l, u, d, r), i.fill();
89
+ } finally {
90
+ i.restore();
91
+ }
92
+ }
93
+ function R(e, t) {
94
+ e.globalAlpha != t && (e.globalAlpha = t);
95
+ }
96
+ function z(e, t) {
97
+ e.lineWidth != t && (e.lineWidth = t);
98
+ }
99
+ //#endregion
100
+ //#region ../core/src/rendering/canvas2d/renderers/rule.js
101
+ function B(e, t) {
102
+ let n = e, r = t.context, i = n.encoders;
103
+ r.lineCap = u(n, n.properties.strokeCap), r.setLineDash(u(n, n.properties.strokeDash) ?? []), r.lineDashOffset = u(n, n.properties.strokeDashOffset);
104
+ let a;
105
+ return E(n, C(n), t, (e) => {
106
+ let n = s(i.color(e.datum)), o = A(i.opacity, e.datum) * t.viewOpacity;
107
+ n == "none" || o <= 0 || e.strokeWidth <= 0 || (a != n && (r.strokeStyle = n, a = n), r.globalAlpha = o, r.lineWidth = e.strokeWidth, r.beginPath(), r.moveTo(e.x1, e.y1), r.lineTo(e.x2, e.y2), r.stroke());
108
+ });
109
+ }
110
+ //#endregion
111
+ //#region ../core/src/rendering/canvas2d/renderers/text.js
112
+ function V(e, t) {
113
+ let n = e, r = n.properties, i = v(n), a = t.context, o = n.encoders, c = D(r.font), l = `${r.fontStyle ?? "normal"} ${T(r.fontWeight ?? "normal")} `, d = i.baseline == "baseline" ? "alphabetic" : i.baseline;
114
+ [
115
+ r.viewportEdgeFadeWidthTop,
116
+ r.viewportEdgeFadeWidthRight,
117
+ r.viewportEdgeFadeWidthBottom,
118
+ r.viewportEdgeFadeWidthLeft
119
+ ].some((e) => u(n, e) > 0) && t.warn("Canvas2D ignored unsupported text viewport edge fading.");
120
+ let f, m;
121
+ return i.logoLetters || (a.textAlign = i.align, a.textBaseline = d), p(n, i, t, (e) => {
122
+ e.multiCharacterLogo && t.warn("Canvas2D stretches multi-character logo text as a single glyph cell.");
123
+ let n = s(o.color(e.datum)), r = A(o.opacity, e.datum) * t.viewOpacity * e.fadeOpacity;
124
+ if (!(n == "none" || r <= 0)) if (f != n && (a.fillStyle = n, f = n), a.globalAlpha = r, m != e.size && (a.font = `${l}${e.size}px ${c}`, m = e.size), e.logoScale) {
125
+ a.save(), a.translate(e.x, e.y), a.rotate(e.angle * Math.PI / 180), a.translate(e.dx, e.dy);
126
+ let t = a.measureText(e.text).width;
127
+ a.scale(e.logoScale.width / t, e.logoScale.heightScale), a.textAlign = "center", a.textBaseline = "alphabetic", a.fillText(e.text, 0, S("middle", 1)), a.restore();
128
+ } else e.angle ? (a.save(), a.translate(e.x, e.y), a.rotate(e.angle * Math.PI / 180), a.fillText(e.text, e.dx, e.dy, e.width), a.restore()) : a.fillText(e.text, e.x + e.dx, e.y + e.dy, e.width);
129
+ });
130
+ }
131
+ //#endregion
132
+ //#region ../core/src/rendering/canvas2d/renderers/index.js
133
+ function H(e, t) {
134
+ return e.getType() == "arrow" ? j(e, t) : e.getType() == "link" ? M(e, t) : e.getType() == "rect" ? I(e, t) : e.getType() == "point" ? N(e, t) : e.getType() == "rule" || e.getType() == "tick" ? B(e, t) : e.getType() == "text" ? V(e, t) : (t.warn(`Canvas2D rendering is not implemented for mark type "${e.getType()}".`), 0);
135
+ }
136
+ //#endregion
137
+ //#region ../core/src/rendering/sampleFacet.js
138
+ function U(e) {
139
+ let t = e.pixelToUnit, n = e.locSize.location * t, r = e.locSize.size * t;
140
+ return !(n > 1 || n + r < 0);
141
+ }
142
+ //#endregion
143
+ //#region ../core/src/rendering/canvas2d/canvas2DViewRenderingContext.js
144
+ var W = 8, G = 16777216, K = class extends o {
145
+ #e = [];
146
+ #t = /* @__PURE__ */ new WeakSet();
147
+ #n = /* @__PURE__ */ new WeakMap();
148
+ #r;
149
+ #i;
150
+ #a = new l();
151
+ #o;
152
+ #s = [0, 0];
153
+ #c;
154
+ #l;
155
+ #u = [];
156
+ constructor(e, t) {
157
+ if (super(e), this.context = t.context, this.width = t.width, this.height = t.height, this.devicePixelRatio = t.devicePixelRatio, this.paint = t.paint, this.#r = t.markPredicate ?? (() => !0), this.#i = a(), this.#o = t.xIndexManager, this.#l = t.opacityLayers ?? [], this.#c = {
158
+ x: 0,
159
+ y: 0,
160
+ width: this.context.canvas.width,
161
+ height: this.context.canvas.height
162
+ }, this.paint) {
163
+ let e = this.context;
164
+ e.resetTransform(), e.clearRect(0, 0, e.canvas.width, e.canvas.height), e.setTransform(this.devicePixelRatio, 0, 0, this.devicePixelRatio, 0, 0), e.globalAlpha = 1, e.globalCompositeOperation = "source-over", t.background != null && (e.fillStyle = t.background, e.fillRect(0, 0, this.width, this.height));
165
+ }
166
+ }
167
+ getDevicePixelRatio() {
168
+ return this.devicePixelRatio;
169
+ }
170
+ pushView(e, n) {
171
+ this.paint && !this.#t.has(e) && (e.onBeforeRender(), this.#t.add(e));
172
+ let r = e.getOpacity();
173
+ if (this.paint && r > 0 && r !== 1) {
174
+ let r = t(e), i = q(n, this.devicePixelRatio, this.#c, r), a = J(this.#l, this.#u.length, i.width, i.height);
175
+ a.setTransform(this.devicePixelRatio, 0, 0, this.devicePixelRatio, -i.x, -i.y), this.#u.push({
176
+ context: this.context,
177
+ bounds: this.#c
178
+ }), this.context = a, this.#c = i;
179
+ }
180
+ this.#e.push({
181
+ view: e,
182
+ coords: n,
183
+ opacity: r
184
+ });
185
+ }
186
+ popView(e) {
187
+ let t = this.#e.pop();
188
+ if (t?.view !== e) throw Error("Unbalanced Canvas2D view rendering context stack.");
189
+ if (this.paint && t.opacity > 0 && t.opacity !== 1) {
190
+ let e = this.#u.pop();
191
+ if (!e) throw Error("Missing Canvas2D opacity parent target.");
192
+ let n = this.context.canvas, r = this.#c;
193
+ this.context = e.context, this.#c = e.bounds, this.context.save();
194
+ try {
195
+ this.context.globalAlpha = t.opacity, r.width && r.height && this.context.drawImage(n, r.x / this.devicePixelRatio, r.y / this.devicePixelRatio, r.width / this.devicePixelRatio, r.height / this.devicePixelRatio);
196
+ } finally {
197
+ this.context.restore();
198
+ }
199
+ }
200
+ }
201
+ renderMark(e, t) {
202
+ if (!this.paint || !this.#r(e)) return;
203
+ let a = this.#n.get(e.unitView);
204
+ if (a === void 0 && (a = e.unitView.getEffectiveOpacity(), this.#n.set(e.unitView, a)), a <= 0) return;
205
+ e.initializeRenderingRevisions([]);
206
+ let o = t.sampleFacetRenderingOptions;
207
+ if (o && !e.encoders.facetIndex && (this.#i?.addCount("canvasSampleFacetOccurrences"), !U(o))) {
208
+ this.#i?.addCount("canvasCulledSampleFacetOccurrences");
209
+ return;
210
+ }
211
+ let s = this.currentCoords, l = n(t), u = r(l, e.properties.clip, s), f = d(this.width, this.height, u);
212
+ if (!c(f)) return;
213
+ let p = k(s, l, e.properties.cullByVisibleRange), m = this.#o?.prepare(e) ?? !1, h = this.context;
214
+ if (h.save(), u) {
215
+ let e = u.rect.flatten(), t = u.clipX ? e.x : 0, n = u.clipY ? e.y : 0, r = u.clipX ? e.width : this.width, i = u.clipY ? e.height : this.height;
216
+ h.beginPath(), h.rect(t, n, r, i), h.clip();
217
+ }
218
+ try {
219
+ y(e, t, s, this.#a, (t, n) => {
220
+ let r = 0, a = n.length;
221
+ return m && this.#o.query(n, this.#s) && (r = this.#s[0], a = this.#s[1]), H(e, {
222
+ context: h,
223
+ devicePixelRatio: this.devicePixelRatio,
224
+ coords: t,
225
+ data: n,
226
+ start: r,
227
+ end: a,
228
+ visibleBounds: f,
229
+ anchorCullBounds: p,
230
+ viewOpacity: 1,
231
+ warn: (t) => i(`${t} View: ${e.unitView.getPathString()}`)
232
+ });
233
+ }, (t) => i(`Canvas2D could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`));
234
+ } finally {
235
+ h.restore();
236
+ }
237
+ }
238
+ get currentCoords() {
239
+ let t = e(this.#e);
240
+ if (!t) throw Error("No current view in Canvas2D rendering context.");
241
+ return t.coords;
242
+ }
243
+ };
244
+ function q(e, t, n, r) {
245
+ let i = n.x + n.width, a = n.y + n.height, o = r.clipX ? Y(Math.floor(e.x * t), n.x, i) : n.x, s = r.clipY ? Y(Math.floor(e.y * t), n.y, a) : n.y, c = r.clipX ? Y(Math.ceil((e.x + e.width) * t), o, i) : i, l = r.clipY ? Y(Math.ceil((e.y + e.height) * t), s, a) : a;
246
+ return {
247
+ x: o,
248
+ y: s,
249
+ width: c - o,
250
+ height: l - s
251
+ };
252
+ }
253
+ function J(e, t, n, r) {
254
+ let i = n * r, a = e[t], o = e.reduce((e, n, r) => r === t ? e : e + n.canvas.width * n.canvas.height, 0), s = t < W && o + i <= G;
255
+ if (!a || !s) {
256
+ if (a = document.createElement("canvas").getContext("2d"), !a) throw Error("Unable to create a Canvas2D view group.");
257
+ s && (e[t] = a);
258
+ }
259
+ return a.canvas.width != n || a.canvas.height != r ? (a.canvas.width = n, a.canvas.height = r) : (a.resetTransform(), a.clearRect(0, 0, n, r)), a.globalAlpha = 1, a.globalCompositeOperation = "source-over", a;
260
+ }
261
+ function Y(e, t, n) {
262
+ return Math.min(n, Math.max(t, e));
263
+ }
264
+ //#endregion
265
+ //#region ../core/src/rendering/canvas2d/renderCanvas2D.js
266
+ function X(e) {
267
+ let t = new K({ picking: !1 }, e);
268
+ e.layoutResult.collectRenderCommands(t);
269
+ }
270
+ //#endregion
271
+ export { U as n, X as t };