@genome-spy/app 1.1.1 → 1.3.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 (96) hide show
  1. package/dist/{SharedReadCache-Ey5QIiPM.js → SharedReadCache-9sT2aIxW.js} +6 -12
  2. package/dist/__vite-browser-external-Dgu_Ldik.js +7 -0
  3. package/dist/{agentApi-sPuuT0KS.js → agentApi-BclFF9zB.js} +9981 -8914
  4. package/dist/agentApi.es.js +6783 -5135
  5. package/dist/agentShared.es.js +433 -460
  6. package/dist/arrayUtils-Bm7QnzhN.js +1306 -0
  7. package/dist/{blosc-JROzDOnd.js → blosc-C-W97QwH.js} +3 -3
  8. package/dist/{canvas2d-iDK4BC5j.js → canvas2d-8MSf70d4.js} +141 -134
  9. package/dist/{canvas2d-MXaFeZnP.js → canvas2d-BwGNI_Rx.js} +147 -141
  10. package/dist/clipOptions-SrrxeAEU.js +4316 -0
  11. package/dist/clipOptions-clBEbkjv.js +4326 -0
  12. package/dist/{layoutResult-D50MSHXR.js → color-jETn8xK_.js} +29 -10
  13. package/dist/color-uTRRsy8i.js +116 -0
  14. package/dist/{componentStyles-DGtQXvwc.js → componentStyles-C7FbjS-a.js} +1 -1
  15. package/dist/{viewIdentityRegistry-BIYd4TE0.js → containerView-BItRtKqu.js} +28 -31
  16. package/dist/{viewIdentityRegistry-BDKkEjXl.js → containerView-CWa6ZIJW.js} +28 -31
  17. package/dist/{debug-DbigmdrK.js → debug-23s-jja_.js} +10 -9
  18. package/dist/{debug-BlqDxTw3.js → debug-CWRxvAss.js} +9 -10
  19. package/dist/dialog.es.js +1 -1
  20. package/dist/dist-CmY6iewb.js +1501 -0
  21. package/dist/dist-D6xbz5Ks.js +1501 -0
  22. package/dist/{esm-CjkeZi__.js → esm-BFwBAnbO.js} +25 -25
  23. package/dist/esm-BUkWqSr2.js +299 -0
  24. package/dist/{esm-C-6g-SkZ.js → esm-C0xXMLsR.js} +37 -41
  25. package/dist/{esm-CJeszW-t.js → esm-C2xhhXs0.js} +7 -7
  26. package/dist/esm-C6erfjPM.js +252 -0
  27. package/dist/{esm-DFHFX1sH.js → esm-CVjC7qA4.js} +34 -38
  28. package/dist/esm-CqY5ezGz.js +1249 -0
  29. package/dist/esm-DfMIJ_N2.js +1522 -0
  30. package/dist/esm-Dls41IbZ.js +787 -0
  31. package/dist/{esm-Bv7Frz7C.js → esm-DzQDfrsZ.js} +7 -10
  32. package/dist/esm-aGLCvYRP.js +238 -0
  33. package/dist/{esm-VFJeyk9i.js → esm-nzwgJFGz.js} +40 -36
  34. package/dist/figWigMetadataSourceAdapter-8Kf_vZRf.js +36 -0
  35. package/dist/figWigMetadataSourceAdapter-DdDMZpYO.js +36 -0
  36. package/dist/flowNode-BSjy0Wz3.js +1306 -0
  37. package/dist/flowOutput-D5qpxWe0.js +183 -0
  38. package/dist/index.es.js +4766 -5522
  39. package/dist/index.js +1089 -685
  40. package/dist/inflate-BdC5KvHn.js +886 -0
  41. package/dist/{lz4-CUYSbVey.js → lz4-BLPgBOlE.js} +1 -1
  42. package/dist/markUtils-RaatLEa-.js +78 -0
  43. package/dist/{metadataChannels-DV62inJh.js → metadataChannels-DLSmx7kU.js} +6 -3
  44. package/dist/metadataUtils-DxEPe0vj.js +879 -0
  45. package/dist/order-BnKzKjt4.js +1151 -0
  46. package/dist/order-BpJnq_nV.js +1150 -0
  47. package/dist/{parquetRead-0hFIa3Cc.js → parquetRead-D-yY8njE.js} +3 -11
  48. package/dist/{rasterExport-B62RmAK1.js → rasterExport-B-WrX1pa.js} +5 -5
  49. package/dist/{rasterExport-DQH3hVg_.js → rasterExport-C_vx4Jwd.js} +4 -4
  50. package/dist/{rasterization-B05bDo5e.js → rasterization-QktH8Sn2.js} +26 -19
  51. package/dist/rectangle-BAdoDPXu.js +194 -0
  52. package/dist/{rectangle-DE98gIxF.js → rectangle-DZTR6NFQ.js} +10 -1
  53. package/dist/renderCanvas2D-CsRO78Pq.js +291 -0
  54. package/dist/{renderCanvas2D-Bdv-B4wj.js → renderCanvas2D-Y7pkRzbC.js} +98 -92
  55. package/dist/{rolldown-runtime-DF993M8W.js → rolldown-runtime-DeIk2rA4.js} +1 -1
  56. package/dist/{indexer-DbFTKGlm.js → scaleNull-CVzag4z8.js} +2 -12
  57. package/dist/{indexer-En7gpvLN.js → scaleNull-Pbz7QGnl.js} +2 -12
  58. package/dist/{scalePosition-ByvlXaML.js → scalePosition-CRXa0rCC.js} +8 -1
  59. package/dist/schema.json +33403 -16929
  60. package/dist/style.css +1 -1
  61. package/dist/{svg-N3tj05-e.js → svg-BBMtLgtM.js} +445 -362
  62. package/dist/{svg-DHsq1RpV.js → svg-JjWL6U-T.js} +464 -381
  63. package/dist/{svgRasterizer-CYVDlt5z.js → svgRasterizer-6OcftuoI.js} +3 -3
  64. package/dist/{svgRasterizer-CvCBlxLj.js → svgRasterizer-DkNRaCPs.js} +4 -4
  65. package/dist/tableMetadataSourceAdapter-CUNwLsdi.js +291 -0
  66. package/dist/tableMetadataSourceAdapter-DQrEXCo6.js +1283 -0
  67. package/dist/url-DeOdSRrv.js +183 -0
  68. package/dist/viewError-B0TMfOpB.js +33 -0
  69. package/dist/viewError-D9aO90cI.js +33 -0
  70. package/dist/{viewSelectors-DDLW-byr.js → viewSelectors-DkFvo33d.js} +914 -752
  71. package/dist/{viewSelectors-j-F9XwsE.js → viewSelectors-lM93fHAq.js} +942 -780
  72. package/dist/viewUtils-0SJOewM6.js +6195 -0
  73. package/dist/webgl-CXIO3OQz.js +5782 -0
  74. package/dist/webgl-Pdvfhio5.js +5783 -0
  75. package/package.json +7 -5
  76. package/src/agentApi/index.d.ts +3 -2
  77. package/src/agentShared/index.d.ts +2 -0
  78. package/src/appTypes.d.ts +1 -6
  79. package/src/embedTypes.d.ts +36 -1
  80. package/src/index.d.ts +6 -0
  81. package/src/spec/sampleView.d.ts +68 -13
  82. package/src/spec/view.d.ts +44 -5
  83. package/src/state/paramProvenanceTypes.d.ts +25 -2
  84. package/src/state.d.ts +14 -52
  85. package/dist/clipOptions-B5PibDq3.js +0 -2923
  86. package/dist/clipOptions-Cba4I0AO.js +0 -2903
  87. package/dist/esm-Dndm-NaA.js +0 -1193
  88. package/dist/order-B4uR9Q04.js +0 -1062
  89. package/dist/order-BSPy5DI8.js +0 -1062
  90. package/dist/renderCanvas2D-ChdoHGrU.js +0 -285
  91. package/dist/vega-scale-Byaw1K8O.js +0 -2446
  92. package/dist/vega-scale-Ctz_wa3z.js +0 -2443
  93. package/dist/viewError-BiR9VCgL.js +0 -29
  94. package/dist/viewUtils-JX6CMEYH.js +0 -6664
  95. package/dist/webgl-DdmOwEH0.js +0 -5544
  96. package/dist/webgl-Dw8xqZpX.js +0 -5544
