@genome-spy/app 0.69.1 → 0.71.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.
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "contributors": [],
9
9
  "license": "MIT",
10
10
  "homepage": "https://genomespy.app/",
11
- "version": "0.69.1",
11
+ "version": "0.71.0",
12
12
  "main": "dist/index.js",
13
13
  "type": "module",
14
14
  "exports": {
@@ -27,7 +27,9 @@
27
27
  "dev": "node dev-server.mjs",
28
28
  "build": "rm -rf dist && mkdir -p dist && vite build && npm run build:schema",
29
29
  "build:schema": "mkdir -p dist && ts-json-schema-generator --path 'src/spec/*.d.ts' --type AppRootSpec > dist/schema.json",
30
- "test:tsc": "tsc -p tsconfig.json --noEmit",
30
+ "test:tsc": "npm run test:tsc:src && npm run test:tsc:tests",
31
+ "test:tsc:src": "tsc -p tsconfig.json --noEmit",
32
+ "test:tsc:tests": "tsc -p tsconfig.tests.json --noEmit",
31
33
  "storybook": "storybook dev -p 6006",
32
34
  "build-storybook": "storybook build",
33
35
  "prepublishOnly": "npm run build"
@@ -37,7 +39,7 @@
37
39
  "@fortawesome/fontawesome-free": "^6.4.2",
38
40
  "@fortawesome/fontawesome-svg-core": "^6.4.2",
39
41
  "@fortawesome/free-solid-svg-icons": "^6.4.2",
40
- "@genome-spy/core": "^0.69.1",
42
+ "@genome-spy/core": "^0.71.0",
41
43
  "@reduxjs/toolkit": "^2.11.0",
42
44
  "d3-color": "^3.1.0",
43
45
  "idb": "^7.1.1",
@@ -45,7 +47,8 @@
45
47
  "lz-string": "^1.4.4",
46
48
  "mapsort": "^1.0.5",
47
49
  "micromark": "^4.0.0",
48
- "redux-undo": "^1.0.1"
50
+ "redux-undo": "^1.0.1",
51
+ "zarrita": "^0.6.1"
49
52
  },
50
- "gitHead": "bbbc1860a0730070d0a7c1ca7a9923d4a5d25366"
53
+ "gitHead": "ee14df5ba7218882d48a1674916304ac6f0a4549"
51
54
  }
