@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,56 +0,0 @@
1
- <script setup>
2
- import { ref, onMounted, watch } from 'vue';
3
- import Plotly from 'plotly.js-dist-min';
4
- import { useResizeObserver, useDebounceFn } from '@vueuse/core';
5
-
6
- const props = defineProps(['data']);
7
- const plotContainer = ref(null);
8
-
9
- const drawPlot = () => {
10
- if (!plotContainer.value) return;
11
-
12
- const plotData = [{
13
- x: props.data?.x || [],
14
- y: props.data?.y || [],
15
- type: 'scatter'
16
- }];
17
-
18
- const layout = {
19
- margin: { t: 20, r: 20, b: 40, l: 40 }, // Tight margins for small windows
20
- autosize: true
21
- };
22
-
23
- const config = { responsive: true }; // Helps with window resize, but not enough for container resize
24
-
25
- Plotly.newPlot(plotContainer.value, plotData, layout, config);
26
- };
27
-
28
- // Debounce this so we don't spam Plotly while the user is actively dragging
29
- const handleResize = useDebounceFn(() => {
30
- if (plotContainer.value) {
31
- Plotly.Plots.resize(plotContainer.value);
32
- }
33
- }, 50); // 50ms delay
34
-
35
- // Observe resizes, useResizeObserver automatically cleans up when component unmounts
36
- useResizeObserver(plotContainer, () => {
37
- handleResize();
38
- });
39
-
40
- onMounted(() => {
41
- drawPlot();
42
- });
43
-
44
- watch(() => props.data, drawPlot, { deep: true });
45
- </script>
46
-
47
- <template>
48
- <div ref="plotContainer" class="plot-container"></div>
49
- </template>
50
-
51
- <style scoped>
52
- .plot-container {
53
- width: 100%;
54
- height: 100%;
55
- }
56
- </style>
@@ -1,69 +0,0 @@
1
- import readXlsxFile from 'read-excel-file'
2
-
3
- const BASE_URL =
4
- 'https://raw.githubusercontent.com/hsorby/fc-feature-mapping/main/'
5
- const INDEX_FILE = 'mapping_index.json'
6
-
7
- export class MappingService {
8
- // Find the correct Excel file for the current Flatmap
9
- static async getMappingIndex() {
10
- try {
11
- // Fetch the master index
12
- const response = await fetch(`${BASE_URL}${INDEX_FILE}`)
13
- if (!response.ok) throw new Error('Failed to fetch index')
14
-
15
- const index = await response.json()
16
-
17
- return index || null
18
- } catch (e) {
19
- console.error('Error finding map mapping:', e)
20
- return null
21
- }
22
- }
23
-
24
- // Fetch and Parse the Excel file
25
- static async loadMapping(index) {
26
- const flatmapMap = new Map()
27
-
28
- for (const entry in index) {
29
- try {
30
- const filename = index[entry]
31
-
32
- const response = await fetch(`${BASE_URL}${filename}`)
33
- if (!response.ok) throw new Error(`Failed to fetch ${filename}`)
34
-
35
- // Get the binary data
36
- const blob = await response.blob()
37
-
38
- // Parse with read-excel-file
39
- // rows is an array of arrays: [ ["Header1", "Header2"], ["Row1Col1", "Row1Col2"] ]
40
- const rows = await readXlsxFile(blob)
41
-
42
- // Remove header row
43
- const headers = rows.shift()
44
- const nameIndex = headers.indexOf('Name')
45
- const componentIndex = headers.indexOf('Component')
46
- const flatmapIdIndex = headers.indexOf('Flatmap ID')
47
-
48
- // Convert to a Lookup Map for fast access
49
- // Assuming Column 0 = FlatmapID, Column 1 = Component, Column 2 = Variable
50
- const lookup = new Map()
51
-
52
- rows.forEach((row) => {
53
- const flatmapId = row[flatmapIdIndex]
54
- const component = row[componentIndex]
55
- const variable = row[nameIndex]
56
-
57
- if (flatmapId && component && variable) {
58
- lookup.set(flatmapId, { component, variable })
59
- }
60
- })
61
- flatmapMap.set(entry, lookup)
62
- } catch (e) {
63
- console.error('Error parsing mapping file:', e)
64
- }
65
- }
66
-
67
- return flatmapMap
68
- }
69
- }
@@ -1,71 +0,0 @@
1
- const resolveURL = (relative, base) => {
2
- const resolved = new URL(relative, base);
3
- return resolved.href;
4
- }
5
-
6
- const readProtocolData = async (item, baseUrl) => {
7
- if (item && item.resource?.url) {
8
- const resolvedUrl = resolveURL(item.resource.url, baseUrl);
9
- const response = await fetch(resolvedUrl)
10
- const data = await response.json()
11
- //convert url
12
- const fields = ["csv_file", "protocol", "thumbnail"]
13
- data.forEach((protocol) => {
14
- fields.forEach((field) => {
15
- if (field in protocol) {
16
- protocol[field] = resolveURL(protocol[field], resolvedUrl)
17
- }
18
- });
19
- })
20
- return data
21
- }
22
-
23
- return
24
- }
25
-
26
- const updateProtocolData = async (entry, baseUrl) => {
27
- if (entry["simulation-protocols"]) {
28
- const processedData = [];
29
- for (const item of entry["simulation-protocols"]) {
30
- const data = await readProtocolData(item, baseUrl);
31
- if (data) {
32
- processedData.push(...data);
33
- }
34
- }
35
- return processedData;
36
- }
37
- }
38
-
39
- const getProtocolData = async (uuid, data, baseUrl) => {
40
- const processedResults = [];
41
- for (const entry of data) {
42
- let found = false;
43
- if (entry.flatmaps) {
44
- for (const flatmap of entry.flatmaps) {
45
- if (flatmap.associated_flatmap?.identifier === uuid) {
46
- found = true;
47
- }
48
- }
49
- }
50
- if (found) {
51
- const results = await updateProtocolData(entry, baseUrl);
52
- if (results) {
53
- processedResults.push(...results);
54
- }
55
- }
56
- }
57
- return processedResults;
58
- }
59
-
60
- const retrieveProtocolData = async (url, uuid) => {
61
- if (url) {
62
- const response = await fetch(url);
63
- const data = await response.json();
64
- return await getProtocolData(uuid, data, url);
65
- }
66
- return undefined;
67
- }
68
-
69
- export {
70
- retrieveProtocolData
71
- };
@@ -1,29 +0,0 @@
1
- import { defineStore } from 'pinia'
2
- import { MappingService } from '../services/mapping'
3
-
4
- export const useMappingStore = defineStore('mapping', {
5
- state: () => ({
6
- elementMap: new Map(),
7
- }),
8
-
9
- actions: {
10
- async initializeMapping() {
11
- this.elementMap.clear()
12
-
13
- // Find which file to load
14
- const index = await MappingService.getMappingIndex()
15
-
16
- if (index) {
17
- // Parse and store
18
- this.elementMap = await MappingService.loadMapping(index)
19
- } else {
20
- console.warn('No index found.')
21
- }
22
- },
23
-
24
- // Helper to get data for a specific element ID
25
- mapToCellMLIdentifiers(flatmapUuid, flatmapElementId) {
26
- return this.elementMap.get(flatmapUuid)?.get(flatmapElementId) || { component: undefined, variable: undefined }
27
- },
28
- },
29
- })
@@ -1,124 +0,0 @@
1
- import { defineStore } from 'pinia'
2
- import { ref } from 'vue'
3
- import EventBus from '../components/EventBus'
4
-
5
- const BASE_Z_INDEX = 100
6
-
7
- export const useSimulationPlotStore = defineStore('simulationPlot', () => {
8
- const windows = ref([])
9
- const zStack = ref([])
10
- const simulationEntries = ref({})
11
-
12
- function initListeners() {
13
- EventBus.on('simulation-response', handleSimulationResponse)
14
- EventBus.on('simulation-ready', handleSimulationReady)
15
- }
16
-
17
- function cleanupListeners() {
18
- EventBus.off('simulation-response', handleSimulationResponse)
19
- EventBus.off('simulation-ready', handleSimulationReady)
20
- }
21
-
22
- function removeWindow(windowId) {
23
- const targetWindow = windows.value.find(win => win.id === windowId)
24
- if (!targetWindow) return
25
- windows.value = windows.value.filter((win) => win.id !== windowId)
26
- zStack.value = zStack.value.filter((stackId) => stackId !== windowId)
27
- EventBus.emit('plot-window-closed', { id: targetWindow.id})
28
- }
29
-
30
- function refreshZIndices() {
31
- windows.value.forEach((win) => {
32
- // Find where this window sits in the stack
33
- const stackIndex = zStack.value.indexOf(win.id)
34
-
35
- // If found, assign zIndex. If not (error case), keep it low.
36
- if (stackIndex !== -1) {
37
- win.zIndex = BASE_Z_INDEX + stackIndex
38
- }
39
- })
40
- }
41
-
42
- function bringToFront(windowId) {
43
- const stackIndex = zStack.value.indexOf(windowId)
44
- if (stackIndex === -1) return // Should not happen
45
-
46
- zStack.value.splice(stackIndex, 1)
47
-
48
- zStack.value.push(windowId)
49
-
50
- refreshZIndices()
51
- }
52
-
53
- function handleSimulationReady(data) {
54
- simulationEntries.value[data.resourceId] = { ready: data.ready, entryId: data.entryId }
55
- }
56
-
57
- function getEntryIdWithResource(data) {
58
- if (!data.resource || !simulationEntries.value[data.resource]?.ready) return 0
59
- return simulationEntries.value[data.resource].entryId
60
- }
61
-
62
- function runExperimentalData(data) {
63
- const entryId = getEntryIdWithResource(data)
64
- if (entryId) {
65
- console.log("Fire", simulationEntries.value[data.resource].entryId, data)
66
- EventBus.emit('simulation-external-data', {
67
- targetEntryId: simulationEntries.value[data.resource].entryId,
68
- action: data,
69
- })
70
- }
71
- return entryId
72
- }
73
-
74
- function requestSimulation(data) {
75
- if (data.protocol === null || !simulationEntries.value[data.protocol?.resource]?.ready) return
76
-
77
- let targetWindow = windows.value.find(win => win.id === data.windowId)
78
- if (!targetWindow) {
79
- targetWindow = {
80
- label: data.label,
81
- id: data.windowId,
82
- ownerId: data.ownerId,
83
- data: null,
84
- zIndex: BASE_Z_INDEX,
85
- x: data.position.x + data.offset.left,
86
- y: data.position.y + data.offset.top,
87
- }
88
- windows.value.push(targetWindow)
89
- zStack.value.push(targetWindow.id)
90
- refreshZIndices()
91
- } else {
92
- bringToFront(targetWindow.id)
93
- }
94
-
95
- EventBus.emit('simulation-data-request', {
96
- id: 'nz.ac.auckland.simulation-data-request',
97
- version: '0.1.0',
98
- payload: data,
99
- })
100
- }
101
-
102
- function handleSimulationResponse(response) {
103
- if (response.id !== 'nz.ac.auckland.simulation-data-response') return
104
- const targetWindow = windows.value.find(win => win.id === response.payload.windowId)
105
-
106
- if (targetWindow) {
107
- targetWindow.data = response.payload.data
108
- } else {
109
- console.warn('Received simulation response for unknown window ID:', response.payload.windowId)
110
- }
111
- }
112
-
113
- return {
114
- windows,
115
- bringToFront,
116
- cleanupListeners,
117
- getEntryIdWithResource,
118
- handleSimulationResponse,
119
- requestSimulation,
120
- runExperimentalData,
121
- initListeners,
122
- removeWindow,
123
- }
124
- })
@@ -1,18 +0,0 @@
1
- export const SIMULATION_REQUEST_ID = 'nz.ac.auckland.simulation-data-request'
2
- export const SIMULATION_REQUEST_VERSION = '0.1.0'
3
-
4
- // export type RequestId = typeof SIMULATION_REQUEST_ID
5
-
6
- // // Definition of the request.
7
- // export interface SimulationRequest {
8
- // id: RequestId
9
- // component: string // e.g., 'main'
10
- // variable: string // e.g., 'v_W_GI'
11
- // version: string // e.g., '0.1.0'
12
- // identifier: string // e.g., 'bvc/ID-0000040'
13
- // }
14
-
15
- // // Definition of the response.
16
- // export interface SimulationResponse {
17
- // [variableName: string]: number[] | Float32Array
18
- // }