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