@abi-software/mapintegratedvuer 1.3.5-beta.0 → 1.4.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,584 @@
1
+ import { u as y, b as w, E as l, T as A, c as v, d as u, e as N } from "./index-O_8s0SlM.js";
2
+ import { mapStores as R } from "pinia";
3
+ let c = 7, r = 5;
4
+ const E = [
5
+ {
6
+ id: "UBERON:0000948",
7
+ name: "heart",
8
+ showAtZoom: 1
9
+ },
10
+ {
11
+ id: "UBERON:0001759",
12
+ name: "vagus nerve",
13
+ showAtZoom: 1
14
+ },
15
+ {
16
+ id: "UBERON:0001155",
17
+ name: "colon",
18
+ showAtZoom: 1
19
+ },
20
+ {
21
+ id: "UBERON:0000945",
22
+ name: "stomach",
23
+ showAtZoom: 1
24
+ },
25
+ {
26
+ id: "UBERON:0001013",
27
+ name: "adipose tissue",
28
+ showAtZoom: 1
29
+ },
30
+ {
31
+ id: "UBERON:0001255",
32
+ name: "urinary bladder",
33
+ showAtZoom: 1
34
+ },
35
+ {
36
+ id: "UBERON:0001348",
37
+ name: "brown adipose tissue",
38
+ showAtZoom: 6
39
+ },
40
+ {
41
+ id: "UBERON:0002008",
42
+ name: "cardiac nerve plexus",
43
+ showAtZoom: 1
44
+ },
45
+ {
46
+ id: "UBERON:0002240",
47
+ name: "spinal cord",
48
+ showAtZoom: 1
49
+ },
50
+ {
51
+ id: "UBERON:0002005",
52
+ name: "Enteric Nervous System",
53
+ showAtZoom: 4
54
+ },
55
+ {
56
+ id: "UBERON:0013702",
57
+ name: "body proper",
58
+ showAtZoom: 1
59
+ },
60
+ {
61
+ id: "UBERON:0002298",
62
+ name: "brainstem",
63
+ showAtZoom: 1
64
+ },
65
+ {
66
+ id: "UBERON:0002439",
67
+ name: "myenteric nerve plexus",
68
+ showAtZoom: 6
69
+ },
70
+ {
71
+ id: "UBERON:0000010",
72
+ name: "peripheral nervous system",
73
+ showAtZoom: 6
74
+ },
75
+ {
76
+ id: "UBERON:0002048",
77
+ name: "lung",
78
+ showAtZoom: 1
79
+ },
80
+ {
81
+ id: "UBERON:0002410",
82
+ name: "autonomic nervous system",
83
+ showAtZoom: 6
84
+ },
85
+ {
86
+ id: "UBERON:0002441",
87
+ name: "cervicothoracic ganglion",
88
+ showAtZoom: 6
89
+ },
90
+ {
91
+ id: "UBERON:0005363",
92
+ name: "inferior vagus X ganglion",
93
+ showAtZoom: 6
94
+ },
95
+ {
96
+ id: "UBERON:0001264",
97
+ name: "pancreas",
98
+ showAtZoom: 1
99
+ },
100
+ {
101
+ id: "UBERON:0001884",
102
+ name: "phrenic nerve",
103
+ showAtZoom: 6
104
+ },
105
+ {
106
+ id: "UBERON:0002059",
107
+ name: "submandibular ganglion",
108
+ showAtZoom: 7
109
+ },
110
+ {
111
+ id: "UBERON:0001347",
112
+ name: "white adipose tissue",
113
+ showAtZoom: 6
114
+ },
115
+ {
116
+ id: "UBERON:0001556",
117
+ name: "lower urinary tract",
118
+ showAtZoom: 1
119
+ },
120
+ {
121
+ id: "UBERON:0002262",
122
+ name: "celiac ganglion",
123
+ showAtZoom: 5
124
+ },
125
+ {
126
+ id: "UBERON:0000955",
127
+ name: "Brain",
128
+ showAtZoom: 1
129
+ },
130
+ {
131
+ id: "UBERON:0000160",
132
+ name: "intestine",
133
+ showAtZoom: 1
134
+ },
135
+ {
136
+ id: "UBERON:0001322",
137
+ name: "sciatic nerve",
138
+ showAtZoom: 1
139
+ },
140
+ {
141
+ id: "UBERON:0001649",
142
+ name: "glossopharyngeal nerve",
143
+ showAtZoom: 6
144
+ },
145
+ {
146
+ id: "UBERON:0002063",
147
+ name: "sinus venosus",
148
+ showAtZoom: 6
149
+ },
150
+ {
151
+ id: "UBERON:0002107",
152
+ name: "liver",
153
+ showAtZoom: 1
154
+ },
155
+ {
156
+ id: "UBERON:0002113",
157
+ name: "kidney",
158
+ showAtZoom: 1
159
+ },
160
+ {
161
+ id: "UBERON:0002481",
162
+ name: "bone tissue",
163
+ showAtZoom: 1
164
+ },
165
+ {
166
+ id: "UBERON:0004907",
167
+ name: "lower digestive tract",
168
+ showAtZoom: 4
169
+ },
170
+ {
171
+ id: "UBERON:0000044",
172
+ name: "Dorsal root ganglion",
173
+ showAtZoom: 5
174
+ },
175
+ // New levels from Keeran
176
+ {
177
+ id: "UBERON:0001736",
178
+ name: "Submandibular gland",
179
+ showAtZoom: c,
180
+ keyword: !0
181
+ },
182
+ {
183
+ id: "UBERON:0001103",
184
+ name: "Diaphragm",
185
+ showAtZoom: r,
186
+ keyword: !0
187
+ },
188
+ {
189
+ id: "UBERON:0001160",
190
+ name: "Fundus of stomach",
191
+ showAtZoom: r,
192
+ keyword: !0
193
+ },
194
+ {
195
+ id: "UBERON:0000955",
196
+ name: "Brain",
197
+ showAtZoom: r,
198
+ keyword: !0
199
+ },
200
+ {
201
+ id: "UBERON:0003708",
202
+ name: "Carotid sinus",
203
+ showAtZoom: c,
204
+ keyword: !0
205
+ },
206
+ {
207
+ id: "UBERON:0002079",
208
+ name: "Left cardiac atrium",
209
+ showAtZoom: r,
210
+ keyword: !0
211
+ },
212
+ {
213
+ id: "ILX:0485722",
214
+ name: "Nodose ganglion",
215
+ showAtZoom: c,
216
+ keyword: !0
217
+ },
218
+ {
219
+ id: "UBERON:0002078",
220
+ name: "Right cardiac atrium",
221
+ showAtZoom: r,
222
+ keyword: !0
223
+ },
224
+ {
225
+ id: "UBERON:0002084",
226
+ name: "Heart left ventricle",
227
+ showAtZoom: r,
228
+ keyword: !0
229
+ },
230
+ {
231
+ id: "UBERON:0002080",
232
+ name: "Heart right ventricle",
233
+ showAtZoom: r,
234
+ keyword: !0
235
+ },
236
+ {
237
+ id: "UBERON:0001508",
238
+ name: "Arch of Aorta",
239
+ showAtZoom: r,
240
+ keyword: !0
241
+ },
242
+ {
243
+ id: "UBERON:0001738",
244
+ name: "Thyroid cartilage",
245
+ showAtZoom: r,
246
+ keyword: !0
247
+ },
248
+ {
249
+ id: "UBERON:0000388",
250
+ name: "Epiglottis",
251
+ showAtZoom: r,
252
+ keyword: !0
253
+ }
254
+ ];
255
+ function B(e) {
256
+ return e[0].toUpperCase() + e.substring(1);
257
+ }
258
+ const U = {
259
+ emits: ["flatmap-provenance-ready", "resource-selected", "species-changed"],
260
+ props: {
261
+ /**
262
+ * Object containing information for
263
+ * the required viewing.
264
+ */
265
+ entry: Object,
266
+ visible: {
267
+ type: Boolean,
268
+ default: !0
269
+ },
270
+ mouseHovered: {
271
+ type: Boolean,
272
+ default: !1
273
+ }
274
+ },
275
+ computed: {
276
+ ...R(y, w),
277
+ idNamePair() {
278
+ return this.splitFlowStore.idNamePair;
279
+ },
280
+ syncMode() {
281
+ return this.splitFlowStore.syncMode;
282
+ },
283
+ useHelpModeDialog() {
284
+ return this.settingsStore.useHelpModeDialog;
285
+ },
286
+ connectivityInfoSidebar() {
287
+ return this.settingsStore.connectivityInfoSidebar;
288
+ }
289
+ },
290
+ mounted: function() {
291
+ l.on("startHelp", () => {
292
+ this.startHelp();
293
+ }), this.multiflatmapRef = this.$refs.multiflatmap, this.flatmapRef = this.$refs.flatmap, this.scaffoldRef = this.$refs.scaffold;
294
+ },
295
+ methods: {
296
+ toggleSyncMode: function() {
297
+ },
298
+ getState: function() {
299
+ },
300
+ openMap: function(e) {
301
+ e === "SYNC" ? (this.toggleSyncMode(), this.trackOpenMap("toggle_map_sync_mode")) : (l.emit("OpenNewMap", e), this.trackOpenMap(`open_new_${e}_map`)), this.onConnectivityInfoClose();
302
+ },
303
+ trackOpenMap: function(e) {
304
+ A.sendEvent({
305
+ event: "interaction_event",
306
+ event_name: "portal_maps_open_map",
307
+ category: e,
308
+ location: "open_new_map"
309
+ });
310
+ },
311
+ updateWithViewUrl: function() {
312
+ },
313
+ /**
314
+ * Perform a local search on this contentvuer
315
+ */
316
+ search: function() {
317
+ return !1;
318
+ },
319
+ /**
320
+ * Get a list of search suggestions on this contentvuer
321
+ */
322
+ searchSuggestions: function() {
323
+ },
324
+ /**
325
+ * Callback when the vuers emit a selected event.
326
+ */
327
+ resourceSelected: function(e, t, i) {
328
+ var f, d, m;
329
+ if (this.resourceHasAction(t)) {
330
+ l.emit("PopoverActionClick", t);
331
+ return;
332
+ }
333
+ let n, s = "none", o = !1;
334
+ const a = {
335
+ paneIndex: this.entry.id,
336
+ type: e,
337
+ resource: t,
338
+ internalName: void 0,
339
+ eventType: void 0
340
+ };
341
+ if (e == "MultiFlatmap" || e == "Flatmap")
342
+ if (a.internalName = this.idNamePair[t.feature.models], t.eventType == "click")
343
+ if (a.eventType = "selected", t.feature.type == "marker") {
344
+ let p = this.idNamePair[t.feature.models], g = E.filter(
345
+ (h) => h.id === t.feature.models
346
+ );
347
+ this.settingsStore.isFeaturedMarkerIdentifier(
348
+ t.feature.id
349
+ ) ? n = {
350
+ type: "Search",
351
+ term: this.settingsStore.featuredMarkerDoi(
352
+ t.feature.id
353
+ ),
354
+ featuredDataset: !0
355
+ } : g.filter((h) => h.keyword).length > 0 ? n = {
356
+ type: "Search",
357
+ term: "http://purl.obolibrary.org/obo/" + t.feature.models.replace(":", "_")
358
+ } : n = {
359
+ type: "Facet",
360
+ facet: p,
361
+ facetPropPath: "anatomy.organ.category.name",
362
+ term: "Anatomical structure"
363
+ }, o = !0, e == "MultiFlatmap" && this.$refs.multiflatmap.getCurrentFlatmap().mapImp.clearSearchResults();
364
+ } else
365
+ t.feature.type == "feature" && (this.syncMode ? o = !0 : s = "scaffold");
366
+ else
367
+ t.eventType == "mouseenter" && (a.eventType = "highlighted", o = !0);
368
+ else
369
+ e == "Scaffold" && (t && t[0] && ((((f = t[0].data) == null ? void 0 : f.id) === void 0 || ((d = t[0].data) == null ? void 0 : d.id) === "") && (t[0].data.id = (m = t[0].data) == null ? void 0 : m.group), a.internalName = t[0].data.id, t[0].data.lastActionOnMarker === !0 && (n = {
370
+ type: "Facet",
371
+ facet: B(t[0].data.id),
372
+ facetPropPath: "anatomy.organ.category.name",
373
+ term: "Anatomical structure"
374
+ })), a.eventType = "selected", o = !0, s = "search");
375
+ n === void 0 && i && (n = v(a, s)), n && l.emit("PopoverActionClick", n), o && this.$emit("resource-selected", a);
376
+ },
377
+ resourceHasAction: function(e) {
378
+ return e.type === "URL" || e.type === "Search" || e.type === "Neuron Search" || e.type == "Facet" || e.type == "Facets";
379
+ },
380
+ /**
381
+ * Check if this viewer is currently visible
382
+ */
383
+ isVisible: function() {
384
+ return this.splitFlowStore.getPaneNameById(this.entry.id) !== void 0;
385
+ },
386
+ displayTooltip: function() {
387
+ },
388
+ /**
389
+ * Get the term to zoom/highlight in a synchronisation event,
390
+ * if it cannot be found in the map, it will perform several
391
+ * calls to try to ge a valid name/id.
392
+ */
393
+ getNameAndIdFromSyncData: async function(e) {
394
+ let t = e.internalName;
395
+ t === void 0 && e.resource && (t = e.resource.label);
396
+ let i;
397
+ if (e.resource && e.resource.resource && (i = e.resource.resource[0]), this.entry.type === "Scaffold") {
398
+ if (this.$refs.scaffold.findObjectsWithGroupName(t).length === 0) {
399
+ if (e.resource && e.resource.feature) {
400
+ const o = u(e.resource.feature.models);
401
+ if (o.length > 0)
402
+ return o;
403
+ }
404
+ let s = N(t);
405
+ if (s)
406
+ return s;
407
+ if (i && e.eventType === "selected")
408
+ return fetch(`${this.apiLocation}get-related-terms/${i}`).then((o) => o.json()).then((o) => {
409
+ if (o.uberon.array.length > 0)
410
+ return t = o.uberon.array[0].name.charAt(0).toUpperCase() + o.uberon.array[0].name.slice(1), i = o.uberon.array[0].id.toUpperCase(), { id: i, name: t };
411
+ });
412
+ }
413
+ } else if (this.entry.type === "MultiFlatmap")
414
+ if (t === "Bladder")
415
+ t = "Urinary Bladder";
416
+ else {
417
+ const n = u(t);
418
+ n.length > 0 && (t = n[0]);
419
+ }
420
+ return { id: i, name: t };
421
+ },
422
+ // Get the species and andaotmy info for the featured datasets
423
+ getDatasetAnatomyInfo: function(e) {
424
+ fetch(`${this.apiLocation}dataset_info/anatomy?identifier=${e}`).then((t) => t.json()).then((t) => {
425
+ const i = t.result[0];
426
+ let n;
427
+ try {
428
+ n = i.anatomy.organ[0].curie;
429
+ } catch {
430
+ n = void 0;
431
+ }
432
+ let s;
433
+ try {
434
+ s = i.item.curie;
435
+ } catch {
436
+ s = void 0;
437
+ }
438
+ let o;
439
+ try {
440
+ let a = 0, f = !1;
441
+ for (; !f && a < i.organisms.subject.length; ) {
442
+ const d = i.organisms.subject[a];
443
+ d.species && (o = d.species.name, f = !0), a += 1;
444
+ }
445
+ } catch {
446
+ o = void 0;
447
+ }
448
+ this.settingsStore.updateFeaturedMarker({
449
+ identifier: e,
450
+ marker: n,
451
+ doi: s,
452
+ species: o
453
+ });
454
+ });
455
+ },
456
+ // Check if the old featured dataset api has any info
457
+ oldFeaturedDatasetApiHasInfo: async function() {
458
+ let t = await (await fetch(`${this.apiLocation}get_featured_datasets_identifiers`)).json();
459
+ return !t.identifiers || t.identifiers.length == 0 ? !1 : t.identifiers;
460
+ },
461
+ // Check if the new featured dataset api has any info
462
+ newFeaturedDatasetApiHasInfo: async function() {
463
+ let t = await (await fetch(`${this.apiLocation}get_featured_dataset`)).json();
464
+ return !t.datasets || t.datasets.length == 0 ? !1 : t.datasets.map((i) => i.id);
465
+ },
466
+ /**
467
+ * Get a list of featured datasets to display.
468
+ */
469
+ getFeaturedDatasets: async function() {
470
+ let e = [], t = await this.oldFeaturedDatasetApiHasInfo();
471
+ if (t)
472
+ e = t;
473
+ else {
474
+ let i = await this.newFeaturedDatasetApiHasInfo();
475
+ i && (e = i);
476
+ }
477
+ this.settingsStore.updateFeatured(e), e.forEach((i) => {
478
+ this.getDatasetAnatomyInfo(i);
479
+ });
480
+ },
481
+ zoomToFeatures: function() {
482
+ },
483
+ handleSyncMouseEvent: async function(e) {
484
+ let t = await this.getNameAndIdFromSyncData(e);
485
+ e.eventType === "highlighted" ? this.highlightFeatures(t) : e.eventType === "selected" && this.displayTooltip(t);
486
+ },
487
+ /**
488
+ * Handle sync pan zoom event
489
+ */
490
+ handleSyncPanZoomEvent: function() {
491
+ },
492
+ highlightFeatures: function() {
493
+ },
494
+ receiveSynchronisedEvent: async function(e) {
495
+ if (e.paneIndex !== this.entry.id)
496
+ e.eventType == "panZoom" || this.handleSyncMouseEvent(e);
497
+ else if (e.eventType == "selected") {
498
+ let t = await this.getNameAndIdFromSyncData(e);
499
+ this.zoomToFeatures(t, !1);
500
+ }
501
+ },
502
+ requestSynchronisedEvent: function() {
503
+ },
504
+ flatmapMarkerUpdate() {
505
+ },
506
+ onResize: function() {
507
+ },
508
+ startHelp: function() {
509
+ this.isInHelp === !1 && (this.helpMode = !0, window.addEventListener("mousedown", this.checkEndHelpMouseDown), this.isInHelp = !0);
510
+ },
511
+ endHelp: function() {
512
+ window.removeEventListener("mousedown", this.checkEndHelpMouseDown), this.helpMode = !1, setTimeout(() => {
513
+ this.isInHelp = !1;
514
+ }, 200);
515
+ },
516
+ onHelpModeShowNext: function() {
517
+ this.helpModeActiveItem += 1;
518
+ },
519
+ onHelpModeLastItem: function(e) {
520
+ e && (this.helpModeLastItem = !0);
521
+ },
522
+ onFinishHelpMode: function() {
523
+ this.helpMode = !1, this.helpModeActiveItem = 0, this.helpModeLastItem = !1;
524
+ },
525
+ onTooltipShown: function() {
526
+ this.$refs.multiflatmap && this.$refs.multiflatmapHelp && this.$refs.multiflatmapHelp.toggleTooltipHighlight(), this.$refs.flatmap && this.$refs.flatmapHelp && this.$refs.flatmapHelp.toggleTooltipHighlight(), this.$refs.scaffold && this.$refs.scaffoldHelp && this.$refs.scaffoldHelp.toggleTooltipHighlight();
527
+ },
528
+ onMapTooltipShown: function() {
529
+ this.$refs.multiflatmap && this.$refs.multiflatmapHelp && this.$refs.multiflatmapHelp.toggleTooltipPinHighlight(), this.$refs.flatmap && this.$refs.flatmapHelp && this.$refs.flatmapHelp.toggleTooltipPinHighlight(), this.$refs.scaffold && this.$refs.scaffoldHelp && this.$refs.scaffoldHelp.toggleTooltipPinHighlight();
530
+ },
531
+ /**
532
+ * End help-mode only if user clicks outside of help mode dialog.
533
+ */
534
+ checkEndHelpMouseDown: function(e) {
535
+ e.target.closest(".help-mode-dialog") || this.endHelp();
536
+ },
537
+ mapHoverHighlight: function(e) {
538
+ if (this.visible) {
539
+ const t = this.settingsStore.hoverAnatomies, i = this.settingsStore.hoverOrgans;
540
+ t.length || i.length ? (clearTimeout(this.hoverDelay), this.multiflatmapRef || this.flatmapRef ? e == null || e.zoomToFeatures(t, { noZoomIn: !0 }) : this.scaffoldRef && (e == null || e.changeHighlightedByName(i, "", !1))) : this.hoverDelay = setTimeout(() => {
541
+ this.multiflatmapRef || this.flatmapRef ? e == null || e.clearSearchResults() : this.scaffoldRef && (e == null || e.changeHighlightedByName(i, "", !1));
542
+ }, 500);
543
+ }
544
+ },
545
+ onConnectivityInfoOpen: function(e) {
546
+ l.emit("connectivity-info-open", e);
547
+ },
548
+ onConnectivityInfoClose: function() {
549
+ l.emit("connectivity-info-close");
550
+ }
551
+ },
552
+ data: function() {
553
+ return {
554
+ apiLocation: void 0,
555
+ activeSpecies: "Rat",
556
+ scaffoldCamera: void 0,
557
+ mainStyle: {
558
+ height: this.entry.datasetTitle ? "calc(100% - 30px)" : "100%",
559
+ width: "100%",
560
+ bottom: "0px"
561
+ },
562
+ helpMode: !1,
563
+ helpModeActiveItem: 0,
564
+ helpModeLastItem: !1,
565
+ multiflatmapRef: null,
566
+ flatmapRef: null,
567
+ scaffoldRef: null,
568
+ scaffoldLoaded: !1,
569
+ isInHelp: !1,
570
+ hoverDelay: void 0
571
+ };
572
+ },
573
+ created: function() {
574
+ this.flatmapAPI = void 0, this.apiLocation = void 0, this.settingsStore.flatmapAPI && (this.flatmapAPI = this.settingsStore.flatmapAPI), this.settingsStore.sparcApi && (this.apiLocation = this.settingsStore.sparcApi);
575
+ },
576
+ watch: {
577
+ helpMode: function(e) {
578
+ e || (this.helpModeActiveItem = 0);
579
+ }
580
+ }
581
+ };
582
+ export {
583
+ U as C
584
+ };