@genome-spy/app 1.0.0 → 1.1.1

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 (39) hide show
  1. package/dist/SharedReadCache-Ey5QIiPM.js +207 -0
  2. package/dist/{agentApi-Z65dw-sD.js → agentApi-sPuuT0KS.js} +3573 -3485
  3. package/dist/agentApi.es.js +1550 -1461
  4. package/dist/agentShared.es.js +2 -2
  5. package/dist/{canvas2d-t_N10CeW.js → canvas2d-MXaFeZnP.js} +4 -4
  6. package/dist/{canvas2d-DiPQvNtZ.js → canvas2d-iDK4BC5j.js} +4 -4
  7. package/dist/{debug-CVAlrcZt.js → debug-BlqDxTw3.js} +2 -2
  8. package/dist/{debug-DP4WzTNo.js → debug-DbigmdrK.js} +2 -2
  9. package/dist/esm-C-6g-SkZ.js +791 -0
  10. package/dist/{esm-L53qjcYH.js → esm-CJeszW-t.js} +344 -250
  11. package/dist/esm-CjkeZi__.js +238 -0
  12. package/dist/index.es.js +2896 -2896
  13. package/dist/index.js +303 -304
  14. package/dist/{order-R043xTpC.js → order-B4uR9Q04.js} +1 -1
  15. package/dist/{order-BkYCnwD7.js → order-BSPy5DI8.js} +1 -1
  16. package/dist/{rasterExport-C_FcNBkC.js → rasterExport-B62RmAK1.js} +3 -3
  17. package/dist/{rasterExport-Z7gs5346.js → rasterExport-DQH3hVg_.js} +3 -3
  18. package/dist/{rasterization-_-9JmSas.js → rasterization-B05bDo5e.js} +15 -18
  19. package/dist/rasterization-CFogVB3B.js +50 -0
  20. package/dist/{renderCanvas2D-IM-A9DYG.js → renderCanvas2D-Bdv-B4wj.js} +15 -15
  21. package/dist/{renderCanvas2D-DK1c9TFK.js → renderCanvas2D-ChdoHGrU.js} +15 -15
  22. package/dist/scalePosition-ByvlXaML.js +11 -0
  23. package/dist/schema.json +7 -0
  24. package/dist/{svg-PabUdcDi.js → svg-DHsq1RpV.js} +13 -13
  25. package/dist/{svg-DW3tfUmm.js → svg-N3tj05-e.js} +13 -13
  26. package/dist/{svgRasterizer-B6YtWLJs.js → svgRasterizer-CYVDlt5z.js} +2 -2
  27. package/dist/{svgRasterizer-BEVDyyS3.js → svgRasterizer-CvCBlxLj.js} +2 -2
  28. package/dist/{viewIdentityRegistry-BW415b3o.js → viewIdentityRegistry-BDKkEjXl.js} +1 -1
  29. package/dist/{viewIdentityRegistry-_F0E7nkA.js → viewIdentityRegistry-BIYd4TE0.js} +1 -1
  30. package/dist/{viewSelectors-KtD-QSN0.js → viewSelectors-DDLW-byr.js} +80 -50
  31. package/dist/{viewSelectors-DYz-PhTO.js → viewSelectors-j-F9XwsE.js} +80 -50
  32. package/dist/{viewUtils-BZGPseMx.js → viewUtils-JX6CMEYH.js} +1212 -1211
  33. package/dist/{webgl-BKSGqHaz.js → webgl-DdmOwEH0.js} +107 -86
  34. package/dist/{webgl-tdKf9SlZ.js → webgl-Dw8xqZpX.js} +107 -86
  35. package/package.json +7 -9
  36. package/LICENSE +0 -21
  37. package/dist/AbortablePromiseCache-BTmAcN-t.js +0 -96
  38. package/dist/esm-BiqrFjMh.js +0 -443
  39. package/dist/esm-DtNElqRr.js +0 -462
