@abi-software/mapintegratedvuer 1.17.3-simulation.2 → 1.17.4

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 (47) hide show
  1. package/dist/{ConnectivityGraph-9pXPgFJR.js → ConnectivityGraph-CNtSLKGZ.js} +19 -21
  2. package/dist/{ContentMixin-DIqgKIz6.js → ContentMixin-BImmmP1E.js} +521 -295
  3. package/dist/Flatmap-CakK_75H.js +202 -0
  4. package/dist/{Iframe-CCEA3d9c.js → Iframe-C7E9XJu7.js} +2 -2
  5. package/dist/{MultiFlatmap-Cuke1uNp.js → MultiFlatmap-DnDXuvTw.js} +3 -3
  6. package/dist/{Plot-B4oTBVAT.js → Plot-CxCj3uTj.js} +2 -2
  7. package/dist/Scaffold-D1NyLNzW.js +304 -0
  8. package/dist/Simulation-Br3Grrd6.js +28 -0
  9. package/dist/{index-_b4VBGHk.js → index-qyfmiqHe.js} +22862 -27602
  10. package/dist/mapintegratedvuer.js +1 -1
  11. package/dist/mapintegratedvuer.umd.cjs +232 -4291
  12. package/dist/style-DezYtA61.js +57 -0
  13. package/dist/style.css +1 -1
  14. package/package.json +5 -10
  15. package/src/App.vue +258 -285
  16. package/src/assets/styles.scss +1 -1
  17. package/src/components/ContextCard.vue +1 -0
  18. package/src/components/EventBus.js +3 -0
  19. package/src/components/MapContent.vue +4 -9
  20. package/src/components/SplitDialog.vue +6 -2
  21. package/src/components/SplitFlow.vue +445 -504
  22. package/src/components/scripts/utilities.js +1 -1
  23. package/src/components/viewers/ConnectivityGraph.vue +1 -9
  24. package/src/components/viewers/Flatmap.vue +83 -166
  25. package/src/components/viewers/Scaffold.vue +130 -78
  26. package/src/components/viewers/Simulation.vue +11 -118
  27. package/src/components.d.ts +0 -3
  28. package/src/main.js +3 -9
  29. package/src/mixins/ContentMixin.js +384 -496
  30. package/src/mixins/DynamicMarkerMixin.js +17 -50
  31. package/src/stores/connectivities.js +10 -1
  32. package/src/stores/entries.js +1 -1
  33. package/src/stores/settings.js +0 -4
  34. package/src/stores/splitFlow.js +352 -425
  35. package/dist/Flatmap-D7GVPV7o.js +0 -103422
  36. package/dist/Scaffold-Czz8X5kL.js +0 -310
  37. package/dist/Simulation-BKmz8zwm.js +0 -107
  38. package/dist/style-CM86xE3J.js +0 -119
  39. package/src/components/DummyRouteComponent.vue +0 -1
  40. package/src/components/EventBus.ts +0 -13
  41. package/src/components/FloatingWindow.vue +0 -142
  42. package/src/components/PlotComponent.vue +0 -56
  43. package/src/services/mapping.js +0 -69
  44. package/src/services/testData.js +0 -71
  45. package/src/stores/mapping.js +0 -29
  46. package/src/stores/simulationPlotStore.js +0 -124
  47. package/src/types/simulation.js +0 -18
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div class="viewer-container">
3
3
  <ScaffoldVuer
4
+ v-if="activated"
4
5
  :state="entry.state"
5
6
  :url="entry.resource"
6
7
  :region="entry.region"
@@ -53,6 +54,7 @@
53
54
 
54
55
  <script>
55
56
  /* eslint-disable no-alert, no-console */
57
+ import { markRaw } from "vue";
56
58
  import EventBus from "../EventBus";
57
59
  import ContentMixin from "../../mixins/ContentMixin";
58
60
 
@@ -71,61 +73,67 @@ export default {
71
73
  },