@@ -1,332 +0,0 @@
1
- var v = Object.defineProperty;
2
- var F = (n, e, t) => e in n ? v(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var f = (n, e, t) => F(n, typeof e != "symbol" ? e + "" : e, t);
4
- const y = /%([0-9A-Fa-f]{2})/g, R = /^\s*##\s*(\S+)\s*(.*)/, g = /\r?\n$/, b = /\s+/, C = /\D/g;
5
- function p(n) {
6
- return n.includes("%") ? n.replaceAll(y, (e, t) => String.fromCharCode(parseInt(t, 16))) : n;
7
- }
8
- function k(n) {
9
- if (!n.length || n === ".")
10
- return {};
11
- const e = {};
12
- let t = n;
13
- t.endsWith(`
14
- `) && (t = t.slice(0, t.endsWith(`\r
15
- `) ? -2 : -1));
16
- for (const r of t.split(";")) {
17
- const s = r.indexOf("=");
18
- if (s === -1)
19
- continue;
20
- const c = r.slice(s + 1);
21
- if (!c.length)
22
- continue;
23
- const i = r.slice(0, s).trim();
24
- let o = e[i];
25
- o || (o = [], e[i] = o);
26
- for (const l of c.split(","))
27
- o.push(p(l.trim()));
28
- }
29
- return e;
30
- }
31
- function I(n) {
32
- if (!n.length || n === ".")
33
- return {};
34
- const e = {};
35
- let t = n;
36
- t.endsWith(`
37
- `) && (t = t.slice(0, t.endsWith(`\r
38
- `) ? -2 : -1));
39
- for (const r of t.split(";")) {
40
- const s = r.indexOf("=");
41
- if (s === -1)
42
- continue;
43
- const c = r.slice(s + 1);
44
- if (!c.length)
45
- continue;
46
- const i = r.slice(0, s).trim();
47
- let o = e[i];
48
- o || (o = [], e[i] = o);
49
- for (const l of c.split(","))
50
- o.push(l.trim());
51
- }
52
- return e;
53
- }
54
- function L(n) {
55
- return _(n.split(" "));
56
- }
57
- function a(n) {
58
- return n === "." || n === "" || n === void 0 ? null : n;
59
- }
60
- function _(n) {
61
- const e = a(n[0]), t = a(n[1]), r = a(n[2]), s = a(n[3]), c = a(n[4]), i = a(n[5]), o = a(n[6]), l = a(n[7]), u = a(n[8]);
62
- return {
63
- seq_id: e ? p(e) : null,
64
- source: t ? p(t) : null,
65
- type: r ? p(r) : null,
66
- start: s === null ? null : parseInt(s, 10),
67
- end: c === null ? null : parseInt(c, 10),
68
- score: i === null ? null : parseFloat(i),
69
- strand: o,
70
- phase: l,
71
- attributes: u === null ? null : k(u)
72
- };
73
- }
74
- function D(n) {
75
- const e = a(n[0]), t = a(n[1]), r = a(n[2]), s = a(n[3]), c = a(n[4]), i = a(n[5]), o = a(n[6]), l = a(n[7]), u = a(n[8]);
76
- return {
77
- seq_id: e,
78
- source: t,
79
- type: r,
80
- start: s === null ? null : parseInt(s, 10),
81
- end: c === null ? null : parseInt(c, 10),
82
- score: i === null ? null : parseFloat(i),
83
- strand: o,
84
- phase: l,
85
- attributes: u === null ? null : I(u)
86
- };
87
- }
88
- function A(n) {
89
- var c, i;
90
- const e = R.exec(n);
91
- if (!e)
92
- return null;
93
- const [, t] = e;
94
- let [, , r] = e;
95
- const s = { directive: t };
96
- if (r.length && (r = r.replace(g, ""), s.value = r), t === "sequence-region") {
97
- const o = r.split(b, 3);
98
- return {
99
- ...s,
100
- seq_id: o[0],
101
- start: (c = o[1]) == null ? void 0 : c.replaceAll(C, ""),
102
- end: (i = o[2]) == null ? void 0 : i.replaceAll(C, "")
103
- };
104
- } else if (t === "genome-build") {
105
- const [o, l] = r.split(b, 2);
106
- return {
107
- ...s,
108
- source: o,
109
- buildName: l
110
- };
111
- }
112
- return s;
113
- }
114
- const x = /^\s*[^#\s>]/, w = /^\s*(#+)(.*)/, S = /^\s*$/, E = /^\s*>/, P = /\r?\n?$/g;
115
- class m {
116
- constructor(e) {
117
- f(this, "featureCallback");
118
- f(this, "endCallback");
119
- f(this, "commentCallback");
120
- f(this, "errorCallback");
121
- f(this, "disableDerivesFromReferences");
122
- f(this, "directiveCallback");
123
- f(this, "bufferSize");
124
- f(this, "eof", !1);
125
- f(this, "lineNumber", 0);
126
- // features that we have to keep on hand for now because they
127
- // might be referenced by something else
128
- f(this, "_underConstructionTopLevel", []);
129
- // index of the above by ID
130
- f(this, "_underConstructionById", {});
131
- f(this, "_completedReferences", {});
132
- // features that reference something we have not seen yet
133
- // structured as:
134
- // { 'some_id' : {
135
- // 'Parent' : [ orphans that have a Parent attr referencing it ],
136
- // 'Derives_from' : [ orphans that have a Derives_from attr referencing it ],
137
- // }
138
- // }
139
- f(this, "_underConstructionOrphans", {});
140
- const t = () => {
141
- };
142
- this.featureCallback = e.featureCallback || t, this.endCallback = e.endCallback || t, this.commentCallback = e.commentCallback || t, this.errorCallback = e.errorCallback || t, this.directiveCallback = e.directiveCallback || t, this.disableDerivesFromReferences = e.disableDerivesFromReferences || !1, this.bufferSize = e.bufferSize === void 0 ? 1 / 0 : e.bufferSize;
143
- }
144
- addLine(e) {
145
- if (this.eof)
146
- return;
147
- if (this.lineNumber += 1, x.test(e)) {
148
- this._bufferLine(e);
149
- return;
150
- }
151
- const t = w.exec(e);
152
- if (t) {
153
- const [, r] = t;
154
- let [, , s] = t;
155
- if (r.length === 3)
156
- this._emitAllUnderConstructionFeatures();
157
- else if (r.length === 2) {
158
- const c = A(e);
159
- c && (c.directive === "FASTA" ? (this._emitAllUnderConstructionFeatures(), this.eof = !0) : this._emitItem(c));
160
- } else
161
- this._emitItem({ comment: s.trimStart() });
162
- } else if (!S.test(e)) if (E.test(e))
163
- this._emitAllUnderConstructionFeatures(), this.eof = !0;
164
- else {
165
- const r = e.replaceAll(P, "");
166
- throw new Error(`GFF3 parse error. Cannot parse '${r}'.`);
167
- }
168
- }
169
- addParsedFeatureLine(e) {
170
- this.eof || (this.lineNumber += 1, this._bufferParsedLine(e));
171
- }
172
- finish() {
173
- this._emitAllUnderConstructionFeatures(), this.endCallback();
174
- }
175
- _emitItem(e) {
176
- Array.isArray(e) ? this.featureCallback(e) : "directive" in e ? this.directiveCallback(e) : "comment" in e && this.commentCallback(e);
177
- }
178
- _enforceBufferSizeLimit(e = 0) {
179
- const t = (r) => {
180
- var s, c;
181
- r && Array.isArray(r) && ((c = (s = r[0].attributes) == null ? void 0 : s.ID) != null && c[0]) && (r[0].attributes.ID.forEach((o) => {
182
- delete this._underConstructionById[o], delete this._completedReferences[o];
183
- }), r.forEach((o) => {
184
- o.child_features && o.child_features.forEach((l) => {
185
- t(l);
186
- }), o.derived_features && o.derived_features.forEach((l) => {
187
- t(l);
188
- });
189
- }));
190
- };
191
- for (; this._underConstructionTopLevel.length + e > this.bufferSize; ) {
192
- const r = this._underConstructionTopLevel.shift();
193
- r && (this._emitItem(r), t(r));
194
- }
195
- }
196
- /**
197
- * return all under-construction features, called when we know
198
- * there will be no additional data to attach to them
199
- */
200
- _emitAllUnderConstructionFeatures() {
201
- this._underConstructionTopLevel.forEach(this._emitItem.bind(this)), this._underConstructionTopLevel = [], this._underConstructionById = {}, this._completedReferences = {};
202
- const e = Object.keys(this._underConstructionOrphans);
203
- if (e.length)
204
- throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${e.join(",")}`);
205
- }
206
- _bufferLine(e) {
207
- this._bufferParsedLine(L(e));
208
- }
209
- _bufferParsedLine(e) {
210
- var o, l, u;
211
- const t = e;
212
- t.child_features = [], t.derived_features = [];
213
- const r = ((o = t.attributes) == null ? void 0 : o.ID) || [], s = ((l = t.attributes) == null ? void 0 : l.Parent) || [], c = this.disableDerivesFromReferences ? [] : ((u = t.attributes) == null ? void 0 : u.Derives_from) || [];
214
- if (!r.length && !s.length && !c.length) {
215
- this._emitItem([t]);
216
- return;
217
- }
218
- let i;
219
- r.forEach((d) => {
220
- const h = this._underConstructionById[d];
221
- h ? (h[h.length - 1].type !== t.type && this._parseError(`multi-line feature "${d}" has inconsistent types: "${t.type}", "${h[h.length - 1].type}"`), h.push(t), i = h) : (i = [t], this._enforceBufferSizeLimit(1), !s.length && !c.length && this._underConstructionTopLevel.push(i), this._underConstructionById[d] = i, this._resolveReferencesTo(i, d));
222
- }), this._resolveReferencesFrom(
223
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
224
- i || [t],
225
- { Parent: s, Derives_from: c },
226
- r
227
- );
228
- }
229
- _resolveReferencesTo(e, t) {
230
- const r = this._underConstructionOrphans[t];
231
- if (r) {
232
- for (const s of e)
233
- s.child_features.push(...r.Parent), s.derived_features.push(...r.Derives_from);
234
- delete this._underConstructionOrphans[t];
235
- }
236
- }
237
- _parseError(e) {
238
- this.eof = !0, this.errorCallback(`${this.lineNumber}: ${e}`);
239
- }
240
- _resolveReferencesFrom(e, t, r) {
241
- for (const s of t.Parent) {
242
- const c = this._underConstructionById[s];
243
- if (c) {
244
- let i = !1;
245
- for (const o of r) {
246
- const l = `Parent,${s}`, u = this._completedReferences[o] || (this._completedReferences[o] = {});
247
- u[l] && (i = !0), u[l] = !0;
248
- }
249
- if (!i)
250
- for (const o of c)
251
- o.child_features.push(e);
252
- } else {
253
- let i = this._underConstructionOrphans[s];
254
- i || (i = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[s] = i), i.Parent.push(e);
255
- }
256
- }
257
- for (const s of t.Derives_from) {
258
- const c = this._underConstructionById[s];
259
- if (c) {
260
- let i = !1;
261
- for (const o of r) {
262
- const l = `Derives_from,${s}`, u = this._completedReferences[o] || (this._completedReferences[o] = {});
263
- u[l] && (i = !0), u[l] = !0;
264
- }
265
- if (!i)
266
- for (const o of c)
267
- o.derived_features.push(e);
268
- } else {
269
- let i = this._underConstructionOrphans[s];
270
- i || (i = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[s] = i), i.Derives_from.push(e);
271
- }
272
- }
273
- }
274
- }
275
- function $(n) {
276
- const e = [], t = new m({
277
- featureCallback: (r) => e.push(r),
278
- disableDerivesFromReferences: !0,
279
- errorCallback: (r) => {
280
- throw new Error(r);
281
- }
282
- });
283
- for (const r of n.split(/\r?\n/))
284
- t.addLine(r);
285
- return t.finish(), e;
286
- }
287
- function B(n) {
288
- const e = [], t = new m({
289
- featureCallback: (r) => e.push(r),
290
- disableDerivesFromReferences: !0,
291
- errorCallback: (r) => {
292
- throw new Error(r);
293
- }
294
- });
295
- for (const r of n)
296
- t.addLine(r);
297
- return t.finish(), e;
298
- }
299
- function T(n) {
300
- const e = [], t = new m({
301
- featureCallback: (r) => e.push(r),
302
- disableDerivesFromReferences: !0,
303
- errorCallback: (r) => {
304
- throw new Error(r);
305
- }
306
- });
307
- for (const r of n) {
308
- const s = _(r.fields);
309
- r.lineHash !== void 0 && (s.attributes || (s.attributes = {}), s.attributes._lineHash = [String(r.lineHash)]), t.addParsedFeatureLine(s);
310
- }
311
- return t.finish(), e;
312
- }
313
- function q(n, e) {
314
- const t = [], r = new m({
315
- featureCallback: (c) => t.push(c),
316
- disableDerivesFromReferences: !0,
317
- errorCallback: (c) => {
318
- throw new Error(c);
319
- }
320
- }), s = e ? _ : D;
321
- for (const c of n) {
322
- const i = s(c.fields);
323
- c.lineHash !== void 0 && (i.attributes || (i.attributes = {}), i.attributes._lineHash = [String(c.lineHash)]), r.addParsedFeatureLine(i);
324
- }
325
- return r.finish(), t;
326
- }
327
- export {
328
- B as parseArraySync,
329
- T as parseRecordsSync,
330
- q as parseRecordsSyncFast,
331
- $ as parseStringSync
332
- };