@@ -0,0 +1,207 @@
1
+ //#region ../../node_modules/@gmod/shared-read-cache/esm/throwIfAborted.js
2
+ function e(e) {
3
+ if (e?.aborted) throw t(e);
4
+ }
5
+ function t(e) {
6
+ let t = e.reason;
7
+ return t === void 0 ? new DOMException("This operation was aborted", "AbortError") : t;
8
+ }
9
+ //#endregion
10
+ //#region ../../node_modules/@gmod/shared-read-cache/esm/SharedReadCache.js
11
+ function n(e) {
12
+ typeof e == "object" && e && "unref" in e && typeof e.unref == "function" && e.unref();
13
+ }
14
+ var r = class {
15
+ entries = /* @__PURE__ */ new Map();
16
+ total = 0;
17
+ settledCount = 0;
18
+ limit;
19
+ budget;
20
+ membership;
21
+ fill;
22
+ sizeOf;
23
+ toCacheKey;
24
+ evictionPolicy;
25
+ pending = 0;
26
+ batch = 0;
27
+ idleTimeoutMs;
28
+ sweepTimer;
29
+ constructor({ fill: e, maxSize: t = Infinity, sizeOf: n = () => 1, cacheKey: r = (e) => String(e), evictionPolicy: i = "lru", idleTimeoutMs: a = 0, budget: o } = {}) {
30
+ this.fill = e, this.evictionPolicy = i, this.limit = t, this.budget = o, this.membership = o?.register(this), this.sizeOf = n, this.toCacheKey = r, this.idleTimeoutMs = a > 0 ? a : void 0;
31
+ }
32
+ get size() {
33
+ return this.entries.size;
34
+ }
35
+ get totalSize() {
36
+ return this.total;
37
+ }
38
+ get maxSize() {
39
+ return this.limit;
40
+ }
41
+ set maxSize(e) {
42
+ this.limit = e, this.evict();
43
+ }
44
+ waiterCount(e) {
45
+ return this.entries.get(this.toCacheKey(e))?.signals.size ?? 0;
46
+ }
47
+ async get(t, n, r) {
48
+ e(n);
49
+ let i = this.toCacheKey(t), a = this.entries.get(i);
50
+ a && (this.isDoomed(a) ? (this.deleteKey(i), a = void 0) : this.touch(i, a)), a ??= this.start(i, t, r), a.settled || this.join(a, n);
51
+ try {
52
+ let t = await this.settleFor(a, n);
53
+ return e(n), t;
54
+ } catch (t) {
55
+ throw e(n), t;
56
+ }
57
+ }
58
+ settleFor(e, n) {
59
+ if (e.settled || n === void 0 || typeof n.addEventListener != "function") return e.promise;
60
+ let r = new AbortController();
61
+ return Promise.race([e.promise, new Promise((e, i) => {
62
+ n.addEventListener("abort", () => {
63
+ i(t(n));
64
+ }, {
65
+ once: !0,
66
+ signal: r.signal
67
+ });
68
+ })]).finally(() => {
69
+ r.abort();
70
+ });
71
+ }
72
+ getIfCached(e) {
73
+ let t = this.toCacheKey(e), n = this.entries.get(t);
74
+ if (n) {
75
+ if (this.isDoomed(n)) {
76
+ this.deleteKey(t);
77
+ return;
78
+ }
79
+ return this.touch(t, n), n.promise;
80
+ }
81
+ }
82
+ has(e) {
83
+ let t = this.entries.get(this.toCacheKey(e));
84
+ return t !== void 0 && !this.isDoomed(t);
85
+ }
86
+ delete(e) {
87
+ this.deleteKey(this.toCacheKey(e));
88
+ }
89
+ clear() {
90
+ for (let e of this.entries.values()) this.detach(e);
91
+ this.entries.clear(), this.charge(-this.total), this.total = 0, this.settledCount = 0, this.stopSweep();
92
+ }
93
+ touch(e, t) {
94
+ this.entries.delete(e), this.entries.set(e, t), t.batch = this.batch, t.lastTouched = Date.now(), t.seq = this.stamp();
95
+ }
96
+ stamp() {
97
+ return this.budget ? this.budget.nextSeq() : 0;
98
+ }
99
+ isDoomed(e) {
100
+ return !e.settled && e.controller.signal.aborted;
101
+ }
102
+ sweepIdle() {
103
+ let e = this.idleTimeoutMs;
104
+ if (e === void 0) return;
105
+ let t = Date.now() - e, n = 0;
106
+ for (let [e, r] of this.entries) r.settled && (r.lastTouched <= t ? this.deleteKey(e) : n++);
107
+ n === 0 && this.stopSweep();
108
+ }
109
+ startSweep() {
110
+ let e = this.idleTimeoutMs;
111
+ if (e === void 0 || this.sweepTimer !== void 0) return;
112
+ let t = Math.max(1e3, Math.floor(e / 4));
113
+ this.sweepTimer = setInterval(() => {
114
+ this.sweepIdle();
115
+ }, t), n(this.sweepTimer);
116
+ }
117
+ stopSweep() {
118
+ this.sweepTimer !== void 0 && (clearInterval(this.sweepTimer), this.sweepTimer = void 0);
119
+ }
120
+ start(e, t, n) {
121
+ let r = n ?? (this.fill && ((e) => this.fill(t, e)));
122
+ if (!r) throw Error("SharedReadCache needs a fill, either on the cache or on the get() call");
123
+ let i = new AbortController(), a = {
124
+ promise: r(i.signal),
125
+ signals: /* @__PURE__ */ new Set(),
126
+ pinned: !1,
127
+ controller: i,
128
+ dispose: new AbortController(),
129
+ settled: !1,
130
+ counted: !0,
131
+ size: 0,
132
+ batch: this.batch,
133
+ lastTouched: Date.now(),
134
+ seq: this.stamp()
135
+ };
136
+ this.entries.set(e, a), this.pending++;
137
+ let o = () => {
138
+ a.settled = !0, this.detach(a), a.dispose.abort(), a.signals.clear();
139
+ };
140
+ return a.promise.then((t) => {
141
+ if (o(), this.entries.get(e) === a) {
142
+ let n = this.weigh(t);
143
+ n === void 0 ? this.entries.delete(e) : (a.lastTouched = Date.now(), this.settledCount++, a.size = n, this.total += n, this.charge(n), this.startSweep());
144
+ }
145
+ this.maybeEvict();
146
+ }, () => {
147
+ this.entries.get(e) === a && this.deleteKey(e), o(), this.maybeEvict();
148
+ }), a;
149
+ }
150
+ weigh(e) {
151
+ try {
152
+ let t = this.sizeOf(e);
153
+ return Number.isFinite(t) && t >= 0 ? t : void 0;
154
+ } catch {
155
+ return;
156
+ }
157
+ }
158
+ join(e, t) {
159
+ t === void 0 ? e.pinned = !0 : t.aborted ? !e.pinned && e.signals.size === 0 && e.controller.abort(t.reason) : typeof t.addEventListener == "function" ? e.signals.has(t) || (e.signals.add(t), t.addEventListener("abort", () => {
160
+ e.signals.delete(t), !e.pinned && e.signals.size === 0 && (e.controller.abort(t.reason), this.detach(e));
161
+ }, {
162
+ once: !0,
163
+ signal: e.dispose.signal
164
+ })) : e.pinned = !0;
165
+ }
166
+ deleteKey(e) {
167
+ let t = this.entries.get(e);
168
+ t && (this.entries.delete(e), this.detach(t), t.settled && this.settledCount--, this.total -= t.size, this.charge(-t.size));
169
+ }
170
+ detach(e) {
171
+ e.counted && (e.counted = !1, this.pending--);
172
+ }
173
+ charge(e) {
174
+ this.budget && this.membership && this.budget.charge(this.membership, e);
175
+ }
176
+ lruSpare() {
177
+ if (!(this.settledCount <= 1)) {
178
+ for (let [e, t] of this.entries) if (t.settled) return {
179
+ cacheKey: e,
180
+ seq: t.seq
181
+ };
182
+ }
183
+ }
184
+ release(e) {
185
+ this.deleteKey(e);
186
+ }
187
+ maybeEvict() {
188
+ (this.evictionPolicy === "lru" || this.pending === 0) && (this.evict(), this.evictionPolicy === "batch" && this.batch++, this.budget?.evict());
189
+ }
190
+ evict() {
191
+ if (this.limit !== Infinity) {
192
+ if (this.evictionPolicy === "batch") {
193
+ for (let [e, t] of this.entries) {
194
+ if (this.total <= this.limit) break;
195
+ t.batch !== this.batch && t.settled && this.deleteKey(e);
196
+ }
197
+ return;
198
+ }
199
+ if (!(this.total <= this.limit)) for (let [e, t] of this.entries) {
200
+ if (this.total <= this.limit || this.settledCount <= 1) break;
201
+ t.settled && this.deleteKey(e);
202
+ }
203
+ }
204
+ }
205
+ };
206
+ //#endregion
207
+ export { r as t };