@genome-spy/app 1.2.0 → 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 (87) 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-8hMSlqAQ.js → agentApi-BclFF9zB.js} +7130 -7509
  4. package/dist/agentApi.es.js +4344 -4015
  5. package/dist/agentShared.es.js +431 -458
  6. package/dist/arrayUtils-Bm7QnzhN.js +1306 -0
  7. package/dist/{blosc-JROzDOnd.js → blosc-C-W97QwH.js} +3 -3
  8. package/dist/{canvas2d-Bd8H8MMo.js → canvas2d-8MSf70d4.js} +78 -86
  9. package/dist/{canvas2d-D6VYooRf.js → canvas2d-BwGNI_Rx.js} +83 -91
  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/{containerView-aEVmYmkA.js → containerView-BItRtKqu.js} +5 -1
  16. package/dist/{containerView-CRJSc4bM.js → containerView-CWa6ZIJW.js} +5 -1
  17. package/dist/{debug-CQ0agCrd.js → debug-23s-jja_.js} +3 -2
  18. package/dist/{debug-DkIMiGdW.js → debug-CWRxvAss.js} +2 -3
  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 +4756 -5528
  39. package/dist/index.js +707 -547
  40. package/dist/inflate-BdC5KvHn.js +886 -0
  41. package/dist/{lz4-CUYSbVey.js → lz4-BLPgBOlE.js} +1 -1
  42. package/dist/{markUtils-CvLDz744.js → markUtils-RaatLEa-.js} +9 -6
  43. package/dist/metadataUtils-DxEPe0vj.js +879 -0
  44. package/dist/{order-BVvkjDRT.js → order-BnKzKjt4.js} +383 -347
  45. package/dist/{order-DmMoZsi1.js → order-BpJnq_nV.js} +375 -339
  46. package/dist/{parquetRead-0hFIa3Cc.js → parquetRead-D-yY8njE.js} +3 -11
  47. package/dist/{rasterExport-jeRVq6kY.js → rasterExport-B-WrX1pa.js} +5 -5
  48. package/dist/{rasterExport-DxvowWjH.js → rasterExport-C_vx4Jwd.js} +3 -3
  49. package/dist/{rasterization-DFj3Cvx4.js → rasterization-QktH8Sn2.js} +1 -1
  50. package/dist/{rectangle-Dl4Dy0hS.js → rectangle-BAdoDPXu.js} +34 -31
  51. package/dist/{renderCanvas2D-Bfm1NHFu.js → renderCanvas2D-CsRO78Pq.js} +88 -87
  52. package/dist/{renderCanvas2D-DVjhp834.js → renderCanvas2D-Y7pkRzbC.js} +93 -92
  53. package/dist/{rolldown-runtime-DF993M8W.js → rolldown-runtime-DeIk2rA4.js} +1 -1
  54. package/dist/{indexer-DOYMJ-Md.js → scaleNull-CVzag4z8.js} +2 -12
  55. package/dist/{indexer-DDC0YRGn.js → scaleNull-Pbz7QGnl.js} +2 -12
  56. package/dist/{scalePosition-0aeqp_kz.js → scalePosition-CRXa0rCC.js} +1 -1
  57. package/dist/schema.json +3801 -816
  58. package/dist/{svg-Bm2zxBPu.js → svg-BBMtLgtM.js} +369 -285
  59. package/dist/{svg-CkfuhONt.js → svg-JjWL6U-T.js} +371 -287
  60. package/dist/{svgRasterizer-DoRQEqFA.js → svgRasterizer-6OcftuoI.js} +2 -2
  61. package/dist/{svgRasterizer-raDDhBF-.js → svgRasterizer-DkNRaCPs.js} +4 -4
  62. package/dist/tableMetadataSourceAdapter-CUNwLsdi.js +291 -0
  63. package/dist/tableMetadataSourceAdapter-DQrEXCo6.js +1283 -0
  64. package/dist/url-DeOdSRrv.js +183 -0
  65. package/dist/{viewError-BkJeVYXA.js → viewError-B0TMfOpB.js} +1 -1
  66. package/dist/{viewError-IYqyluc7.js → viewError-D9aO90cI.js} +1 -1
  67. package/dist/{viewSelectors-7LyasQN-.js → viewSelectors-DkFvo33d.js} +832 -734
  68. package/dist/{viewSelectors-CbmkSQRT.js → viewSelectors-lM93fHAq.js} +900 -802
  69. package/dist/{viewUtils-DuddMNNw.js → viewUtils-0SJOewM6.js} +1861 -2459
  70. package/dist/webgl-CXIO3OQz.js +5782 -0
  71. package/dist/webgl-Pdvfhio5.js +5783 -0
  72. package/package.json +7 -5
  73. package/src/agentApi/index.d.ts +3 -2
  74. package/src/agentShared/index.d.ts +2 -0
  75. package/src/appTypes.d.ts +1 -6
  76. package/src/embedTypes.d.ts +36 -1
  77. package/src/index.d.ts +6 -0
  78. package/src/spec/sampleView.d.ts +68 -13
  79. package/src/state/paramProvenanceTypes.d.ts +25 -2
  80. package/src/state.d.ts +14 -52
  81. package/dist/clipOptions-DElJ8dTZ.js +0 -3097
  82. package/dist/clipOptions-D_wBNhzs.js +0 -3087
  83. package/dist/esm-Dndm-NaA.js +0 -1193
  84. package/dist/vega-scale-BoGHANI7.js +0 -2446
  85. package/dist/vega-scale-o9TRyzYH.js +0 -2443
  86. package/dist/webgl-CQfvgnxo.js +0 -5633
  87. package/dist/webgl-DVYkXtiZ.js +0 -5632
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./rasterization-CFogVB3B.js";
2
2
  import { t } from "./rectangle-DZTR6NFQ.js";
