@genome-spy/app 0.79.1 → 0.81.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.
@@ -1,4 +1,5 @@
1
- import { $n as e, Dt as t, F as n, H as r, I as i, L as a, N as o, P as s, R as c, Rt as l, V as u, Xn as d, Zn as f, at as p, i as m, mt as h, nt as g, ot as _, s as v, tt as y, z as b } from "./viewUtils-BBRWguwj.js";
1
+ import { n as e } from "./rolldown-runtime-DF993M8W.js";
2
+ import { Bt as t, F as n, H as r, I as i, L as a, N as o, P as s, R as c, V as l, at as u, ht as d, i as f, kt as p, nt as m, or as h, s as g, sr as _, st as v, tt as y, z as b } from "./viewUtils-ChwePFhK.js";
2
3
  import { n as x, t as S } from "./componentStyles-BGy033io.js";
3
4
  //#region src/viewScopeUtils.js
4
5
  function C(e, t) {
@@ -7,7 +8,7 @@ function C(e, t) {
7
8
  function w(e, t) {
8
9
  if (!e || typeof e.visit != "function") return !1;
9
10
  let n = 0;
10
- for (let r of g(e)) r.selector.param === t && (n += 1);
11
+ for (let r of m(e)) r.selector.param === t && (n += 1);
11
12
  return n > 1;
12
13
  }
13
14
  //#endregion
@@ -34,11 +35,11 @@ function D(e) {
34
35
  //#region src/sampleView/viewRef.js
35
36
  function O(e) {
36
37
  if (!e.explicitName) throw Error("Cannot create a view reference without an explicit view name.");
37
- return p(e);
38
+ return u(e);
38
39
  }
39
40
  function k(e) {
40
41
  if (!e.explicitName) return;
41
- let t = p(e);
42
+ let t = u(e);
42
43
  return JSON.stringify({
43
44
  s: t.scope,
44
45
  v: t.view
@@ -46,7 +47,7 @@ function k(e) {
46
47
  }
47
48
  function A(e) {
48
49
  let t = /* @__PURE__ */ new Map();
49
- h(e, (e) => {
50
+ d(e, (e) => {
50
51
  let n = k(e);
51
52
  n && t.set(n, (t.get(n) ?? 0) + 1);
52
53
  });
@@ -68,7 +69,7 @@ function N(e, t, n) {
68
69
  if (n) try {
69
70
  let t = [];
70
71
  e.visit((e) => {
71
- e instanceof v && e.isVisible() && ne(e, r) && t.push(e);
72
+ e instanceof g && e.isVisible() && ne(e, r) && t.push(e);
72
73
  });
73
74
  for (let e of t) {
74
75
  let t = e.getEncoding(), n = t?.x && "field" in t.x, r = Object.entries(t).some(([e, t]) => ![
@@ -116,7 +117,7 @@ function F(e) {
116
117
  }
117
118
  function I(e) {
118
119
  try {
119
- return m(e).filter((e) => ![
120
+ return f(e).filter((e) => ![
120
121
  "sample",
121
122
  "x",
122
123
  "x2"
@@ -158,8 +159,8 @@ function ne(e, t) {
158
159
  }
159
160
  function re(e) {
160
161
  if (e.view.getEncoding()?.x2) return !0;
161
- let t = e.view.getScaleResolution("x")?.getScale()?.type;
162
- return t ? l(t) : !1;
162
+ let n = e.view.getScaleResolution("x")?.getScale()?.type;
163
+ return n ? t(n) : !1;
163
164
  }
164
165
  function ie(e) {
165
166
  return e === "quantitative" ? M : ee;
@@ -190,16 +191,16 @@ function ce({ viewSelector: e, field: t, selectionSelector: n, aggregation: r, f
190
191
  }
191
192
  };
192
193
  }
193
- var le = f({
194
+ var le = _({
194
195
  name: "paramProvenance",
195
196
  initialState: { entries: {} },
196
197
  reducers: {
197
198
  paramChange: (e, t) => {
198
- let n = _(t.payload.selector);
199
+ let n = v(t.payload.selector);
199
200
  e.entries[n] = t.payload;
200
201
  },
201
202
  expandPointSelection: (e, t) => {
202
- let n = t.payload, r = _(n.selector), i;
203
+ let n = t.payload, r = v(n.selector), i;
203
204
  if ("rule" in n && n.rule) i = { rule: n.rule };
204
205
  else if ("predicate" in n && n.predicate) i = { predicate: n.predicate };
205
206
  else throw Error("expandPointSelection requires either 'rule' or 'predicate'.");
@@ -4710,13 +4711,13 @@ function Gn(e, t, n) {
4710
4711
  }
4711
4712
  //#endregion
4712
4713
  //#region src/utils/safeMarkdown.js
4713
- function Kn(e, n = {}) {
4714
- let r = Gn(e), i = new DOMParser().parseFromString(`<!DOCTYPE html><html><body><div>${r}</div></body></html>`, "text/html");
4715
- i.normalize(), qn(i.body);
4716
- for (let e of i.querySelectorAll("a[href]")) e.setAttribute("target", "blank"), e.setAttribute("rel", "noopener noreferrer"), e.setAttribute("href", t(e.getAttribute("href"), n.baseUrl));
4717
- for (let e of i.querySelectorAll("img[src]")) e.setAttribute("src", t(e.getAttribute("src"), n.baseUrl));
4718
- let a = i.body.removeChild(i.querySelector("body > div"));
4719
- return a.className = "markdown", a;
4714
+ function Kn(e, t = {}) {
4715
+ let n = Gn(e), r = new DOMParser().parseFromString(`<!DOCTYPE html><html><body><div>${n}</div></body></html>`, "text/html");
4716
+ r.normalize(), qn(r.body);
4717
+ for (let e of r.querySelectorAll("a[href]")) e.setAttribute("target", "blank"), e.setAttribute("rel", "noopener noreferrer"), e.setAttribute("href", p(e.getAttribute("href"), t.baseUrl));
4718
+ for (let e of r.querySelectorAll("img[src]")) e.setAttribute("src", p(e.getAttribute("src"), t.baseUrl));
4719
+ let i = r.body.removeChild(r.querySelector("body > div"));
4720
+ return i.className = "markdown", i;
4720
4721
  }
4721
4722
  function qn(e) {
4722
4723
  if (e.nodeType !== 3) {
@@ -4731,9 +4732,9 @@ function qn(e) {
4731
4732
  //#endregion
4732
4733
  //#region src/agentShared/index.js
4733
4734
  function Jn(e) {
4734
- if (e.startsWith("sampleView/")) return u.actions[e.slice(11)];
4735
+ if (e.startsWith("sampleView/")) return l.actions[e.slice(11)];
4735
4736
  if (e.startsWith("paramProvenance/")) return le.actions[e.slice(16)];
4736
- if (e.startsWith("viewSettings/")) return d.actions[e.slice(13)];
4737
+ if (e.startsWith("viewSettings/")) return h.actions[e.slice(13)];
4737
4738
  throw Error("Unsupported app actionType " + e + ".");
4738
4739
  }
4739
4740
  //#endregion
@@ -0,0 +1,346 @@
1
+ import { at as e, f as t, xt as n } from "./viewUtils-ChwePFhK.js";
2
+ import { n as r, t as i } from "./viewIdentityRegistry-DuZgd_T3.js";
3
+ //#region ../core/src/debug/valuePreview.js
4
+ var a = 3, o = 12, s = 8, c = 160;
5
+ function l(e, t = 0) {
6
+ if (typeof e != "object" || !e) return u(e);
7
+ if (t >= a) return Array.isArray(e) ? `[Array(${e.length})]` : `[Object(${Object.keys(e).length})]`;
8
+ if (Array.isArray(e)) {
9
+ let n = e.slice(0, s).map((e) => l(e, t + 1));
10
+ return e.length > s && n.push(`... ${e.length - s} more items`), n;
11
+ }
12
+ let n = {}, r = e, i = Object.keys(r);
13
+ for (let e of i.slice(0, o)) n[e] = l(r[e], t + 1);
14
+ return i.length > o && (n["..."] = `${i.length - o} more keys`), n;
15
+ }
16
+ function u(e) {
17
+ return typeof e == "string" && e.length > c ? e.slice(0, c) + "..." : e;
18
+ }
19
+ //#endregion
20
+ //#region ../core/src/debug/dataflowDebugSnapshot.js
21
+ function d(e, t) {
22
+ if (!e) return {
23
+ sourceIds: [],
24
+ nodes: [],
25
+ collectorCount: 0
26
+ };
27
+ let n = [], r = [], i = /* @__PURE__ */ new Set(), a = p(t.rootView);
28
+ for (let o of e.dataSources) {
29
+ let e = f(o, void 0, t, n, i, a);
30
+ r.push(e.id);
31
+ }
32
+ return {
33
+ sourceIds: r,
34
+ nodes: n,
35
+ collectorCount: e.collectors.length
36
+ };
37
+ }
38
+ function f(e, t, n, r, i, a) {
39
+ let o = n.getDebugId(e);
40
+ if (i.has(e)) {
41
+ let e = r.find((e) => e.id === o);
42
+ if (!e) throw Error("Seen flow node missing from debug snapshot.");
43
+ return e;
44
+ }
45
+ i.add(e);
46
+ let s = e.getDebugState(), c = s.view ?? a.get(e), u = {
47
+ id: o,
48
+ parentId: t,
49
+ childIds: [],
50
+ label: s.label,
51
+ count: s.stats.count,
52
+ first: l(s.stats.first),
53
+ completed: s.completed,
54
+ initialized: s.initialized,
55
+ disposed: s.disposed,
56
+ params: s.params ? l(s.params) : void 0,
57
+ viewId: c ? n.getDebugId(c) : void 0,
58
+ viewPath: c ? c.getPathString() : void 0,
59
+ domainSensitiveScaleChannels: s.domainSensitiveScaleChannels
60
+ };
61
+ r.push(u);
62
+ for (let e of s.children) {
63
+ let t = f(e, o, n, r, i, a);
64
+ u.childIds.push(t.id);
65
+ }
66
+ return u;
67
+ }
68
+ function p(e) {
69
+ let t = /* @__PURE__ */ new WeakMap();
70
+ return e && e.visit((e) => {
71
+ let n = e.flowHandle;
72
+ n?.dataSource && t.set(n.dataSource, e), n?.node && t.set(n.node, e), n?.collector && t.set(n.collector, e);
73
+ }), t;
74
+ }
75
+ //#endregion
76
+ //#region ../core/src/debug/markDebugSnapshot.js
77
+ function m(e, n) {
78
+ if (!e) return { marks: [] };
79
+ let r = [];
80
+ return h(e, (e) => {
81
+ let i = e.mark;
82
+ if (!i) return;
83
+ let a = i.getDebugState();
84
+ r.push({
85
+ viewId: n.getDebugId(e),
86
+ viewPath: e.getPathString(),
87
+ type: i.getType(),
88
+ ready: !!i.isReady(),
89
+ pickingParticipant: i.isPickingParticipant(),
90
+ markUniformsAltered: a.markUniformsAltered,
91
+ encodingChannels: Object.keys(i.encoding),
92
+ encoderChannels: i.encoders ? Object.keys(i.encoders) : [],
93
+ searchFields: t(e.getEncoding()) ?? [],
94
+ dataCount: g(e),
95
+ vertexCount: a.vertexCount,
96
+ allocatedVertices: a.allocatedVertices,
97
+ rangeCount: i.rangeMap.size,
98
+ properties: l(a.properties)
99
+ });
100
+ }), { marks: r };
101
+ }
102
+ function h(e, t) {
103
+ if (t(e), e instanceof r) for (let n of e) h(n, t);
104
+ }
105
+ function g(e) {
106
+ return (e.getCollector?.())?.getItemCount();
107
+ }
108
+ //#endregion
109
+ //#region ../core/src/debug/paramDebugSnapshot.js
110
+ function _(e, t) {
111
+ if (!e) return { scopes: [] };
112
+ let n = [];
113
+ return v(e, (e) => {
114
+ let r = e.paramRuntime.getDebugState();
115
+ n.push({
116
+ viewId: t.getDebugId(e),
117
+ viewPath: e.getPathString(),
118
+ scopeId: r.scopeId,
119
+ disposed: r.disposed,
120
+ params: r.params.map((e) => ({
121
+ name: e.name,
122
+ kind: e.kind,
123
+ value: l(e.value),
124
+ writable: e.writable,
125
+ configured: e.configured,
126
+ config: e.config ? l(e.config) : void 0
127
+ }))
128
+ });
129
+ }), { scopes: n };
130
+ }
131
+ function v(e, t) {
132
+ if (t(e), e instanceof r) for (let n of e) v(n, t);
133
+ }
134
+ //#endregion
135
+ //#region ../core/src/debug/resolutionDebugSnapshot.js
136
+ function y(e, t) {
137
+ if (!e) return {
138
+ scales: [],
139
+ axes: [],
140
+ legends: []
141
+ };
142
+ let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
143
+ return x(e, (e) => {
144
+ b(n, e.resolutions.scale), b(r, e.resolutions.axis), b(i, e.resolutions.legend);
145
+ }), {
146
+ scales: Array.from(n).map((e) => S(e, t)),
147
+ axes: Array.from(r).map((e) => C(e, t)),
148
+ legends: Array.from(i).map((e) => w(e, t))
149
+ };
150
+ }
151
+ function b(e, t) {
152
+ for (let n of Object.values(t)) n && e.add(n);
153
+ }
154
+ function x(e, t) {
155
+ if (t(e), e instanceof r) for (let n of e) x(n, t);
156
+ }
157
+ function S(e, t) {
158
+ let n = e.getDebugState();
159
+ return {
160
+ id: t.getDebugId(e),
161
+ ...E(n.hostView, t),
162
+ channel: n.channel,
163
+ name: n.name,
164
+ type: n.type,
165
+ resolvedScaleType: n.resolvedScaleType,
166
+ domain: n.domain,
167
+ complexDomain: n.complexDomain,
168
+ range: n.range,
169
+ zoomable: n.zoomable,
170
+ zoomed: n.zoomed,
171
+ activeMemberCount: n.activeMemberCount,
172
+ dataDomainMemberCount: n.dataDomainMemberCount,
173
+ members: n.members.map((e) => ({
174
+ viewId: t.getDebugId(e.view),
175
+ viewPath: e.view.getPathString(),
176
+ chrome: T(e.view),
177
+ channel: e.channel,
178
+ field: "field" in e.channelDef ? e.channelDef.field : void 0,
179
+ expr: "expr" in e.channelDef ? e.channelDef.expr : void 0,
180
+ type: "type" in e.channelDef ? e.channelDef.type : void 0,
181
+ contributesToDomain: e.contributesToDomain,
182
+ active: e.active
183
+ }))
184
+ };
185
+ }
186
+ function C(e, t) {
187
+ let n = e.getDebugState();
188
+ return {
189
+ id: t.getDebugId(e),
190
+ ...E(n.hostView, t),
191
+ channel: n.channel,
192
+ title: n.title,
193
+ scaleResolutionId: n.scaleResolution ? t.getDebugId(n.scaleResolution) : void 0,
194
+ hasVisibleNonChromeMember: n.hasVisibleNonChromeMember,
195
+ members: n.members.map((e) => ({
196
+ viewId: t.getDebugId(e.view),
197
+ viewPath: e.view.getPathString(),
198
+ chrome: T(e.view),
199
+ channel: e.channel,
200
+ field: "field" in e.channelDef ? e.channelDef.field : void 0,
201
+ expr: "expr" in e.channelDef ? e.channelDef.expr : void 0,
202
+ type: "type" in e.channelDef ? e.channelDef.type : void 0
203
+ }))
204
+ };
205
+ }
206
+ function w(e, t) {
207
+ let n = e.getDebugState();
208
+ return {
209
+ id: t.getDebugId(e),
210
+ ...E(n.hostView, t),
211
+ channel: n.channel,
212
+ hasVisibleNonChromeMember: n.hasVisibleNonChromeMember,
213
+ definitionCount: n.legendDefs.length,
214
+ members: n.members.map((e) => ({
215
+ viewId: t.getDebugId(e.view),
216
+ viewPath: e.view.getPathString(),
217
+ chrome: T(e.view),
218
+ channel: e.channel
219
+ }))
220
+ };
221
+ }
222
+ function T(e) {
223
+ return n(e) || e.getLayoutAncestors().some(n);
224
+ }
225
+ function E(e, t) {
226
+ return {
227
+ hostViewId: e ? t.getDebugId(e) : void 0,
228
+ hostViewPath: e?.getPathString()
229
+ };
230
+ }
231
+ //#endregion
232
+ //#region ../core/src/debug/viewDebugSnapshot.js
233
+ function D(e, t) {
234
+ if (!e) return {
235
+ rootId: void 0,
236
+ nodes: []
237
+ };
238
+ let i = t.includeChrome ?? !1, a = [], o = (e, s) => {
239
+ let c = n(e);
240
+ if (c && !i) return;
241
+ let l = t.getDebugId(e), u = O(e, l, s, c, t);
242
+ if (a.push(u), e instanceof r) for (let t of e) {
243
+ let e = o(t, l);
244
+ e && u.childIds.push(e.id);
245
+ }
246
+ return u;
247
+ };
248
+ return {
249
+ rootId: o(e, void 0)?.id,
250
+ nodes: a
251
+ };
252
+ }
253
+ function O(e, t, n, r, i) {
254
+ let a = [];
255
+ return {
256
+ id: t,
257
+ parentId: n,
258
+ childIds: [],
259
+ name: e.name,
260
+ explicitName: e.explicitName,
261
+ defaultName: e.defaultName,
262
+ path: k(a, "path", e.name, () => e.getPathString()),
263
+ className: e.constructor.name,
264
+ type: k(a, "type", "unknown", () => A(e)),
265
+ markType: k(a, "markType", void 0, () => j(e)),
266
+ chrome: r,
267
+ visible: k(a, "visible", !1, () => e.isVisible()),
268
+ configuredVisible: k(a, "configuredVisible", !1, () => e.isConfiguredVisible()),
269
+ visibleInSpec: k(a, "visibleInSpec", !1, () => e.isVisibleInSpec()),
270
+ dataInitializationState: k(a, "dataInitializationState", "none", () => e.getDataInitializationState()),
271
+ selector: k(a, "selector", void 0, () => M(e)),
272
+ bounds: k(a, "bounds", void 0, () => N(e)),
273
+ size: k(a, "size", void 0, () => P(e.getSize())),
274
+ viewportSize: k(a, "viewportSize", void 0, () => P(e.getViewportSize())),
275
+ scaleResolutionIds: k(a, "scaleResolutionIds", {}, () => F(e.resolutions.scale, i)),
276
+ axisResolutionIds: k(a, "axisResolutionIds", {}, () => F(e.resolutions.axis, i)),
277
+ legendResolutionIds: k(a, "legendResolutionIds", {}, () => F(e.resolutions.legend, i)),
278
+ encodings: k(a, "encodings", {}, () => I(e, i)),
279
+ paramNames: k(a, "paramNames", [], () => Array.from(e.paramRuntime.paramConfigs.keys())),
280
+ spec: k(a, "spec", {}, () => structuredClone(e.spec)),
281
+ debugErrors: a
282
+ };
283
+ }
284
+ function k(e, t, n, r) {
285
+ try {
286
+ return r();
287
+ } catch (r) {
288
+ return console.warn(`Failed to collect view debug field "${t}".`, r), e.push({
289
+ field: t,
290
+ message: r instanceof Error ? r.message : String(r)
291
+ }), n;
292
+ }
293
+ }
294
+ function A(e) {
295
+ if (typeof e.getMarkType == "function") return "unit";
296
+ let t = e.constructor.name;
297
+ return t.endsWith("View") ? t.slice(0, -4).toLowerCase() : t.toLowerCase();
298
+ }
299
+ function j(e) {
300
+ let t = e;
301
+ if (typeof t.getMarkType == "function") return t.getMarkType();
302
+ }
303
+ function M(t) {
304
+ if (t.explicitName) return e(t);
305
+ }
306
+ function N(e) {
307
+ let t = e.coords;
308
+ if (t) return {
309
+ x: t.x,
310
+ y: t.y,
311
+ width: t.width,
312
+ height: t.height
313
+ };
314
+ }
315
+ function P(e) {
316
+ return {
317
+ width: e.width,
318
+ height: e.height
319
+ };
320
+ }
321
+ function F(e, t) {
322
+ let n = {};
323
+ for (let [r, i] of Object.entries(e)) i && (n[r] = t.getDebugId(i));
324
+ return n;
325
+ }
326
+ function I(e, t) {
327
+ let n = e.mark?.encoding ?? e.getEncoding(), r = {};
328
+ for (let [i, a] of Object.entries(n)) a && (r[i] = {
329
+ channel: i,
330
+ field: "field" in a ? a.field : void 0,
331
+ expr: "expr" in a ? a.expr : void 0,
332
+ value: "value" in a ? a.value : void 0,
333
+ type: "type" in a ? a.type : void 0,
334
+ scaleResolutionId: L(e.resolutions.scale, i, t),
335
+ axisResolutionId: L(e.resolutions.axis, i, t),
336
+ legendResolutionId: L(e.resolutions.legend, i, t),
337
+ channelDef: structuredClone(a)
338
+ });
339
+ return r;
340
+ }
341
+ function L(e, t, n) {
342
+ let r = e[t];
343
+ return r ? n.getDebugId(r) : void 0;
344
+ }
345
+ //#endregion
346
+ export { d as createDataflowDebugSnapshot, m as createMarkDebugSnapshot, _ as createParamDebugSnapshot, y as createResolutionDebugSnapshot, D as createViewDebugSnapshot, i as getViewIdentityRegistry };