@genome-spy/app 0.83.1 → 0.84.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.
@@ -0,0 +1,92 @@
1
+ import { v as e, y as t } from "./viewSelectors-BhW4mTR1.js";
2
+ //#region ../core/src/encoder/metadataChannels.js
3
+ function n(e) {
4
+ return i(e?.key, "key");
5
+ }
6
+ function r(e) {
7
+ return i(e?.search, "search");
8
+ }
9
+ function i(e, t) {
10
+ if (!e) return;
11
+ let n = Array.isArray(e) ? e : [e];
12
+ if (n.length === 0) throw Error("The " + t + " channel array must not be empty.");
13
+ let r = [];
14
+ for (let e of n) {
15
+ if (!e || typeof e != "object" || !("field" in e)) throw Error("The " + t + " channel must be a field definition or an array of field definitions.");
16
+ let n = e.field;
17
+ if (typeof n != "string") throw Error("The " + t + " channel field definition must include a string field name.");
18
+ r.push(n);
19
+ }
20
+ return r;
21
+ }
22
+ //#endregion
23
+ //#region ../core/src/view/containerView.js
24
+ var a = class n extends t {
25
+ #e = /* @__PURE__ */ new Map();
26
+ constructor(e, t, n, r, i, a) {
27
+ super(e, t, n, r, i, a), this.spec = e;
28
+ }
29
+ async initializeChildren() {}
30
+ getNextAutoName(e) {
31
+ let t = this.#e.get(e) ?? 0;
32
+ return this.#e.set(e, t + 1), e + t;
33
+ }
34
+ *[Symbol.iterator]() {}
35
+ visit(e) {
36
+ let t;
37
+ try {
38
+ t = e(this);
39
+ } catch (e) {
40
+ throw e.view = this, e;
41
+ }
42
+ if (t === "VISIT_STOP") return t;
43
+ if (t !== "VISIT_SKIP") {
44
+ e.beforeChildren && e.beforeChildren(this);
45
+ for (let t of this) {
46
+ let n = t.visit(e);
47
+ if (n === "VISIT_STOP") return n;
48
+ }
49
+ e.afterChildren && e.afterChildren(this), e.postOrder && e.postOrder(this);
50
+ }
51
+ }
52
+ findDescendantByPath(e) {
53
+ let t = this;
54
+ for (let r = 0; r < e.length; r++) {
55
+ if (!(t instanceof n)) return;
56
+ let i = t.#t(e[r]);
57
+ if (!i) return;
58
+ if (r === e.length - 1) return i;
59
+ t = i;
60
+ }
61
+ }
62
+ #t(e) {
63
+ for (let t of this) if (t.name === e) return t;
64
+ }
65
+ findDescendantByName(t) {
66
+ let n;
67
+ return this.visit((r) => {
68
+ if (r.name == t) return n = r, e;
69
+ }), n;
70
+ }
71
+ getDefaultResolution(e, t) {
72
+ return "shared";
73
+ }
74
+ }, o = /* @__PURE__ */ new WeakMap();
75
+ function s(e) {
76
+ let t = o.get(e);
77
+ return t || (t = new c(), o.set(e, t)), t;
78
+ }
79
+ var c = class {
80
+ #e = /* @__PURE__ */ new WeakMap();
81
+ #t = /* @__PURE__ */ new Map();
82
+ #n = 0;
83
+ getId(e) {
84
+ let t = this.#e.get(e);
85
+ return t || (t = "view-" + String(this.#n), this.#n++, this.#e.set(e, t), this.#t.set(t, e)), t;
86
+ }
87
+ getView(e) {
88
+ return this.#t.get(e);
89
+ }
90
+ };
91
+ //#endregion
92
+ export { r as i, a as n, n as r, s as t };
@@ -1,4 +1,4 @@
1
- import { v as e, y as t } from "./metadataChannels-fGQOmJj0.js";
1
+ import { _ as e, v as t } from "./viewSelectors-Bwzj10Qz.js";
2
2
  //#region ../core/src/view/containerView.js
3
3
  var n = class n extends t {
4
4
  #e = /* @__PURE__ */ new Map();
@@ -0,0 +1,120 @@
1
+ //#region ../core/src/view/layout/rectangle.js
2
+ function e(e) {
3
+ return () => e;
4
+ }
5
+ var t = class t {
6
+ static create(n, r, i, a) {
7
+ return new t(e(n), e(r), e(i), e(a));
8
+ }
9
+ static ZERO = t.create(0, 0, 0, 0);
10
+ _offset(e, t) {
11
+ let n = this["_" + e];
12
+ if (t === 0) return n;
13
+ switch (typeof t) {
14
+ case "number": return () => n() + t;
15
+ case "function": return () => n() + t();
16
+ default: throw Error("Not a number of function");
17
+ }
18
+ }
19
+ _passThrough(e) {
20
+ return this._offset(e, 0);
21
+ }
22
+ constructor(e, t, n, r) {
23
+ this._x = e, this._y = t, this._width = n, this._height = r;
24
+ }
25
+ get x() {
26
+ return this._x();
27
+ }
28
+ get y() {
29
+ return this._y();
30
+ }
31
+ get width() {
32
+ return this._width();
33
+ }
34
+ get height() {
35
+ return this._height();
36
+ }
37
+ get x2() {
38
+ return this._x() + this._width();
39
+ }
40
+ get y2() {
41
+ return this._y() + this._height();
42
+ }
43
+ equals(e) {
44
+ return e ? this === e || this.x === e.x && this.y === e.y && this.width === e.width && this.height === e.height : !1;
45
+ }
46
+ modify(n) {
47
+ if (!Object.keys(n).length) return this;
48
+ let r = (t) => {
49
+ let r = n[t];
50
+ return typeof r == "number" ? e(r) : typeof r == "function" ? r : this._passThrough(t);
51
+ };
52
+ return new t(r("x"), r("y"), r("width"), r("height"));
53
+ }
54
+ translate(e, n) {
55
+ return e === 0 && n === 0 ? this : new t(this._offset("x", e), this._offset("y", n), this._passThrough("width"), this._passThrough("height"));
56
+ }
57
+ translateBy(e) {
58
+ return this.translate(e.x, e.y);
59
+ }
60
+ expand(e, n = 1) {
61
+ 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"));
62
+ }
63
+ shrink(e) {
64
+ return this.expand(e, -1);
65
+ }
66
+ intersect(e) {
67
+ return this === e || e == null ? this : new t(() => Math.max(this.x, e.x), () => Math.max(this.y, e.y), () => Math.min(this.x2, e.x2) - Math.max(this.x, e.x), () => Math.min(this.y2, e.y2) - Math.max(this.y, e.y));
68
+ }
69
+ intersectX(e) {
70
+ return this === e || e == null ? this : new t(() => Math.max(this.x, e.x), this._passThrough("y"), () => Math.min(this.x2, e.x2) - Math.max(this.x, e.x), this._passThrough("height"));
71
+ }
72
+ intersectY(e) {
73
+ return this === e || e == null ? this : new t(this._passThrough("x"), () => Math.max(this.y, e.y), this._passThrough("width"), () => Math.min(this.y2, e.y2) - Math.max(this.y, e.y));
74
+ }
75
+ union(e) {
76
+ return this === e || e == null ? this : new t(() => Math.min(this.x, e.x), () => Math.min(this.y, e.y), () => Math.max(this.x2, e.x2) - Math.min(this.x, e.x), () => Math.max(this.y2, e.y2) - Math.min(this.y, e.y));
77
+ }
78
+ isDefined() {
79
+ return this.width >= 0 && this.height >= 0;
80
+ }
81
+ flatten() {
82
+ return new t(e(this.x), e(this.y), e(this.width), e(this.height));
83
+ }
84
+ containsPoint(e, t) {
85
+ return e >= this.x && e < this.x2 && t >= this.y && t < this.y2;
86
+ }
87
+ normalizePoint(e, t, n = !1) {
88
+ let r = {
89
+ x: (e - this.x) / this.width,
90
+ y: (t - this.y) / this.height
91
+ };
92
+ return n && (r.y = 1 - r.y), r;
93
+ }
94
+ denormalizePoint(e, t, n = !1) {
95
+ return n && (t = 1 - t), {
96
+ x: this.x + e * this.width,
97
+ y: this.y + t * this.height
98
+ };
99
+ }
100
+ toString() {
101
+ return `Rectangle: x: ${this.x}, y: ${this.y}, width: ${this.width}, height: ${this.height}`;
102
+ }
103
+ toRoundedString() {
104
+ return `Rectangle: x: ${Math.round(this.x)}, y: ${Math.round(this.y)}, width: ${Math.round(this.width)}, height: ${Math.round(this.height)}`;
105
+ }
106
+ }, n = class {
107
+ constructor(e) {
108
+ this.globalOptions = e;
109
+ }
110
+ beginSampleFacetBatch() {}
111
+ endSampleFacetBatch() {}
112
+ pushView(e, t) {}
113
+ popView(e) {}
114
+ renderMark(e, t) {}
115
+ getDevicePixelRatio() {
116
+ return 1;
117
+ }
118
+ };
119
+ //#endregion
120
+ export { t as n, n as t };