3
- import { t as n } from "./layoutResult-D50MSHXR.js";
4
- import { t as r } from "./renderCanvas2D-DVjhp834.js";
3
+ import { n } from "./color-jETn8xK_.js";
4
+ import { t as r } from "./renderCanvas2D-Y7pkRzbC.js";
5
5
  import { n as i, t as a } from "./rasterImage-B4rPLaW9.js";
6
6
  //#region ../core/src/rendering/canvas2d/svgRasterizer.js
7
7
  function o() {
@@ -1,7 +1,7 @@
1
- import { t as e } from "./rasterization-DFj3Cvx4.js";
2
- import { t } from "./rectangle-Dl4Dy0hS.js";
3
- import { t as n } from "./layoutResult-D50MSHXR.js";
4
- import { t as r } from "./renderCanvas2D-Bfm1NHFu.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 { t as r } from "./renderCanvas2D-CsRO78Pq.js";
5
5
  import { n as i, t as a } from "./rasterImage-B4rPLaW9.js";
6
6
  //#region ../core/src/rendering/canvas2d/svgRasterizer.js
7
7
  function o() {
@@ -0,0 +1,291 @@
1
+ import { c as e, r as t, s as n } from "./flowOutput-D5qpxWe0.js";
2
+ import { c as r, i, l as a, o, r as s, s as c } from "./metadataUtils-DxEPe0vj.js";
3
+ //#region ../core/src/data/sources/inlineSource.js
4
+ function l(e) {
5
+ return "values" in e;
6
+ }
7
+ var u = class extends t {
8
+ constructor(e, t) {
9
+ if (super(t), this.params = e, typeof e.values == "string" && !e?.format?.type) throw Error("Data format type (csv, dsv, ...) must be specified if a string is provided!");
10
+ }
11
+ get label() {
12
+ return "inlineSource";
13
+ }
14
+ isTrivial() {
15
+ let e = this.params.values, t = Array.isArray(e) ? e[0] : e;
16
+ return !!(t && Object.keys(t).length == 0 && t.constructor === Object);
17
+ }
18
+ updateDynamicData(e) {
19
+ this.#e(e);
20
+ }
21
+ loadSynchronously() {
22
+ this.#e(this.params.values);
23
+ }
24
+ #e(e) {
25
+ let t = [], n = (e) => e;
26
+ if (Array.isArray(e)) e.length > 0 && (t = e, n = y(e[0]));
27
+ else if (typeof e == "object") t = [e];
28
+ else if (typeof e == "string") t = a(e, m(p(this.params)));
29
+ else throw Error("\"values\" in data configuration is not an array, object, or a string!");
30
+ this.reset(), this.beginBatch({ type: "file" });
31
+ for (let e of t) this._propagate(n(e));
32
+ this.complete();
33
+ }
34
+ async load() {
35
+ this.loadSynchronously();
36
+ }
37
+ }, d = /* @__PURE__ */ new Set([
38
+ "csv",
39
+ "tsv",
40
+ "dsv"
41
+ ]), f = /* @__PURE__ */ new Set([
42
+ "gz",
43
+ "bgz",
44
+ "bgzf"
45
+ ]);
46
+ function p(e, t = []) {
47
+ if (!l(e) && !w(e)) return;
48
+ let n = { ...e.format };
49
+ if (n.type ??= w(e) && g(t), n.parse === void 0 && T(n.type) && (n.parse = "auto"), !n.type) throw Error("Format for the data source was not defined and it could not be inferred: " + JSON.stringify(e));
50
+ return n;
51
+ }
52
+ function m(e) {
53
+ let t = { ...e };
54
+ return (S(t) || C(t)) && t.columns && !("header" in t) && (t.header = t.columns), t;
55
+ }
56
+ function h(e) {
57
+ return r(e)?.responseType ?? "text";
58
+ }
59
+ function g(e) {
60
+ if (Array.isArray(e) && (e = e[0]), e) {
61
+ let t = v(e).split("/").pop()?.toLowerCase();
62
+ if (!t) return;
63
+ let n = t.split(".");
64
+ for (; n.length > 1 && f.has(n.at(-1));) n.pop();
65
+ let i = n.at(-1);
66
+ if (i && r(i)) return i;
67
+ }
68
+ }
69
+ function _(e) {
70
+ let t = v(e).split("/").pop()?.toLowerCase();
71
+ if (!t) return !1;
72
+ let n = t.split(".").at(-1);
73
+ return !!n && f.has(n);
74
+ }
75
+ function v(e) {
76
+ return e.replace(/[?#].*$/, "");
77
+ }
78
+ var y = (e) => typeof e == "object" ? x : b, b = (e) => ({ data: e }), x = (e) => e;
79
+ function S(e) {
80
+ return e.type == "csv" || e.type == "tsv";
81
+ }
82
+ function C(e) {
83
+ return e.type == "dsv";
84
+ }
85
+ function w(e) {
86
+ return "url" in e;
87
+ }
88
+ function T(e) {
89
+ return d.has(e);
90
+ }
91
+ //#endregion
92
+ //#region src/sampleView/metadata/metadataValidation.js
93
+ function E(e, t) {
94
+ let n = /* @__PURE__ */ new Map();
95
+ function r(e, t = 1, r = null) {
96
+ let i = n.get(e);
97
+ i || (i = {
98
+ message: e,
99
+ count: 0,
100
+ cases: []
101
+ }, n.set(e, i)), i.count += t, r && i.cases.push(r);
102
+ }
103
+ let i = new Set(e), a = /* @__PURE__ */ new Set();
104
+ for (let e of t) {
105
+ if (!("sample" in e)) {
106
+ r(D);
107
+ continue;
108
+ }
109
+ if (e.sample == null || e.sample === "") {
110
+ r(O);
111
+ continue;
112
+ }
113
+ let t = String(e.sample);
114
+ a.has(t) && r(k, 1, t), a.add(t);
115
+ }
116
+ return a.size === 0 && r(A), n.size > 0 ? { error: Array.from(n.values()) } : { statistics: {
117
+ unknownSamples: a.difference(i),
118
+ notCoveredSamples: i.difference(a),
119
+ samplesInBoth: a.intersection(i)
120
+ } };
121
+ }
122
+ var D = "Missing sample field in metadata record", O = "Empty sample field in metadata record", k = "Duplicate sample IDs found in metadata", A = "No valid samples found in metadata";
123
+ //#endregion
124
+ //#region src/sampleView/metadata/metadataSourceAttributes.js
125
+ function j(e, t) {
126
+ return t ? s(e, t, "/") : o([e], "/");
127
+ }
128
+ function M(e, t) {
129
+ let n = e.attributes;
130
+ if (!n) return {};
131
+ let r = e.attributeGroupSeparator, i = /* @__PURE__ */ new Set();
132
+ for (let e of t) {
133
+ let t = j(e, r), n = c(t, "/");
134
+ for (let e = 1; e <= n.length; e++) i.add(o(n.slice(0, e), "/"));
135
+ }
136
+ i.add("");
137
+ let a = {}, s = /* @__PURE__ */ new Map();
138
+ for (let [e, t] of Object.entries(n)) {
139
+ let n = j(e, r);
140
+ if (!i.has(n)) continue;
141
+ let o = s.get(n);
142
+ if (o) throw Error("Metadata source attributes has conflicting keys \"" + o + "\" and \"" + e + "\" that both resolve to \"" + n + "\".");
143
+ s.set(n, e), a[n] = { ...t };
144
+ }
145
+ return a;
146
+ }
147
+ //#endregion
148
+ //#region ../core/src/utils/topK.js
149
+ function N(e, t, r = (e) => +e, i = 0, a = e.length) {
150
+ let o = a - i;
151
+ if (t <= 0 || o <= 0) return [];
152
+ let s = new n(), c = 0;
153
+ for (; c < t && c < o; c++) s.push(c, r(e[i + c]));
154
+ for (; c < o; c++) {
155
+ let t = r(e[i + c]);
156
+ t > s.peekValue() && (s.push(c, t), s.pop());
157
+ }
158
+ let l = s.peekValue(), u = [], d = 0, f = 0;
159
+ for (c = 0; c < o; c++) r(e[i + c]) > l && d++;
160
+ let p = t - d;
161
+ for (c = 0; c < o; c++) {
162
+ let t = r(e[i + c]);
163
+ (t > l || t === l && f++ < p) && u.push(c);
164
+ }
165
+ return u.sort((t, n) => {
166
+ let a = r(e[i + t]), o = r(e[i + n]);
167
+ return a > o ? -1 : a < o ? 1 : t - n;
168
+ }), u.map((t) => e[i + t]);
169
+ }
170
+ //#endregion
171
+ //#region src/sampleView/metadata/exampleValues.js
172
+ function P(e, t) {
173
+ return N(e.map((e) => String(e ?? "").trim()).filter(Boolean), t, F);
174
+ }
175
+ function F(e) {
176
+ let t = 2166136261;
177
+ for (let n = 0; n < e.length; n += 1) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
178
+ return t >>> 0;
179
+ }
180
+ //#endregion
181
+ //#region src/sampleView/metadata/adapters/tableMetadataSourceAdapter.js
182
+ var I = class {
183
+ #e;
184
+ #t;
185
+ #n;
186
+ #r;
187
+ #i;
188
+ constructor(e, t = {}) {
189
+ this.#e = e, this.#t = t.sampleIdField ?? (e.backend.backend === "data" ? e.backend.sampleIdField ?? "sample" : "sample"), this.#n = t.baseUrl, this.#i = /* @__PURE__ */ new Set([
190
+ this.#t,
191
+ ...t.excludedColumns ?? [],
192
+ ...e.excludeColumns ?? []
193
+ ]);
194
+ }
195
+ async listColumns(e) {
196
+ let t = await this.#a(e), n = this.#t, r = /* @__PURE__ */ new Set();
197
+ for (let e of t) for (let t of Object.keys(e)) t !== n && (this.#c(t) || r.add(t));
198
+ return Array.from(r).map((e) => ({ id: e }));
199
+ }
200
+ async listSampleIds(e) {
201
+ return (await this.#a(e)).map((e) => String(e[this.#t] ?? ""));
202
+ }
203
+ async listSamples(e = {}, t) {
204
+ let n = await this.#a(t), r = this.#t;
205
+ return n.map((t) => {
206
+ let n = String(t[r] ?? ""), i = e.displayNameField ? t[e.displayNameField] : void 0;
207
+ return {
208
+ id: n,
209
+ displayName: i == null ? n : String(i)
210
+ };
211
+ });
212
+ }
213
+ async listIdentifierExamples(e, t) {
214
+ return [{
215
+ name: "column",
216
+ primary: !0,
217
+ examples: P((await this.listColumns(t)).map((e) => e.id), e)
218
+ }];
219
+ }
220
+ async resolveColumns(e, t) {
221
+ let n = await this.listColumns(t), r = new Set(n.map((e) => e.id)), i = [], a = /* @__PURE__ */ new Set();
222
+ for (let t of e) r.has(t) ? i.includes(t) || i.push(t) : a.add(t);
223
+ return {
224
+ columnIds: i,
225
+ missing: Array.from(a)
226
+ };
227
+ }
228
+ async fetchColumns(e, t) {
229
+ let n = await this.#a(t), r = this.#t, a = new Set(e.sampleIds);
230
+ for (let t of e.columnIds) if (this.#c(t)) throw Error("Column \"" + t + "\" is excluded by metadata source configuration.");
231
+ let o = [];
232
+ for (let t of n) {
233
+ let n = String(t[r] ?? "");
234
+ if (!a.has(n)) continue;
235
+ let i = { sample: n };
236
+ for (let n of e.columnIds) i[n] = t[n];
237
+ o.push(i);
238
+ }
239
+ if (o.length === 0) throw Error("Metadata source rows do not match any sample ids in the current view.");
240
+ let s = E(e.sampleIds, o);
241
+ if ("error" in s) {
242
+ let e = s.error[0];
243
+ throw Error("Invalid metadata source payload: " + String(e.message));
244
+ }
245
+ if (s.statistics.samplesInBoth.size === 0) throw Error("Metadata source rows do not match any sample ids in the current view.");
246
+ let c = M(this.#e, e.columnIds), l = e.groupPath ?? this.#e.groupPath, u = i(o, c, this.#e.attributeGroupSeparator, l);
247
+ return e.replace !== void 0 && (u.replace = e.replace), u;
248
+ }
249
+ async #a(e) {
250
+ return this.#r ||= this.loadRows(e).catch((e) => {
251
+ throw this.#r = void 0, e;
252
+ }), this.#r;
253
+ }
254
+ async loadRows(e) {
255
+ let t = this.#e.backend;
256
+ if (t.backend !== "data") throw Error("Table metadata loading requires a data backend.");
257
+ let n = t.data;
258
+ if ("url" in n) return this.#o(n, e);
259
+ if ("values" in n) return this.#s(n);
260
+ throw Error("Metadata source data backend supports only UrlData and InlineData.");
261
+ }
262
+ async #o(t, n) {
263
+ if (typeof t.url != "string") throw Error("Metadata source UrlData currently supports only string URLs.");
264
+ let r = e(this.#n, t.url), i = p(t, r), o = h(i.type), s;
265
+ try {
266
+ s = await fetch(r, { signal: n });
267
+ } catch (e) {
268
+ throw Error("Could not load metadata source: " + e.message, { cause: e });
269
+ }
270
+ if (!s.ok) throw Error("Could not load metadata source: " + s.status + " " + s.statusText);
271
+ let c;
272
+ return c = typeof s[o] == "function" ? await s[o]() : await s.text(), a(c, m(i));
273
+ }
274
+ async #s(e) {
275
+ let t = e.values, n = [];
276
+ if (Array.isArray(t)) {
277
+ if (t.length > 0) {
278
+ let e = y(t[0]);
279
+ n = t.map((t) => e(t));
280
+ }
281
+ } else if (typeof t == "object") n = [t];
282
+ else if (typeof t == "string") n = a(t, m(p(e)));
283
+ else throw Error("Inline metadata source values must be an array, object, or a string.");
284
+ return n;
285
+ }
286
+ #c(e) {
287
+ return this.#i.has(e);
288
+ }
289
+ };
290
+ //#endregion
291
+ export { E as a, y as c, u as d, l as f, M as i, h as l, P as n, p as o, N as r, _ as s, I as t, m as u };