@genome-spy/app 1.1.0 → 1.2.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 (47) hide show
  1. package/dist/{agentApi-BgZUOeB-.js → agentApi-8hMSlqAQ.js} +8459 -6960
  2. package/dist/agentApi.es.js +5609 -4236
  3. package/dist/agentShared.es.js +9 -9
  4. package/dist/{canvas2d-DiPQvNtZ.js → canvas2d-Bd8H8MMo.js} +149 -134
  5. package/dist/{canvas2d-t_N10CeW.js → canvas2d-D6VYooRf.js} +136 -122
  6. package/dist/{clipOptions-Cba4I0AO.js → clipOptions-DElJ8dTZ.js} +2274 -2080
  7. package/dist/{clipOptions-B5PibDq3.js → clipOptions-D_wBNhzs.js} +2121 -1957
  8. package/dist/{viewIdentityRegistry-BW415b3o.js → containerView-CRJSc4bM.js} +24 -31
  9. package/dist/{viewIdentityRegistry-_F0E7nkA.js → containerView-aEVmYmkA.js} +24 -31
  10. package/dist/{debug-DP4WzTNo.js → debug-CQ0agCrd.js} +9 -9
  11. package/dist/{debug-CVAlrcZt.js → debug-DkIMiGdW.js} +10 -10
  12. package/dist/index.es.js +1133 -1115
  13. package/dist/index.js +757 -513
  14. package/dist/{indexer-En7gpvLN.js → indexer-DDC0YRGn.js} +1 -1
  15. package/dist/{indexer-DbFTKGlm.js → indexer-DOYMJ-Md.js} +1 -1
  16. package/dist/markUtils-CvLDz744.js +75 -0
  17. package/dist/{metadataChannels-DV62inJh.js → metadataChannels-DLSmx7kU.js} +6 -3
  18. package/dist/{order-R043xTpC.js → order-BVvkjDRT.js} +369 -316
  19. package/dist/{order-BkYCnwD7.js → order-DmMoZsi1.js} +360 -308
  20. package/dist/{rasterExport-C_FcNBkC.js → rasterExport-DxvowWjH.js} +4 -4
  21. package/dist/{rasterExport-Z7gs5346.js → rasterExport-jeRVq6kY.js} +4 -4
  22. package/dist/rasterization-CFogVB3B.js +50 -0
  23. package/dist/rasterization-DFj3Cvx4.js +67 -0
  24. package/dist/{rectangle-DE98gIxF.js → rectangle-DZTR6NFQ.js} +10 -1
  25. package/dist/rectangle-Dl4Dy0hS.js +191 -0
  26. package/dist/{renderCanvas2D-DK1c9TFK.js → renderCanvas2D-Bfm1NHFu.js} +99 -94
  27. package/dist/{renderCanvas2D-IM-A9DYG.js → renderCanvas2D-DVjhp834.js} +101 -96
  28. package/dist/scalePosition-0aeqp_kz.js +18 -0
  29. package/dist/schema.json +27198 -13709
  30. package/dist/style.css +1 -1
  31. package/dist/{svg-DW3tfUmm.js → svg-Bm2zxBPu.js} +316 -317
  32. package/dist/{svg-PabUdcDi.js → svg-CkfuhONt.js} +290 -291
  33. package/dist/{svgRasterizer-B6YtWLJs.js → svgRasterizer-DoRQEqFA.js} +3 -3
  34. package/dist/{svgRasterizer-BEVDyyS3.js → svgRasterizer-raDDhBF-.js} +3 -3
  35. package/dist/{vega-scale-Byaw1K8O.js → vega-scale-BoGHANI7.js} +90 -90
  36. package/dist/{vega-scale-Ctz_wa3z.js → vega-scale-o9TRyzYH.js} +699 -699
  37. package/dist/viewError-BkJeVYXA.js +33 -0
  38. package/dist/viewError-IYqyluc7.js +33 -0
  39. package/dist/{viewSelectors-KtD-QSN0.js → viewSelectors-7LyasQN-.js} +572 -478
  40. package/dist/{viewSelectors-DYz-PhTO.js → viewSelectors-CbmkSQRT.js} +624 -530
  41. package/dist/{viewUtils-BZGPseMx.js → viewUtils-DuddMNNw.js} +2146 -2016
  42. package/dist/{webgl-tdKf9SlZ.js → webgl-CQfvgnxo.js} +1247 -1137
  43. package/dist/{webgl-BKSGqHaz.js → webgl-DVYkXtiZ.js} +1495 -1386
  44. package/package.json +4 -4
  45. package/src/spec/view.d.ts +44 -5
  46. package/dist/rasterization-_-9JmSas.js +0 -63
  47. package/dist/viewError-BiR9VCgL.js +0 -29