72
74
  methods: {
73
75
  showConnectivitiesByReference: async function (resource) {
74
- const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
75
- let featureIds = [];
76
- if (flatmapKnowledge) {
77
- featureIds = await getReferenceConnectivitiesFromStorage(resource);
78
- } else {
79
- featureIds = await getReferenceConnectivitiesByAPI(this.flatmapService.mapImp, resource, this.flatmapService.flatmapQueries);
80
- }
81
- const nerveLabels = [];
82
- for (const id of featureIds) {
83
- const knowledge = this.nervesKnowledge.find(k => k.id === id);
84
- if (!knowledge) continue;
76
+ if (this.$refs.scaffold) {
77
+ const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
78
+ let featureIds = [];
79
+ if (flatmapKnowledge) {
80
+ featureIds = await getReferenceConnectivitiesFromStorage(resource);
81
+ } else {
82
+ featureIds = await getReferenceConnectivitiesByAPI(this.flatmapService.mapImp, resource, this.flatmapService.flatmapQueries);
83
+ }
84
+ const nerveLabels = [];
85
+ for (const id of featureIds) {
86
+ const knowledge = this.nervesKnowledge.find(k => k.id === id);
87
+ if (!knowledge) continue;
85
88
 
86
- const nerves = knowledge['nerve-label'];
87
- if (nerves) {
88
- const subNerves = nerves.flatMap(n => n.subNerves);
89
- nerveLabels.push(...subNerves);
89
+ const nerves = knowledge['nerve-label'];
90
+ if (nerves) {
91
+ const subNerves = nerves.flatMap(n => n.subNerves);
92
+ nerveLabels.push(...subNerves);
93
+ }
90
94
  }
95
+ this.$refs.scaffold.changeHighlightedByName(nerveLabels, "", false);
91
96
  }
92
- this.$refs.scaffold.changeHighlightedByName(nerveLabels, "", false);
93
97
  },
94
98
  setNerveGreyScale: function () {
95
- if (this.nervesKnowledge.length) {
96
- const nerves = this.nervesKnowledge.reduce((acc, val) => {
97
- return acc.concat(val['nerve-label'] || []);
98
- }, []);
99
- const excludedLabels = nerves.reduce((acc, nerve) => {
100
- return acc.concat(nerve.subNerves || []);
101
- }, []);
102
- this.$refs.scaffold.setGreyScale(true, excludedLabels);
99
+ if (this.$refs.scaffold) {
100
+ if (this.nervesKnowledge.length) {
101
+ const nerves = this.nervesKnowledge.reduce((acc, val) => {
102
+ return acc.concat(val['nerve-label'] || []);
103
+ }, []);
104
+ const excludedLabels = nerves.reduce((acc, nerve) => {
105
+ return acc.concat(nerve.subNerves || []);
106
+ }, []);
107
+ this.$refs.scaffold.setGreyScale(true, excludedLabels);
108
+ }
103
109
  }
104
110
  },
105
111
  setVisibilityFilter: function (payload) {
106
- let names = [];
107
- const processed = payload ? true : false;
108
- if (payload) {
109
- const ids = [];
110
- payload['OR'].forEach(orData => {
111
- if ('AND' in orData) {
112
- if (orData['AND'].length >= 2 && 'models' in orData['AND'][1]) {
113
- ids.push(...orData['AND'][1]['models']);
112
+ if (this.$refs.scaffold) {
113
+ let names = [];
114
+ const processed = payload ? true : false;
115
+ if (payload) {
116
+ const ids = [];
117
+ payload['OR'].forEach(orData => {
118
+ if ('AND' in orData) {
119
+ if (orData['AND'].length >= 2 && 'models' in orData['AND'][1]) {
120
+ ids.push(...orData['AND'][1]['models']);
121
+ }
122
+ }
123
+ });
124
+ for (const id of ids) {
125
+ const nerveKnowledge = this.nervesKnowledge.find((knowledge) => knowledge.id === id);
126
+ if (nerveKnowledge) {
127
+ const nerves = nerveKnowledge['nerve-label'].map(n => n.subNerves).flat(Infinity);
128
+ names.push(...nerves);
114
129
  }
115
- }
116
- });
117
- for (const id of ids) {
118
- const nerveKnowledge = this.nervesKnowledge.find((knowledge) => knowledge.id === id);
119
- if (nerveKnowledge) {
120
- const nerves = nerveKnowledge['nerve-label'].map(n => n.subNerves).flat(Infinity);
121
- names.push(...nerves);
122
130
  }
123
131
  }
132
+ this.$refs.scaffold.zoomToNerves(names, processed);
124
133
  }
125
- this.$refs.scaffold.zoomToNerves(names, processed);
126
134
  },
127
135
  syncFilter: function (data) {
128
- if (this.$refs.scaffold.viewingMode === "Neuron Connection") {
136
+ if (this.$refs.scaffold?.viewingMode === "Neuron Connection") {
129
137
  this.filter = data.filter(f => f.facet?.toLowerCase() !== 'show all');
130
138
  }
131
139
  },
@@ -217,16 +225,27 @@ export default {
217
225
  }
218
226
  },
219
227
  onResize: function () {
220
- this.scaffoldCamera.onResize();
228
+ if (!this.scaffoldCamera) {
229
+ this.scaffoldCamera = markRaw(this.$refs.scaffold?.$module?.scene?.getZincCameraControls());
230
+ }
231
+ if (this.scaffoldCamera) {
232
+ this.scaffoldCamera.onResize();
233
+ }
221
234
  },
222
235
  getState: function () {
223
- return this.$refs.scaffold.getState();
236
+ if (this.$refs.scaffold) {
237
+ return this.$refs.scaffold.getState();
238
+ } else {
239
+ return this.entry.state;
240
+ }
224
241
  },
225
242
  /**
226
243
  * Perform a local search on this contentvuer
227
244
  */
228
245
  search: function (term) {
229
- return this.$refs.scaffold.search(term, true);
246
+ if (this.$refs.scaffold) {
247
+ return this.$refs.scaffold.search(term, true);
248
+ }
230
249
  },
231
250
  searchSuggestions: function(term, suggestions){
232
251
  if (term === "" || !this.$refs.scaffold) {
@@ -238,33 +257,42 @@ export default {
238
257
  });
239
258
  },
240
259
  showConnectivityTooltips: function (payload) {
241
- if (payload.label) {
242
- this.$refs.scaffold.changeHighlightedByName([payload.label], "", false);
243
- this.$refs.scaffold.showRegionTooltip(payload.label, false, false);
244
- } else {
245
- const nerves = payload.connectivityInfo['nerve-label'];
246
- if (nerves) {
247
- const nerveLabels = nerves.flatMap(n => n.subNerves);
248
- this.$refs.scaffold.changeHighlightedByName(nerveLabels, "", false);
260
+ if (this.$refs.scaffold) {
261
+ if (payload.label) {
262
+ this.$refs.scaffold.changeHighlightedByName([payload.label], "", false);
263
+ this.$refs.scaffold.showRegionTooltip(payload.label, false, false);
264
+ } else {
265
+ const nerves = payload.connectivityInfo['nerve-label'];
266
+ if (nerves) {
267
+ const nerveLabels = nerves.flatMap(n => n.subNerves);
268
+ this.$refs.scaffold.changeHighlightedByName(nerveLabels, "", false);
269
+ }
270
+ this.$refs.scaffold.hideRegionTooltip();
249
271
  }
250
- this.$refs.scaffold.hideRegionTooltip();
251
272
  }
252
273
  },
253
274
  zoomToFeatures: function(info, forceSelect) {
254
- let names = undefined;
255
- if (Array.isArray(info)) names = info;
256
- else names = [ info.name ];
257
- if (forceSelect) {
258
- this.$refs.scaffold.changeActiveByName(names, "", false);
275
+ if (this.$refs.scaffold) {
276
+ let names = undefined;
277
+ if (Array.isArray(info)) names = info;
278
+ else names = [ info.name ];
279
+ if (forceSelect) {
280
+ this.$refs.scaffold.changeActiveByName(names, "", false);
281
+ }
282
+ this.$refs.scaffold.viewRegion(names);
259
283
  }
260
- this.$refs.scaffold.viewRegion(names);
261
284
  },
262
285
  scaffoldIsReady: function () {
263
286
  this.scaffoldLoaded = true;
264
287
  this.$refs.scaffold.$module.graphicsHighlight.highlightColour = [1, 0, 1];
265
- if (this.visible) {
266
- let rotation = "free";
267
- if (this.entry.rotation) rotation = this.entry.rotation;
288
+ if (!this.scaffoldRef) {
289
+ this.scaffoldRef = markRaw(this.$refs.scaffold);
290
+ if (this.scaffoldRef) {
291
+ this.loadExplorerConfig();
292
+ this.connectivityKnowledge = this.connectivitiesStore.globalConnectivities;
293
+ this.connectivityFilterOptions = this.connectivitiesStore.filterOptions;
294
+ this.connectivityFilterSources = this.connectivitiesStore.filterSources;
295
+ }
268
296
  }
269
297
  this.updateViewerSettings();
270
298
  EventBus.emit("mapLoaded", this.$refs.scaffold);
@@ -306,25 +334,31 @@ export default {
306
334
  }
307
335
  },
308
336
  updateWithViewUrl: function(viewUrl) {
309
- this.$refs.scaffold.updateViewURL(viewUrl);
337
+ if (this.$refs.scaffold) {
338
+ this.$refs.scaffold.updateViewURL(viewUrl);
339
+ }
310
340
  },
311
341
  /**
312
342
  * Change the view mode of the current scaffold
313
343
  */
314
344
  changeViewingMode: function (modeName) {
315
- this.$refs.scaffold.changeViewingMode(modeName);
345
+ if (this.$refs.scaffold) {
346
+ this.$refs.scaffold.changeViewingMode(modeName);
347
+ }
316
348
  },
317
349
  updateViewerSettings: function () {
318
- const {
319
- backgroundDisplay,
320
- organsDisplay,
321
- outlinesDisplay,
322
- viewingMode,
323
- } = this.settingsStore.globalSettings;
324
- this.$refs.scaffold.backgroundChangeCallback(backgroundDisplay);
325
- this.$refs.scaffold.changeViewingMode(viewingMode);
326
- this.$refs.scaffold.setColour(organsDisplay);
327
- this.$refs.scaffold.setOutlines(outlinesDisplay);
350
+ if (this.$refs.scaffold) {
351
+ const {
352
+ backgroundDisplay,
353
+ organsDisplay,
354
+ outlinesDisplay,
355
+ viewingMode,
356
+ } = this.settingsStore.globalSettings;
357
+ this.$refs.scaffold.backgroundChangeCallback(backgroundDisplay);
358
+ this.$refs.scaffold.changeViewingMode(viewingMode);
359
+ this.$refs.scaffold.setColour(organsDisplay);
360
+ this.$refs.scaffold.setOutlines(outlinesDisplay);
361
+ }
328
362
  },
329
363
  },
330
364
  computed: {
@@ -340,6 +374,27 @@ export default {
340
374
  },
341
375
  },
342
376
  watch: {
377
+ visible: {
378
+ handler(visible) {
379
+ // Only activate scaffoldvuer when the pane becomes active
380
+ if (visible && (!this.activated)) {
381
+ this.activated = true;
382
+ this.$nextTick(() => {
383
+ if (this.$refs.scaffold) {
384
+ this.scaffoldRef = markRaw(this.$refs.scaffold);
385
+ if (this.scaffoldRef) {
386
+ this.loadExplorerConfig();
387
+ this.connectivityKnowledge = this.connectivitiesStore.globalConnectivities;
388
+ this.connectivityFilterOptions = this.connectivitiesStore.filterOptions;
389
+ this.connectivityFilterSources = this.connectivitiesStore.filterSources;
390
+ }
391
+ }
392
+ });
393
+ }
394
+ },
395
+ deep: true,
396
+ immediate: true,
397
+ },
343
398
  connectivityKnowledge: {
344
399
  handler(newVal, oldVal) {
345
400
  // Store scaffold knowledge locally
@@ -359,6 +414,7 @@ export default {
359
414
  },
360
415
  data: function () {
361
416
  return {
417
+ activated: false,
362
418
  apiLocation: process.env.VUE_APP_API_LOCATION,
363
419
  scaffoldCamera: undefined,
364
420
  scaffoldLoaded: false,
@@ -368,10 +424,6 @@ export default {
368
424
  query: '',
369
425
  };
370
426
  },
371
- mounted: function () {
372
- this.scaffoldCamera =
373
- this.$refs.scaffold.$module.scene.getZincCameraControls();
374
- },
375
427
  };
376
428
  </script>
377
429
 
@@ -1,136 +1,29 @@
1
1
  <template>
2
2
  <SimulationVuer
3
3
  :apiLocation="apiLocation"
4
- :id="id" ref="simulation"
5
- @data-notification="handleDataNotification"
6
- @externalData="handleExternalEvent"
7
- @file="handleFileEvent"
8
-
4
+ :id="id"
5
+ ref="simulation"
9
6
  />
10
7
  </template>
11
8
 
12
9
  <script>
13
10
  /* eslint-disable no-alert, no-console */
14
- import EventBus from '../EventBus'
15
- import ContentMixin from '../../mixins/ContentMixin'
16
- import { SimulationVuer } from '@abi-software/simulationvuer'
17
- import '@abi-software/simulationvuer/dist/style.css'
11
+ import ContentMixin from "../../mixins/ContentMixin";
12
+ import { SimulationVuer } from "@abi-software/simulationvuer";
13
+ import "@abi-software/simulationvuer/dist/style.css";
18
14
 
19
15
  export default {
20
- name: 'Simulation',
21
- mixins: [ContentMixin],
16
+ name: "Simulation",
17
+ mixins: [ ContentMixin ],
22
18
  components: {
23
19
  SimulationVuer,
24
20
  },
25
21
  computed: {
26
- id: function () {
22
+ id: function() {
27
23
  //resource field is only available for simulation omex file and it will run locally.
28
24
  //discoverId field is used for simulations running on O2SPARC.
29
- return this.entry.resource ? this.entry.resource : this.entry.discoverId
30
- },
31
- },
32
- data: function () {
33
- return {
34
- columns: undefined,
35
- csv: undefined,
36
- fileOpened: false,
25
+ return this.entry.resource ? this.entry.resource: this.entry.discoverId;
37
26
  }
38
- },
39
- methods: {
40
- handleDataNotification: function (update) {
41
- EventBus.emit('simulation-response', update)
42
- },
43
- handleDataRequest(payload) {
44
- this.processRequest(payload);
45
- },
46
- handleExternalEvent(payload) {
47
- console.log("handleExternalEvent", payload)
48
- },
49
- handleFileEvent(payload) {
50
- if (payload?.type === "opened") {
51
- this.$nextTick(() => {
52
- this.fileOpened = true
53
- if (this.entry.csv_file || this.csv_file) {
54
- this.addExternalData(
55
- {
56
- targetEntryId: this.entry.id,
57
- action: this.entry
58
- }
59
- )
60
- }
61
- })
62
- }
63
- },
64
- handleWindowClosed(payload) {
65
- this.$refs.simulation?.removeDataSubscription(payload.id);
66
- },
67
- processRequest: function (req) {
68
- // strict check against the literal type
69
- if (req.id !== 'nz.ac.auckland.simulation-data-request') return
70
-
71
- const requestMajorVersion = parseInt(req.version.split('.')[0])
72
- if (requestMajorVersion !== 0) {
73
- console.warn('Unsupported simulation request version:', req.version)
74
- return
75
- }
76
-
77
- if (req.payload.protocol?.resource !== this.id) {
78
- return
79
- }
80
-
81
- this.$refs.simulation?.addDataSubscription({
82
- id: req.id,
83
- version: req.version,
84
- payload: {
85
- windowId: req.payload.windowId,
86
- ownerId: req.payload.ownerId,
87
- component: req.payload.component,
88
- variable: req.payload.variable,
89
- withVOI: true,
90
- },
91
- })
92
- },
93
- addExternalData: function(payload) {
94
- if (this.entry.id === payload.targetEntryId) {
95
- const data = payload.action
96
- if (data.csv_file) {
97
- this.csv_file = data.csv_file
98
- this.columns = data.columns
99
- }
100
- if (this.csv_file && this.fileOpened) {
101
- const parameters = []
102
- if (this.columns) {
103
- this.columns.forEach((col) => {
104
- if (col.cellml_variable && col.cellml_variable !== "main/t") {
105
- parameters.push(col.cellml_variable)
106
- }
107
- })
108
- }
109
- this.$refs.simulation.addExternalData(this.csv_file, undefined, parameters)
110
- }
111
- }
112
- }
113
- },
114
- mounted: function () {
115
- EventBus.on('simulation-external-data', this.addExternalData)
116
- EventBus.on('simulation-data-request', this.handleDataRequest)
117
- EventBus.on('plot-window-closed', this.handleWindowClosed)
118
-
119
- EventBus.emit('simulation-ready', {
120
- resourceId: this.id,
121
- entryId: this.entry.id,
122
- ready: true,
123
- })
124
- console.log(this.entry)
125
- },
126
- beforeUnmount: function () {
127
- EventBus.emit('simulation-ready', {
128
- resourceId: this.id,
129
- entryId: this.entry.id,
130
- ready: false,
131
- })
132
- EventBus.off('simulation-data-request', this.handleDataRequest)
133
- EventBus.off('plot-window-closed', this.handleWindowClosed)
134
- },
135
- }
27
+ }
28
+ };
136
29
  </script>
@@ -15,7 +15,6 @@ declare module 'vue' {
15
15
  CustomSplitter: typeof import('./components/CustomSplitter.vue')['default']
16
16
  DatasetHeader: typeof import('./components/DatasetHeader.vue')['default']
17
17
  DialogToolbarContent: typeof import('./components/DialogToolbarContent.vue')['default']
18
- DummyRouteComponent: typeof import('./components/DummyRouteComponent.vue')['default']
19
18
  ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
20
19
  ElButton: typeof import('element-plus/es')['ElButton']
21
20
  ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
@@ -45,12 +44,10 @@ declare module 'vue' {
45
44
  ElSelect: typeof import('element-plus/es')['ElSelect']
46
45
  Flatmap: typeof import('./components/viewers/Flatmap.vue')['default']
47
46
  FlatmapContextCard: typeof import('./components/FlatmapContextCard.vue')['default']
48
- FloatingWindow: typeof import('./components/FloatingWindow.vue')['default']
49
47
  Iframe: typeof import('./components/viewers/Iframe.vue')['default']
50
48
  MapContent: typeof import('./components/MapContent.vue')['default']
51
49
  MultiFlatmap: typeof import('./components/viewers/MultiFlatmap.vue')['default']
52
50
  Plot: typeof import('./components/viewers/Plot.vue')['default']
53
- PlotComponent: typeof import('./components/PlotComponent.vue')['default']
54
51
  ResizeSensor: typeof import('./components/ResizeSensor.vue')['default']
55
52
  RouterLink: typeof import('vue-router')['RouterLink']
56
53
  RouterView: typeof import('vue-router')['RouterView']
package/src/main.js CHANGED
@@ -1,16 +1,12 @@
1
+
1
2
  import { createApp } from 'vue'
2
3
  import { createPinia } from 'pinia'
3
4
  import * as VueRouter from 'vue-router'
4
5
  import App from './App.vue'
5
-
6
- import ElementPlus from 'element-plus'
7
- import 'element-plus/dist/index.css'
8
-
9
6
  import { useMainStore } from './stores/index'
10
- import DummyRouteComponent from './components/DummyRouteComponent.vue'
11
7
 
12
8
  const routes = [
13
- { path: '/', component: DummyRouteComponent },
9
+ { path: '/' },
14
10
  ]
15
11
 
16
12
  const router = VueRouter.createRouter({
@@ -25,8 +21,6 @@ const app = createApp(App)
25
21
  app.use(pinia)
26
22
  app.use(router)
27
23
 
28
- app.use(ElementPlus)
29
-
30
24
  const mainStore = useMainStore()
31
25
  const token = document.cookie
32
26
  .split("; ")
@@ -35,4 +29,4 @@ if (mainStore && token) {
35
29
  mainStore.setUserToken(token.split("=")[1])
36
30
  }
37
31
 
38
- app.mount('#app')
32
+ app.mount('#app')