@@ -394,11 +394,7 @@ function _e(e, t) {
394
394
  }
395
395
  for (let t = 1; t < e.length; t++) {
396
396
  let { logical_type: r, name: i, num_children: a, type: o } = e[t];
397
- if (a) {
398
- t += a;
399
- continue;
400
- }
401
- o === "BYTE_ARRAY" && !r && (e[t].logical_type = n.get(i));
397
+ a ? t += a : o === "BYTE_ARRAY" && !r && (e[t].logical_type = n.get(i));
402
398
  }
403
399
  }
404
400
  //#endregion
@@ -1188,9 +1184,7 @@ function K(e, t, n, r = 0) {
1188
1184
  let l = s.path.join("."), u = e.get(l);
1189
1185
  if (!u) throw Error("parquet list column missing values");
1190
1186
  a && q(u, r), e.set(i, u), e.delete(l);
1191
- return;
1192
- }
1193
- if (re(t)) {
1187
+ } else if (re(t)) {
1194
1188
  let s = t.children[0].element.name;
1195
1189
  K(e, t.children[0].children[0], n, o + 1), K(e, t.children[0].children[1], n, o + 1);
1196
1190
  let c = e.get(`${i}.${s}.key`), l = e.get(`${i}.${s}.value`);
@@ -1199,9 +1193,7 @@ function K(e, t, n, r = 0) {
1199
1193
  if (c.length !== l.length) throw Error("parquet map column key/value length mismatch");
1200
1194
  let u = st(c, l, o);
1201
1195
  a && q(u, r), e.delete(`${i}.${s}.key`), e.delete(`${i}.${s}.value`), e.set(i, u);
1202
- return;
1203
- }
1204
- if (t.children.length) {
1196
+ } else if (t.children.length) {
1205
1197
  let o = t.element.repetition_type === "REQUIRED" ? r : r + 1, s = {};
1206
1198
  for (let r of t.children) {
1207
1199
  K(e, r, n, o);
@@ -1,8 +1,8 @@
1
- import { t as e } from "./rasterization-B05bDo5e.js";
2
- import { t } from "./rectangle-DE98gIxF.js";
3
- import { t as n } from "./layoutResult-D50MSHXR.js";
4
- import { r } from "./order-BSPy5DI8.js";
5
- import { t as i } from "./renderCanvas2D-ChdoHGrU.js";
1
+ import { t as e } from "./rasterization-QktH8Sn2.js";
2
+ import { t } from "./rectangle-BAdoDPXu.js";
3
+ import { n } from "./color-uTRRsy8i.js";
4
+ import { r } from "./order-BpJnq_nV.js";
5
+ import { t as i } from "./renderCanvas2D-CsRO78Pq.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
1
  import { t as e } from "./rasterization-CFogVB3B.js";
2
- import { t } from "./rectangle-DE98gIxF.js";
3
- import { t as n } from "./layoutResult-D50MSHXR.js";
4
- import { r } from "./order-B4uR9Q04.js";
5
- import { t as i } from "./renderCanvas2D-Bdv-B4wj.js";
2
+ import { t } from "./rectangle-DZTR6NFQ.js";
3
+ import { n } from "./color-jETn8xK_.js";
4
+ import { r } from "./order-BnKzKjt4.js";
5
+ import { t as i } from "./renderCanvas2D-Y7pkRzbC.js";
6
6
  //#region ../core/src/rendering/canvas2d/rasterExport.js
7
7
  async function a(e) {
8
8
  let t = e.mimeType ?? "image/png";
@@ -7,54 +7,61 @@ function e(e, t = .5) {
7
7
  }
8
8
  return 0;
9
9
  }
10
+ function t(e, t, n) {
11
+ if (e.type === "index" || e.type === "locus") {
12
+ let r = e;
13
+ return r.gapMapping(n)?.invertPoint(t).value ?? r.invert(t);
14
+ }
15
+ return e.invert(t);
16
+ }
10
17
  //#endregion
11
18
  //#region ../core/src/rendering/renderingModuleRegistry.js
12
- var t = {}, n = class extends Error {
19
+ var n = {}, r = class extends Error {
13
20
  constructor(e, t) {
14
21
  super(e, t), this.name = "RasterizationUnavailableError";
15
22
  }
16
23
  };
17
- async function r(e, r) {
24
+ async function i(e, t) {
18
25
  if (e.exportRaster) try {
19
- return await e.exportRaster(r);
26
+ return await e.exportRaster(t);
20
27
  } catch (e) {
21
- if (!(e instanceof n)) throw e;
28
+ if (!(e instanceof r)) throw e;
22
29
  }
23
- if (!t.canvasRasterExport) throw a();
30
+ if (!n.canvasRasterExport) throw o();
24
31
  let i;
25
32
  try {
26
- i = await t.canvasRasterExport();
33
+ i = await n.canvasRasterExport();
27
34
  } catch (e) {
28
- throw a(e);
35
+ throw o(e);
29
36
  }
30
37
  try {
31
38
  return await i.exportRaster({
32
- ...r,
39
+ ...t,
33
40
  liveSize: e.surface.getLogicalCanvasSize(),
34
41
  liveDevicePixelRatio: e.surface.getDevicePixelRatio()
35
42
  });
36
43
  } catch (e) {
37
- throw e instanceof n ? a(e) : e;
44
+ throw e instanceof r ? o(e) : e;
38
45
  }
39
46
  }
40
- async function i(e, r) {
47
+ async function a(e, t) {
41
48
  if (e.rasterizeSvgRuns) try {
42
- await e.rasterizeSvgRuns(r);
49
+ await e.rasterizeSvgRuns(t);
43
50
  return;
44
51
  } catch (e) {
45
- if (!(e instanceof n)) throw e;
52
+ if (!(e instanceof r)) throw e;
46
53
  }
47
- if (!t.canvasSvgRasterizer) throw new n("No raster backend supports selective SVG rasterization. Import \"@genome-spy/core/rendering/canvas.js\" to enable the Canvas2D fallback.");
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.");
48
55
  let i;
49
56
  try {
50
- i = await t.canvasSvgRasterizer();
57
+ i = await n.canvasSvgRasterizer();
51
58
  } catch (e) {
52
- throw new n("No raster backend supports selective SVG rasterization.", { cause: e });
59
+ throw new r("No raster backend supports selective SVG rasterization.", { cause: e });
53
60
  }
54
- await i.createCanvas2DSvgRasterizer()(r);
61
+ await i.createCanvas2DSvgRasterizer()(t);
55
62
  }
56
- function a(e) {
57
- return new n("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 });
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 });
58
65
  }
59
66
  //#endregion
60
- export { e as a, t as i, r as n, i as r, n as t };
67
+ export { e as a, n as i, i as n, t as o, a as r, r as t };
@@ -0,0 +1,194 @@
1
+ import { _t as e, c as t, jt as n, u as r, ut as i, vt as a } from "./clipOptions-clBEbkjv.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(t, n) {
8
+ let a = e(n), s = i(t[n]), c = i(t[a]);
9
+ s && c && ["index", "locus"].includes(s.type) && (t[n] = r(t[n], {
10
+ ...t[n],
11
+ [o]: a
12
+ }), t[a] = r(t[a], {
13
+ ...t[a],
14
+ [o]: n
15
+ }));
16
+ }
17
+ function l(t) {
18
+ for (let r of ["x", "y"]) {
19
+ let a = e(r), o = t[r], s = t[a];
20
+ if (o && s && n(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 = e(i);
25
+ c(t, i);
26
+ let l = t[i] && r(t[i], { ...t[i] }), u = t[s] && r(t[s], { ...t[s] });
27
+ if (!(n(l) || n(u))) {
28
+ if (l) {
29
+ if (!a(t[i])) return;
30
+ if (!u) {
31
+ if (l.type == "quantitative") u = {
32
+ datum: 0,
33
+ domainInert: !0
34
+ };
35
+ else {
36
+ u = r(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 = e(i), s = t[i], l = t[o];
51
+ if (!s || !l || n(s) || n(l) || !a(s) || !a(l) || !["index", "locus"].includes(s.type)) return;
52
+ let u = s.band, d = l.band, f = u ?? d ?? 0;
53
+ t[i] = r(s, {
54
+ ...s,
55
+ band: f
56
+ }), t[o] = r(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(e, n) {
66
+ e[n] = t(e.color), f(e[n], "color");
67
+ }
68
+ function m(e, r) {
69
+ e.stroke || (r ? e.stroke = { value: null } : p(e, "stroke")), n(e.stroke) && e.stroke.value === null && (e.strokeWidth = { value: 0 }), e.strokeOpacity || (e.strokeOpacity = t(e.opacity), f(e.strokeOpacity, "opacity"));
70
+ }
71
+ function h(e, r) {
72
+ n(e.fill) && e.fill.value === null ? e.fillOpacity = { value: 0 } : e.fill || (p(e, "fill"), !r && !e.fillOpacity && (e.fillOpacity = { value: 0 })), e.fillOpacity || (r ? (e.fillOpacity = t(e.opacity), f(e.fillOpacity, "opacity")) : e.fillOpacity = { value: 0 });
73
+ }
74
+ function g(e, t) {
75
+ return e.properties.clamp === !0 || e.properties.clamp === t;
76
+ }
77
+ //#endregion
78
+ //#region ../core/src/view/layout/rectangle.js
79
+ function _(e) {
80
+ return () => e;
81
+ }
82
+ var v = class e {
83
+ static create(t, n, r, i) {
84
+ return new e(_(t), _(n), _(r), _(i));
85
+ }
86
+ static unionAll(t) {
87
+ if (!t.length) return;
88
+ let { x: n, y: r, x2: i, y2: a } = t[0];
89
+ for (let e = 1; e < t.length; e++) {
90
+ let o = t[e];
91
+ n = Math.min(n, o.x), r = Math.min(r, o.y), i = Math.max(i, o.x2), a = Math.max(a, o.y2);
92
+ }
93
+ return e.create(n, r, i - n, a - r);
94
+ }
95
+ static ZERO = e.create(0, 0, 0, 0);
96
+ _offset(e, t) {
97
+ let n = this["_" + e];
98
+ if (t === 0) return n;
99
+ switch (typeof t) {
100
+ case "number": return () => n() + t;
101
+ case "function": return () => n() + t();
102
+ default: throw Error("Not a number of function");
103
+ }
104
+ }
105
+ _passThrough(e) {
106
+ return this._offset(e, 0);
107
+ }
108
+ constructor(e, t, n, r) {
109
+ this._x = e, this._y = t, this._width = n, this._height = r;
110
+ }
111
+ get x() {
112
+ return this._x();
113
+ }
114
+ get y() {
115
+ return this._y();
116
+ }
117
+ get width() {
118
+ return this._width();
119
+ }
120
+ get height() {
121
+ return this._height();
122
+ }
123
+ get x2() {
124
+ return this._x() + this._width();
125
+ }
126
+ get y2() {
127
+ return this._y() + this._height();
128
+ }
129
+ equals(e) {
130
+ return e ? this === e || this.x === e.x && this.y === e.y && this.width === e.width && this.height === e.height : !1;
131
+ }
132
+ modify(t) {
133
+ if (!Object.keys(t).length) return this;
134
+ let n = (e) => {
135
+ let n = t[e];
136
+ return typeof n == "number" ? _(n) : typeof n == "function" ? n : this._passThrough(e);
137
+ };
138
+ return new e(n("x"), n("y"), n("width"), n("height"));
139
+ }
140
+ translate(t, n) {
141
+ return t === 0 && n === 0 ? this : new e(this._offset("x", t), this._offset("y", n), this._passThrough("width"), this._passThrough("height"));
142
+ }
143
+ translateBy(e) {
144
+ return this.translate(() => e.x, () => e.y);
145
+ }
146
+ expand(t, n = 1) {
147
+ 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"));
148
+ }
149
+ shrink(e) {
150
+ return this.expand(e, -1);
151
+ }
152
+ intersect(t) {
153
+ 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));
154
+ }
155
+ intersectX(t) {
156
+ 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"));
157
+ }
158
+ intersectY(t) {
159
+ 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));
160
+ }
161
+ union(t) {
162
+ 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));
163
+ }
164
+ isDefined() {
165
+ return this.width >= 0 && this.height >= 0;
166
+ }
167
+ flatten() {
168
+ return new e(_(this.x), _(this.y), _(this.width), _(this.height));
169
+ }
170
+ containsPoint(e, t) {
171
+ return e >= this.x && e < this.x2 && t >= this.y && t < this.y2;
172
+ }
173
+ normalizePoint(e, t, n = !1) {
174
+ let r = {
175
+ x: (e - this.x) / this.width,
176
+ y: (t - this.y) / this.height
177
+ };
178
+ return n && (r.y = 1 - r.y), r;
179
+ }
180
+ denormalizePoint(e, t, n = !1) {
181
+ return n && (t = 1 - t), {
182
+ x: this.x + e * this.width,
183
+ y: this.y + t * this.height
184
+ };
185
+ }
186
+ toString() {
187
+ return `Rectangle: x: ${this.x}, y: ${this.y}, width: ${this.width}, height: ${this.height}`;
188
+ }
189
+ toRoundedString() {
190
+ return `Rectangle: x: ${Math.round(this.x)}, y: ${Math.round(this.y)}, width: ${Math.round(this.width)}, height: ${Math.round(this.height)}`;
191
+ }
192
+ };
193
+ //#endregion
194
+ export { u as a, m as c, l as d, p as i, s as l, o as n, h as o, c as r, d as s, v as t, g as u };
@@ -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,291 @@
1
+ import { Sn as e, a as t, o as n, s as r } from "./clipOptions-clBEbkjv.js";
2
+ import { s as i } from "./flowNode-BSjy0Wz3.js";
3
+ import { t as a } from "./warning-CpIIpk8e.js";
4
+ import { n as o } from "./performanceProfiler-CPLEjApa.js";
5
+ import { r as s } from "./color-uTRRsy8i.js";
6
+ import { C as c, D as l, F as u, L as d, M as f, N as p, O as m, P as h, R as g, S as _, T as v, _ as y, a as b, b as x, c as S, d as ee, g as C, h as w, i as T, j as E, k as D, l as O, m as k, p as A, s as j, t as M, u as N, v as P, x as F, y as I } from "./order-BpJnq_nV.js";
7
+ //#region ../core/src/rendering/canvas2d/renderers/arrow.js
8
+ function L(e, t) {
9
+ let n = e, r = t.context, i = n.encoders, a = c(n);
10
+ r.lineJoin = "miter";
11
+ let o = m(i.fill, t), s = m(i.stroke, t), u, d;
12
+ return v(n, a, t, (e) => {
13
+ e.headShapeFallback && t.warn(`Canvas2D rendered unsupported arrow headShape "${a.headShape}" as a triangle.`), r.beginPath();
14
+ for (let t of e.boundaryLoops) {
15
+ let e = t[0];
16
+ r.moveTo(e.x, e.y);
17
+ for (let e = 1; e < t.length; e++) r.lineTo(t[e].x, t[e].y);
18
+ r.closePath();
19
+ }
20
+ let n = o ?? f(i.fill(e.datum)), c = l(i.fillOpacity, e.datum) * t.viewOpacity;
21
+ n != "none" && c > 0 && (u != n && (r.fillStyle = n, u = n), r.globalAlpha = c, r.fill());
22
+ let p = s ?? f(i.stroke(e.datum)), m = l(i.strokeOpacity, e.datum) * t.viewOpacity;
23
+ p != "none" && m > 0 && e.strokeWidth > 0 && (d != p && (r.strokeStyle = p, d = p), r.globalAlpha = m, r.lineWidth = e.strokeWidth, r.stroke());
24
+ }, s);
25
+ }
26
+ //#endregion
27
+ //#region ../core/src/rendering/canvas2d/renderers/link.js
28
+ function R(t, n) {
29
+ let r = t, i = n.context, a = 1 / n.devicePixelRatio, o = r.encoders, s = P(r), c = _(r, s.shape, n.secondOrderPass);
30
+ i.lineCap = "butt", i.lineJoin = "miter", i.miterLimit = 2;
31
+ let u = m(o.color, n), d;
32
+ return I(r, s, n, (t) => {
33
+ let r = u ?? f(o.color(t.datum)), s = l(o.opacity, t.datum) * n.viewOpacity;
34
+ if (r == "none" || s <= 0 || t.strokeWidth <= 0) return;
35
+ let p = c && t.geometry.type == "cubic" && F(t.geometry.points[0], t.geometry.points[3], c);
36
+ if (p) {
37
+ let { normalX: t, normalY: n, offset: a, start: o, end: s } = p, c = i.createLinearGradient(t * (a - s), n * (a - s), t * (a + s), n * (a + s)), l = e(r), u = l.opacity;
38
+ for (let e of x(o, s)) l.opacity = u * e.opacity, c.addColorStop(e.offset, l.formatRgb());
39
+ i.strokeStyle = c, d = void 0;
40
+ } else d != r && (i.strokeStyle = r, d = r);
41
+ i.globalAlpha = s * Math.min(t.strokeWidth / a, 1), i.lineWidth = Math.max(t.strokeWidth, a);
42
+ let { geometry: m } = t, h = m.points[0];
43
+ if (i.beginPath(), i.moveTo(h[0], h[1]), m.type == "orthogonal") for (let e of m.points.slice(1)) i.lineTo(e[0], e[1]);
44
+ else {
45
+ let [, e, t, n] = m.points;
46
+ i.bezierCurveTo(e[0], e[1], t[0], t[1], n[0], n[1]);
47
+ }
48
+ i.stroke();
49
+ });
50
+ }
51
+ //#endregion
52
+ //#region ../core/src/rendering/canvas2d/renderers/point.js
53
+ function z(e, t) {
54
+ let n = e;
55
+ E(n, n.properties.fillGradientStrength) && t.warn("Canvas2D ignored unsupported point property fillGradientStrength."), n.properties.geometricZoomBound && t.warn("Canvas2D ignored unsupported point property geometricZoomBound.");
56
+ let r = C(n), i = t.context, a = n.encoders, o = D(a.fill), s = D(a.stroke), c = m(a.fill, t), u = m(a.stroke, t), d, p;
57
+ return y(n, r, t, (e) => {
58
+ let n = e.datum, r = e.lineShape, m = c ?? f(a.fill(n)), h = l(a.fillOpacity, n) * t.viewOpacity, g = u ?? f(a.stroke(n)), _ = l(a.strokeOpacity, n) * t.viewOpacity, v = e.strokeWidth > 0 && _ > 0 ? _ * s(g) : 0;
59
+ r && v <= 0 && (g = m, _ = h, v = h * o(m));
60
+ let y = !r && h * o(m) > 0, b = v < 1 ? e.radius : e.geometryRadius;
61
+ B(i, e, y ? b : e.geometryRadius, t.warn), y && (d != m && (i.fillStyle = m, d = m), V(i, h), i.fill()), v > 0 && e.strokeWidth > 0 && (y && b != e.geometryRadius && B(i, e, e.geometryRadius, t.warn), r && i.lineCap != "butt" && (i.lineCap = "butt"), p != g && (i.strokeStyle = g, p = g), V(i, _), H(i, e.strokeWidth), i.stroke());
62
+ });
63
+ }
64
+ function B(e, t, n, r) {
65
+ e.beginPath();
66
+ let i = t.angle != 0 && t.shape != "circle";
67
+ i && (e.save(), e.translate(t.x, t.y), e.rotate(t.angle * Math.PI / 180));
68
+ let a = i ? 0 : t.x, o = i ? 0 : t.y, s = !0;
69
+ t.shape == "circle" ? e.arc(a, o, n, 0, Math.PI * 2) : t.shape == "square" ? e.rect(a - n, o - n, n * 2, n * 2) : s = w(t.shape, a, o, n, e), i && e.restore(), s || (r(`Canvas2D rendered unsupported point shape "${t.shape}" as a circle.`), e.arc(t.x, t.y, n, 0, Math.PI * 2));
70
+ }
71
+ function V(e, t) {
72
+ e.globalAlpha != t && (e.globalAlpha = t);
73
+ }
74
+ function H(e, t) {
75
+ e.lineWidth != t && (e.lineWidth = t);
76
+ }
77
+ //#endregion
78
+ //#region ../core/src/rendering/canvas2d/renderers/rect.js
79
+ function U(e, t) {
80
+ let n = e, r = A(n);
81
+ r.hatch != "none" && t.warn("Canvas2D ignored unsupported rect hatch.");
82
+ let i = t.start ?? 0;
83
+ if (i === (t.end ?? t.data.length)) return 0;
84
+ let a = t.context, o = n.encoders, s, c, u = [
85
+ 0,
86
+ 0,
87
+ 0,
88
+ 0
89
+ ], d = o.strokeOpacity.constant, p = m(o.stroke, t), h = p == "none", g = !h && d ? l(o.strokeOpacity, t.data[i]) : 0;
90
+ return k(n, r, t, (e) => {
91
+ r.shadow.opacity > 0 && W(e, r.shadow, t, u);
92
+ let n = e.opacityFactor, i = e.fill != "none" && e.fillOpacity > 0, m = p ?? f(o.stroke(e.datum)), _ = (d ? g : l(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);
93
+ 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 && (s != e.fill && (a.fillStyle = e.fill, s = e.fill), G(a, e.fillOpacity * n), y ? a.fill() : a.fillRect(e.x, e.y, e.width, e.height)), v && (c != m && (a.strokeStyle = m, c = m), G(a, _), K(a, e.strokeWidth), y ? a.stroke() : a.strokeRect(e.x, e.y, e.width, e.height));
94
+ });
95
+ }
96
+ function W(e, t, n, r) {
97
+ 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;
98
+ 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();
99
+ try {
100
+ 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();
101
+ } finally {
102
+ i.restore();
103
+ }
104
+ }
105
+ function G(e, t) {
106
+ e.globalAlpha != t && (e.globalAlpha = t);
107
+ }
108
+ function K(e, t) {
109
+ e.lineWidth != t && (e.lineWidth = t);
110
+ }
111
+ //#endregion
112
+ //#region ../core/src/rendering/canvas2d/renderers/rule.js
113
+ function q(e, t) {
114
+ let n = e, r = t.context, i = n.encoders;
115
+ r.lineCap = E(n, n.properties.strokeCap), r.setLineDash(E(n, n.properties.strokeDash) ?? []), r.lineDashOffset = E(n, n.properties.strokeDashOffset);
116
+ let a = n.getType() === "rule", o = m(i.fill, t), s;
117
+ return ee(n, N(n), t, (e) => {
118
+ let n = o ?? f(i.fill(e.datum)), c = l(i.opacity, e.datum) * t.viewOpacity;
119
+ c <= 0 || (r.beginPath(), r.moveTo(e.x1, e.y1), r.lineTo(e.x2, e.y2), e.strokeWidth > 0 && (r.strokeStyle = e.stroke, s = e.stroke, r.globalAlpha = c * e.strokeOpacity, r.lineWidth = e.size + 2 * e.strokeWidth, r.stroke()), n !== "none" && (s !== n && (r.strokeStyle = n, s = n), r.globalAlpha = c * (a ? l(i.fillOpacity, e.datum) : 1), r.lineWidth = e.size, r.stroke()));
120
+ });
121
+ }
122
+ //#endregion
123
+ //#region ../core/src/rendering/canvas2d/renderers/text.js
124
+ function J(e, t) {
125
+ let n = e, r = n.properties, i = t.textMetrics ?? n.unitView.context.textMetrics, a = i.requestFont(r), o = T(i, r), s = S(n), c = t.context, u = n.encoders, d = b(r.font), p = `${r.fontStyle ?? "normal"} ${j(r.fontWeight ?? "normal")} `, h = s.baseline == "baseline" ? "alphabetic" : s.baseline;
126
+ [
127
+ r.viewportEdgeFadeWidthTop,
128
+ r.viewportEdgeFadeWidthRight,
129
+ r.viewportEdgeFadeWidthBottom,
130
+ r.viewportEdgeFadeWidthLeft
131
+ ].some((e) => E(n, e) > 0) && t.warn("Canvas2D ignored unsupported text viewport edge fading.");
132
+ let g = m(u.color, t), _, v;
133
+ return s.logoLetters || (c.textAlign = s.align, c.textBaseline = h), O(n, s, {
134
+ ...t,
135
+ fontMeasurement: a,
136
+ measureLogoInkBounds: o
137
+ }, (e) => {
138
+ e.multiCharacterLogo && t.warn("Canvas2D stretches multi-character logo text as a single glyph cell.");
139
+ let n = g ?? f(u.color(e.datum)), r = l(u.opacity, e.datum) * t.viewOpacity * e.fadeOpacity;
140
+ n == "none" || r <= 0 || (_ != n && (c.fillStyle = n, _ = n), c.globalAlpha = r, v != e.size && (c.font = `${p}${e.size}px ${d}`, v = e.size), e.logoTransform ? (c.save(), c.translate(e.x, e.y), c.rotate(e.angle * Math.PI / 180), c.translate(e.dx, e.dy), c.scale(e.logoTransform.scaleX, e.logoTransform.scaleY), c.translate(-e.logoTransform.originX, -e.logoTransform.originY), c.textAlign = "left", c.textBaseline = "alphabetic", c.fillText(e.text, 0, 0), c.restore()) : e.angle || e.scale != 1 ? (c.save(), c.translate(e.x, e.y), c.rotate(e.angle * Math.PI / 180), c.translate(e.dx, e.dy), c.scale(e.scale, e.scale), c.fillText(e.text, 0, 0), c.restore()) : c.fillText(e.text, e.x + e.dx, e.y + e.dy));
141
+ });
142
+ }
143
+ //#endregion
144
+ //#region ../core/src/rendering/canvas2d/renderers/index.js
145
+ function Y(e, t) {
146
+ return (t.start ?? 0) === (t.end ?? t.data.length) ? 0 : e.getType() == "arrow" ? L(e, t) : e.getType() == "link" ? R(e, t) : e.getType() == "rect" ? U(e, t) : e.getType() == "point" ? z(e, t) : e.getType() == "rule" || e.getType() == "tick" ? q(e, t) : e.getType() == "text" ? J(e, t) : (t.warn(`Canvas2D rendering is not implemented for mark type "${e.getType()}".`), 0);
147
+ }
148
+ //#endregion
149
+ //#region ../core/src/rendering/sampleFacet.js
150
+ function X(e) {
151
+ let t = e.pixelToUnit, n = e.locSize.location * t, r = e.locSize.size * t;
152
+ return !(n > 1 || n + r < 0);
153
+ }
154
+ //#endregion
155
+ //#region ../core/src/rendering/canvas2d/canvas2DViewRenderingContext.js
156
+ var Z = 8, Q = 16777216, te = class extends s {
157
+ #e = [];
158
+ #t = /* @__PURE__ */ new WeakSet();
159
+ #n = /* @__PURE__ */ new WeakMap();
160
+ #r;
161
+ #i;
162
+ #a = new d();
163
+ #o;
164
+ #s = [0, 0];
165
+ #c;
166
+ #l;
167
+ #u = [];
168
+ constructor(e, t) {
169
+ if (super(e), this.context = t.context, this.width = t.width, this.height = t.height, this.devicePixelRatio = t.devicePixelRatio, this.paint = t.paint, this.textMetrics = t.textMetrics, this.#r = t.markPredicate ?? (() => !0), this.#i = o(), this.#o = t.xIndexManager, this.#l = t.opacityLayers ?? [], this.#c = {
170
+ x: 0,
171
+ y: 0,
172
+ width: this.context.canvas.width,
173
+ height: this.context.canvas.height
174
+ }, this.paint) {
175
+ let e = this.context;
176
+ 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));
177
+ }
178
+ }
179
+ getDevicePixelRatio() {
180
+ return this.devicePixelRatio;
181
+ }
182
+ pushView(e, n) {
183
+ this.paint && !this.#t.has(e) && (e.onBeforeRender(), this.#t.add(e));
184
+ let r = e.getOpacity();
185
+ if (this.paint && r > 0 && r !== 1) {
186
+ let r = t(e), i = ne(n, this.devicePixelRatio, this.#c, r), a = re(this.#l, this.#u.length, i.width, i.height);
187
+ a.setTransform(this.devicePixelRatio, 0, 0, this.devicePixelRatio, -i.x, -i.y), this.#u.push({
188
+ context: this.context,
189
+ bounds: this.#c
190
+ }), this.context = a, this.#c = i;
191
+ }
192
+ this.#e.push({
193
+ view: e,
194
+ coords: n,
195
+ opacity: r
196
+ });
197
+ }
198
+ popView(e) {
199
+ let t = this.#e.pop();
200
+ if (t?.view !== e) throw Error("Unbalanced Canvas2D view rendering context stack.");
201
+ if (this.paint && t.opacity > 0 && t.opacity !== 1) {
202
+ let e = this.#u.pop();
203
+ if (!e) throw Error("Missing Canvas2D opacity parent target.");
204
+ let n = this.context.canvas, r = this.#c;
205
+ this.context = e.context, this.#c = e.bounds, this.context.save();
206
+ try {
207
+ 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);
208
+ } finally {
209
+ this.context.restore();
210
+ }
211
+ }
212
+ }
213
+ renderMark(e, t) {
214
+ if (!this.paint || !this.#r(e)) return;
215
+ let i = this.#n.get(e.unitView);
216
+ if (i === void 0 && (i = e.unitView.getEffectiveOpacity(), this.#n.set(e.unitView, i)), i <= 0) return;
217
+ e.initializeRenderingRevisions(Object.keys(e.properties));
218
+ let o = t.sampleFacetRenderingOptions;
219
+ if (o && !e.encoders.facetIndex && (this.#i?.addCount("canvasSampleFacetOccurrences"), !X(o))) {
220
+ this.#i?.addCount("canvasCulledSampleFacetOccurrences");
221
+ return;
222
+ }
223
+ let s = this.currentCoords, c = n(t), l = r(c, e.properties.clip, s), d = h(this.width, this.height, l);
224
+ if (!u(d)) return;
225
+ let f = p(s, c, e.properties.cullByVisibleRange), m = this.#o?.prepare(e) ?? !1, _ = this.context;
226
+ if (_.save(), l) {
227
+ let e = l.rect.flatten(), t = l.clipX ? e.x : 0, n = l.clipY ? e.y : 0, r = l.clipX ? e.width : this.width, i = l.clipY ? e.height : this.height;
228
+ _.beginPath(), _.rect(t, n, r, i), _.clip();
229
+ }
230
+ try {
231
+ let n = e.getOrder?.(), r = n && n.isActive();
232
+ g(e, t, s, this.#a, (t, i) => {
233
+ let o = 0, s = i.length;
234
+ m && this.#o.query(i, this.#s) && (o = this.#s[0], s = this.#s[1]);
235
+ let c = (n, r, i, o = !1) => Y(e, {
236
+ context: _,
237
+ devicePixelRatio: this.devicePixelRatio,
238
+ coords: t,
239
+ data: n,
240
+ secondOrderPass: o,
241
+ start: r,
242
+ end: i,
243
+ visibleBounds: d,
244
+ anchorCullBounds: f,
245
+ viewOpacity: 1,
246
+ textMetrics: this.textMetrics,
247
+ warn: (t) => a(`${t} View: ${e.unitView.getPathString()}`)
248
+ });
249
+ if (!r) return c(i, o, s);
250
+ let l = 0, u = M(i, o, s, n.predicate, n.passes);
251
+ for (let [e, t] of u.entries()) t.length > 0 && (l += c(t, 0, t.length, e === 1));
252
+ return l;
253
+ }, (t) => a(`Canvas2D could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`));
254
+ } finally {
255
+ _.restore();
256
+ }
257
+ }
258
+ get currentCoords() {
259
+ let e = i(this.#e);
260
+ if (!e) throw Error("No current view in Canvas2D rendering context.");
261
+ return e.coords;
262
+ }
263
+ };
264
+ function ne(e, t, n, r) {
265
+ let i = n.x + n.width, a = n.y + n.height, o = r.clipX ? $(Math.floor(e.x * t), n.x, i) : n.x, s = r.clipY ? $(Math.floor(e.y * t), n.y, a) : n.y, c = r.clipX ? $(Math.ceil((e.x + e.width) * t), o, i) : i, l = r.clipY ? $(Math.ceil((e.y + e.height) * t), s, a) : a;
266
+ return {
267
+ x: o,
268
+ y: s,
269
+ width: c - o,
270
+ height: l - s
271
+ };
272
+ }
273
+ function re(e, t, n, r) {
274
+ 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 < Z && o + i <= Q;
275
+ if (!a || !s) {
276
+ if (a = document.createElement("canvas").getContext("2d"), !a) throw Error("Unable to create a Canvas2D view group.");
277
+ s && (e[t] = a);
278
+ }
279
+ 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;
280
+ }
281
+ function $(e, t, n) {
282
+ return Math.min(n, Math.max(t, e));
283
+ }
284
+ //#endregion
285
+ //#region ../core/src/rendering/canvas2d/renderCanvas2D.js
286
+ function ie(e) {
287
+ let t = new te({ picking: !1 }, e);
288
+ e.layoutResult.collectRenderCommands(t);
289
+ }
290
+ //#endregion
291
+ export { X as n, ie as t };