@@ -1,8 +1,8 @@
1
- import { t as e } from "./rasterization-_-9JmSas.js";
2
- import { t } from "./rectangle-DE98gIxF.js";
1
+ import { t as e } from "./rasterization-CFogVB3B.js";
2
+ import { t } from "./rectangle-DZTR6NFQ.js";
3
3
  import { t as n } from "./layoutResult-D50MSHXR.js";
4
- import { r } from "./order-BkYCnwD7.js";
5
- import { t as i } from "./renderCanvas2D-DK1c9TFK.js";
4
+ import { r } from "./order-BVvkjDRT.js";
5
+ import { t as i } from "./renderCanvas2D-DVjhp834.js";
6
6
  //#region ../core/src/rendering/canvas2d/rasterExport.js
7
7
  async function a(e) {
8
8
  let t = e.mimeType ?? "image/png";
@@ -1,8 +1,8 @@
1
- import { t as e } from "./rasterization-_-9JmSas.js";
2
- import { t } from "./rectangle-DE98gIxF.js";
1
+ import { t as e } from "./rasterization-DFj3Cvx4.js";
2
+ import { t } from "./rectangle-Dl4Dy0hS.js";
3
3
  import { t as n } from "./layoutResult-D50MSHXR.js";
4
- import { r } from "./order-R043xTpC.js";
5
- import { t as i } from "./renderCanvas2D-IM-A9DYG.js";
4
+ import { r } from "./order-DmMoZsi1.js";
5
+ import { t as i } from "./renderCanvas2D-Bfm1NHFu.js";
6
6
  //#region ../core/src/rendering/canvas2d/rasterExport.js
7
7
  async function a(e) {
8
8
  let t = e.mimeType ?? "image/png";
@@ -0,0 +1,50 @@
1
+ //#region ../core/src/rendering/renderingModuleRegistry.js
2
+ var e = {}, t = class extends Error {
3
+ constructor(e, t) {
4
+ super(e, t), this.name = "RasterizationUnavailableError";
5
+ }
6
+ };
7
+ async function n(n, r) {
8
+ if (n.exportRaster) try {
9
+ return await n.exportRaster(r);
10
+ } catch (e) {
11
+ if (!(e instanceof t)) throw e;
12
+ }
13
+ if (!e.canvasRasterExport) throw i();
14
+ let a;
15
+ try {
16
+ a = await e.canvasRasterExport();
17
+ } catch (e) {
18
+ throw i(e);
19
+ }
20
+ try {
21
+ return await a.exportRaster({
22
+ ...r,
23
+ liveSize: n.surface.getLogicalCanvasSize(),
24
+ liveDevicePixelRatio: n.surface.getDevicePixelRatio()
25
+ });
26
+ } catch (e) {
27
+ throw e instanceof t ? i(e) : e;
28
+ }
29
+ }
30
+ async function r(n, r) {
31
+ if (n.rasterizeSvgRuns) try {
32
+ await n.rasterizeSvgRuns(r);
33
+ return;
34
+ } catch (e) {
35
+ if (!(e instanceof t)) throw e;
36
+ }
37
+ if (!e.canvasSvgRasterizer) throw new t("No raster backend supports selective SVG rasterization. Import \"@genome-spy/core/rendering/canvas.js\" to enable the Canvas2D fallback.");
38
+ let i;
39
+ try {
40
+ i = await e.canvasSvgRasterizer();
41
+ } catch (e) {
42
+ throw new t("No raster backend supports selective SVG rasterization.", { cause: e });
43
+ }
44
+ await i.createCanvas2DSvgRasterizer()(r);
45
+ }
46
+ function i(e) {
47
+ return new t("Raster export is unsupported because no raster rendering backend is available. Import \"@genome-spy/core/rendering/canvas.js\" to enable the Canvas2D fallback.", { cause: e });
48
+ }
49
+ //#endregion
50
+ export { e as i, n, r, t };
@@ -0,0 +1,67 @@
1
+ //#region ../core/src/scales/scalePosition.js
2
+ function e(e, t = .5) {
3
+ if (e.type == "band" || e.type == "point") return e.bandwidth() * t;
4
+ if (e.type == "index" || e.type == "locus") {
5
+ let n = e;
6
+ return Math.sign(n.step()) * n.bandwidth() * t;
7
+ }
8
+ return 0;
9
+ }
10
+ function t(e, t, n) {
11
+ if ("gapMapping" in e) {
12
+ let r = e;
13
+ return r.gapMapping(n)?.invertPoint(t).value ?? r.invert(t);
14
+ }
15
+ return e.invert(t);
16
+ }
17
+ //#endregion
18
+ //#region ../core/src/rendering/renderingModuleRegistry.js
19
+ var n = {}, r = class extends Error {
20
+ constructor(e, t) {
21
+ super(e, t), this.name = "RasterizationUnavailableError";
22
+ }
23
+ };
24
+ async function i(e, t) {
25
+ if (e.exportRaster) try {
26
+ return await e.exportRaster(t);
27
+ } catch (e) {
28
+ if (!(e instanceof r)) throw e;
29
+ }
30
+ if (!n.canvasRasterExport) throw o();
31
+ let i;
32
+ try {
33
+ i = await n.canvasRasterExport();
34
+ } catch (e) {
35
+ throw o(e);
36
+ }
37
+ try {
38
+ return await i.exportRaster({
39
+ ...t,
40
+ liveSize: e.surface.getLogicalCanvasSize(),
41
+ liveDevicePixelRatio: e.surface.getDevicePixelRatio()
42
+ });
43
+ } catch (e) {
44
+ throw e instanceof r ? o(e) : e;
45
+ }
46
+ }
47
+ async function a(e, t) {
48
+ if (e.rasterizeSvgRuns) try {
49
+ await e.rasterizeSvgRuns(t);
50
+ return;
51
+ } catch (e) {
52
+ if (!(e instanceof r)) throw e;
53
+ }
54
+ if (!n.canvasSvgRasterizer) throw new r("No raster backend supports selective SVG rasterization. Import \"@genome-spy/core/rendering/canvas.js\" to enable the Canvas2D fallback.");
55
+ let i;
56
+ try {
57
+ i = await n.canvasSvgRasterizer();
58
+ } catch (e) {
59
+ throw new r("No raster backend supports selective SVG rasterization.", { cause: e });
60
+ }
61
+ await i.createCanvas2DSvgRasterizer()(t);
62
+ }
63
+ function o(e) {
64
+ return new r("Raster export is unsupported because no raster rendering backend is available. Import \"@genome-spy/core/rendering/canvas.js\" to enable the Canvas2D fallback.", { cause: e });
65
+ }
66
+ //#endregion
67
+ export { e as a, n as i, i as n, t as o, a as r, r as t };
@@ -6,6 +6,15 @@ var t = class t {
6
6
  static create(n, r, i, a) {
7
7
  return new t(e(n), e(r), e(i), e(a));
8
8
  }
9
+ static unionAll(e) {
10
+ if (!e.length) return;
11
+ let { x: n, y: r, x2: i, y2: a } = e[0];
12
+ for (let t = 1; t < e.length; t++) {
13
+ let o = e[t];
14
+ n = Math.min(n, o.x), r = Math.min(r, o.y), i = Math.max(i, o.x2), a = Math.max(a, o.y2);
15
+ }
16
+ return t.create(n, r, i - n, a - r);
17
+ }
9
18
  static ZERO = t.create(0, 0, 0, 0);
10
19
  _offset(e, t) {
11
20
  let n = this["_" + e];
@@ -55,7 +64,7 @@ var t = class t {
55
64
  return e === 0 && n === 0 ? this : new t(this._offset("x", e), this._offset("y", n), this._passThrough("width"), this._passThrough("height"));
56
65
  }
57
66
  translateBy(e) {
58
- return this.translate(e.x, e.y);
67
+ return this.translate(() => e.x, () => e.y);
59
68
  }
60
69
  expand(e, n = 1) {
61
70
  return e.left == 0 && e.top == 0 && e.right == 0 && e.bottom == 0 ? this : new t(e.left ? this._offset("x", -e.left * n) : this._passThrough("x"), e.top ? this._offset("y", -e.top * n) : this._passThrough("y"), e.width ? this._offset("width", e.width * n) : this._passThrough("width"), e.height ? this._offset("height", e.height * n) : this._passThrough("height"));
@@ -0,0 +1,191 @@
1
+ import { Tt as e, c as t, dt as n, ft as r, it as i, u as a } from "./clipOptions-DElJ8dTZ.js";
2
+ //#region ../core/src/marks/markUtils.js
3
+ var o = Symbol("half-open interval peer");
4
+ function s(e) {
5
+ return e?.[o];
6
+ }
7
+ function c(e, t) {
8
+ let r = n(t), s = i(e[t]), c = i(e[r]);
9
+ s && c && ["index", "locus"].includes(s.type) && (e[t] = a(e[t], {
10
+ ...e[t],
11
+ [o]: r
12
+ }), e[r] = a(e[r], {
13
+ ...e[r],
14
+ [o]: t
15
+ }));
16
+ }
17
+ function l(t) {
18
+ for (let r of ["x", "y"]) {
19
+ let a = n(r), o = t[r], s = t[a];
20
+ if (o && s && e(o) && !i(o) && i(s)) throw Error(`Cannot combine encoding.${r}.value with scale-backed encoding.${a}. Use encoding.${r}.datum for a constant data-domain endpoint, or use encoding.${a}.value for a visual-domain endpoint.`);
21
+ }
22
+ }
23
+ function u(t, i, o = !1) {
24
+ let s = n(i);
25
+ c(t, i);
26
+ let l = t[i] && a(t[i], { ...t[i] }), u = t[s] && a(t[s], { ...t[s] });
27
+ if (!(e(l) || e(u))) {
28
+ if (l) {
29
+ if (!r(t[i])) return;
30
+ if (!u) {
31
+ if (l.type == "quantitative") u = {
32
+ datum: 0,
33
+ domainInert: !0
34
+ };
35
+ else {
36
+ u = a(l, { ...l });
37
+ let e = (1 - (l.band ?? 1)) / 2;
38
+ l.band = 0 + e, u.band = o ? l.band : 1 - e;
39
+ }
40
+ } else if (l.type != "quantitative") {
41
+ let e = (1 - (l.band || 1)) / 2;
42
+ l.band = e, u.band = -e;
43
+ }
44
+ } else l = { value: 0 }, u = { value: 1 };
45
+ t[i] = l, t[s] = u;
46
+ }
47
+ }
48
+ function d(t, i) {
49
+ c(t, i);
50
+ let o = n(i), s = t[i], l = t[o];
51
+ if (!s || !l || e(s) || e(l) || !r(s) || !r(l) || !["index", "locus"].includes(s.type)) return;
52
+ let u = s.band, d = l.band, f = u ?? d ?? 0;
53
+ t[i] = a(s, {
54
+ ...s,
55
+ band: f
56
+ }), t[o] = a(l, {
57
+ ...l,
58
+ band: d ?? f
59
+ });
60
+ }
61
+ function f(e, t) {
62
+ let n = i(e);
63
+ n && (n.resolutionChannel = t);
64
+ }
65
+ function p(n, r) {
66
+ n.stroke || (r ? n.stroke = { value: null } : (n.stroke = t(n.color), f(n.stroke, "color"))), e(n.stroke) && n.stroke.value === null && (n.strokeWidth = { value: 0 }), n.strokeOpacity || (n.strokeOpacity = t(n.opacity), f(n.strokeOpacity, "opacity"));
67
+ }
68
+ function m(n, r) {
69
+ e(n.fill) && n.fill.value === null ? n.fillOpacity = { value: 0 } : n.fill || (n.fill = t(n.color), f(n.fill, "color"), !r && !n.fillOpacity && (n.fillOpacity = { value: 0 })), n.fillOpacity || (r ? (n.fillOpacity = t(n.opacity), f(n.fillOpacity, "opacity")) : n.fillOpacity = { value: 0 });
70
+ }
71
+ function h(e, t) {
72
+ return e.properties.clamp === !0 || e.properties.clamp === t;
73
+ }
74
+ //#endregion
75
+ //#region ../core/src/view/layout/rectangle.js
76
+ function g(e) {
77
+ return () => e;
78
+ }
79
+ var _ = class e {
80
+ static create(t, n, r, i) {
81
+ return new e(g(t), g(n), g(r), g(i));
82
+ }
83
+ static unionAll(t) {
84
+ if (!t.length) return;
85
+ let { x: n, y: r, x2: i, y2: a } = t[0];
86
+ for (let e = 1; e < t.length; e++) {
87
+ let o = t[e];
88
+ n = Math.min(n, o.x), r = Math.min(r, o.y), i = Math.max(i, o.x2), a = Math.max(a, o.y2);
89
+ }
90
+ return e.create(n, r, i - n, a - r);
91
+ }
92
+ static ZERO = e.create(0, 0, 0, 0);
93
+ _offset(e, t) {
94
+ let n = this["_" + e];
95
+ if (t === 0) return n;
96
+ switch (typeof t) {
97
+ case "number": return () => n() + t;
98
+ case "function": return () => n() + t();
99
+ default: throw Error("Not a number of function");
100
+ }
101
+ }
102
+ _passThrough(e) {
103
+ return this._offset(e, 0);
104
+ }
105
+ constructor(e, t, n, r) {
106
+ this._x = e, this._y = t, this._width = n, this._height = r;
107
+ }
108
+ get x() {
109
+ return this._x();
110
+ }
111
+ get y() {
112
+ return this._y();
113
+ }
114
+ get width() {
115
+ return this._width();
116
+ }
117
+ get height() {
118
+ return this._height();
119
+ }
120
+ get x2() {
121
+ return this._x() + this._width();
122
+ }
123
+ get y2() {
124
+ return this._y() + this._height();
125
+ }
126
+ equals(e) {
127
+ return e ? this === e || this.x === e.x && this.y === e.y && this.width === e.width && this.height === e.height : !1;
128
+ }
129
+ modify(t) {
130
+ if (!Object.keys(t).length) return this;
131
+ let n = (e) => {
132
+ let n = t[e];
133
+ return typeof n == "number" ? g(n) : typeof n == "function" ? n : this._passThrough(e);
134
+ };
135
+ return new e(n("x"), n("y"), n("width"), n("height"));
136
+ }
137
+ translate(t, n) {
138
+ return t === 0 && n === 0 ? this : new e(this._offset("x", t), this._offset("y", n), this._passThrough("width"), this._passThrough("height"));
139
+ }
140
+ translateBy(e) {
141
+ return this.translate(() => e.x, () => e.y);
142
+ }
143
+ expand(t, n = 1) {
144
+ return t.left == 0 && t.top == 0 && t.right == 0 && t.bottom == 0 ? this : new e(t.left ? this._offset("x", -t.left * n) : this._passThrough("x"), t.top ? this._offset("y", -t.top * n) : this._passThrough("y"), t.width ? this._offset("width", t.width * n) : this._passThrough("width"), t.height ? this._offset("height", t.height * n) : this._passThrough("height"));
145
+ }
146
+ shrink(e) {
147
+ return this.expand(e, -1);
148
+ }
149
+ intersect(t) {
150
+ return this === t || t == null ? this : new e(() => Math.max(this.x, t.x), () => Math.max(this.y, t.y), () => Math.min(this.x2, t.x2) - Math.max(this.x, t.x), () => Math.min(this.y2, t.y2) - Math.max(this.y, t.y));
151
+ }
152
+ intersectX(t) {
153
+ return this === t || t == null ? this : new e(() => Math.max(this.x, t.x), this._passThrough("y"), () => Math.min(this.x2, t.x2) - Math.max(this.x, t.x), this._passThrough("height"));
154
+ }
155
+ intersectY(t) {
156
+ return this === t || t == null ? this : new e(this._passThrough("x"), () => Math.max(this.y, t.y), this._passThrough("width"), () => Math.min(this.y2, t.y2) - Math.max(this.y, t.y));
157
+ }
158
+ union(t) {
159
+ return this === t || t == null ? this : new e(() => Math.min(this.x, t.x), () => Math.min(this.y, t.y), () => Math.max(this.x2, t.x2) - Math.min(this.x, t.x), () => Math.max(this.y2, t.y2) - Math.min(this.y, t.y));
160
+ }
161
+ isDefined() {
162
+ return this.width >= 0 && this.height >= 0;
163
+ }
164
+ flatten() {
165
+ return new e(g(this.x), g(this.y), g(this.width), g(this.height));
166
+ }
167
+ containsPoint(e, t) {
168
+ return e >= this.x && e < this.x2 && t >= this.y && t < this.y2;
169
+ }
170
+ normalizePoint(e, t, n = !1) {
171
+ let r = {
172
+ x: (e - this.x) / this.width,
173
+ y: (t - this.y) / this.height
174
+ };
175
+ return n && (r.y = 1 - r.y), r;
176
+ }
177
+ denormalizePoint(e, t, n = !1) {
178
+ return n && (t = 1 - t), {
179
+ x: this.x + e * this.width,
180
+ y: this.y + t * this.height
181
+ };
182
+ }
183
+ toString() {
184
+ return `Rectangle: x: ${this.x}, y: ${this.y}, width: ${this.width}, height: ${this.height}`;
185
+ }
186
+ toRoundedString() {
187
+ return `Rectangle: x: ${Math.round(this.x)}, y: ${Math.round(this.y)}, width: ${Math.round(this.width)}, height: ${Math.round(this.height)}`;
188
+ }
189
+ };
190
+ //#endregion
191
+ export { m as a, s as c, u as i, h as l, o as n, d as o, c as r, p as s, _ as t, l as u };