@abi-software/flatmapvuer 1.13.5-demo.8 → 1.14.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.
- package/dist/flatmapvuer.js +1288 -1350
- package/dist/flatmapvuer.umd.cjs +10 -18
- package/dist/style.css +1 -1
- package/package.json +9 -4
- package/src/components/FlatmapVuer.vue +1 -2
- package/src/services/flatmapLoader.js +1 -1
- package/src/services/somaLocationMarkers.js +0 -125
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=20"
|
|
7
|
+
},
|
|
5
8
|
"files": [
|
|
6
9
|
"dist/*",
|
|
7
10
|
"src/*",
|
|
@@ -44,9 +47,9 @@
|
|
|
44
47
|
"./src/*": "./src/*"
|
|
45
48
|
},
|
|
46
49
|
"dependencies": {
|
|
47
|
-
"@abi-software/map-utilities": "1.
|
|
50
|
+
"@abi-software/map-utilities": "1.9.0",
|
|
48
51
|
"@abi-software/sparc-annotation": "0.3.2",
|
|
49
|
-
"@abi-software/svg-sprite": "1.0
|
|
52
|
+
"@abi-software/svg-sprite": "1.1.0",
|
|
50
53
|
"@element-plus/icons-vue": "^2.3.1",
|
|
51
54
|
"css-element-queries": "^1.2.2",
|
|
52
55
|
"element-plus": "2.8.4",
|
|
@@ -77,7 +80,9 @@
|
|
|
77
80
|
},
|
|
78
81
|
"optionalDependencies": {
|
|
79
82
|
"@esbuild/linux-x64": "0.25.3",
|
|
80
|
-
"@rollup/rollup-
|
|
83
|
+
"@rollup/rollup-darwin-arm64": "4.59.0",
|
|
84
|
+
"@rollup/rollup-linux-x64-gnu": "4.59.0",
|
|
85
|
+
"@rollup/rollup-win32-x64-msvc": "4.59.0"
|
|
81
86
|
},
|
|
82
87
|
"eslintConfig": {
|
|
83
88
|
"root": true,
|
|
@@ -634,7 +634,6 @@ import { capitalise, normaliseAlertToStringArray } from './utilities.js'
|
|
|
634
634
|
import yellowstar from '../icons/yellowstar'
|
|
635
635
|
import ResizeSensor from 'css-element-queries/src/ResizeSensor'
|
|
636
636
|
import flatmap from '../services/flatmapLoader.js'
|
|
637
|
-
import { attachSomaLocationMarkerMethods } from '../services/somaLocationMarkers.js'
|
|
638
637
|
import { AnnotationService } from '@abi-software/sparc-annotation'
|
|
639
638
|
import { mapState } from 'pinia'
|
|
640
639
|
import { useMainStore } from '@/store/index'
|
|
@@ -2846,7 +2845,7 @@ export default {
|
|
|
2846
2845
|
}
|
|
2847
2846
|
)
|
|
2848
2847
|
promise1.then((returnedObject) => {
|
|
2849
|
-
this.mapImp =
|
|
2848
|
+
this.mapImp = returnedObject
|
|
2850
2849
|
this.serverURL = this.mapImp.makeServerUrl('').slice(0, -1)
|
|
2851
2850
|
let mapVersion = this.mapImp.details.version
|
|
2852
2851
|
this.setFlightPathInfo(mapVersion)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* a single source for the flatmap-viewer library import
|
|
3
3
|
*/
|
|
4
|
-
import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.4.
|
|
4
|
+
import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.4.5/+esm';
|
|
5
5
|
|
|
6
6
|
export default flatmap;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
const SOMA_MARKER_COLOUR = '#1b7f6b'
|
|
2
|
-
const SOMA_MARKER_SECONDARY_COLOUR = '#f4f1de'
|
|
3
|
-
const SOMA_MARKER_TEXT_COLOUR = '#12312b'
|
|
4
|
-
const SOMA_MARKER_MAX_COUNT_LABEL = '99+'
|
|
5
|
-
|
|
6
|
-
const normalizeSomaLocations = function (somaLocations) {
|
|
7
|
-
return (Array.isArray(somaLocations) ? somaLocations : [])
|
|
8
|
-
.map((item) => ({
|
|
9
|
-
label: String(item?.label || '').trim(),
|
|
10
|
-
curie: String(item?.curie || '').trim(),
|
|
11
|
-
count: Number(item?.count || 0),
|
|
12
|
-
}))
|
|
13
|
-
.filter((item) => item.curie && item.count > 0)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const formatCount = function (count) {
|
|
17
|
-
if (count > 99) return SOMA_MARKER_MAX_COUNT_LABEL
|
|
18
|
-
return String(count)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const createSomaLocationMarkerElement = function (somaLocation) {
|
|
22
|
-
const wrapper = document.createElement('div')
|
|
23
|
-
wrapper.className = 'flatmapvuer-soma-location-marker'
|
|
24
|
-
wrapper.title = somaLocation.label || somaLocation.curie
|
|
25
|
-
wrapper.style.width = '34px'
|
|
26
|
-
wrapper.style.height = '48px'
|
|
27
|
-
wrapper.style.display = 'flex'
|
|
28
|
-
wrapper.style.alignItems = 'center'
|
|
29
|
-
wrapper.style.justifyContent = 'center'
|
|
30
|
-
wrapper.style.transform = 'translate(-50%, -100%)'
|
|
31
|
-
|
|
32
|
-
const countLabel = formatCount(somaLocation.count)
|
|
33
|
-
wrapper.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -1 27 42" width="34" height="48" aria-hidden="true">
|
|
34
|
-
<ellipse style="fill: rgb(0, 0, 0); fill-opacity: 0.18;" cx="12" cy="36" rx="8" ry="4"/>
|
|
35
|
-
<path d="M12.25.25a12.254 12.254 0 0 0-12 12.494
|
|
36
|
-
c0 6.444 6.488 12.109 11.059 22.564.549 1.256 1.333 1.256 1.882 0
|
|
37
|
-
C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z"
|
|
38
|
-
style="fill:${SOMA_MARKER_COLOUR};stroke:${SOMA_MARKER_SECONDARY_COLOUR};stroke-width:1.1"/>
|
|
39
|
-
<circle cx="12.5" cy="12.5" r="8" fill="${SOMA_MARKER_SECONDARY_COLOUR}"/>
|
|
40
|
-
<text x="12.5" y="16.1" text-anchor="middle" style="font-size:7.5px;font-weight:700;fill:${SOMA_MARKER_TEXT_COLOUR};font-family:Arial, sans-serif">${countLabel}</text>
|
|
41
|
-
</svg>`
|
|
42
|
-
|
|
43
|
-
return wrapper
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const resolveMarkerPlacement = function (mapImp, curie) {
|
|
47
|
-
const featureIds = Array.isArray(mapImp?.modelFeatureIds?.(curie)) ? mapImp.modelFeatureIds(curie) : []
|
|
48
|
-
const placements = []
|
|
49
|
-
const seenFeatureUris = new Set()
|
|
50
|
-
|
|
51
|
-
for (const featureId of featureIds) {
|
|
52
|
-
const annotation = mapImp.annotation(featureId)
|
|
53
|
-
const featureUri = String(annotation?.uri || '').trim()
|
|
54
|
-
if (featureUri && !seenFeatureUris.has(featureUri)) {
|
|
55
|
-
seenFeatureUris.add(featureUri)
|
|
56
|
-
placements.push({
|
|
57
|
-
type: 'feature-uri',
|
|
58
|
-
value: featureUri,
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Fall back to model placement only when no feature URI can be resolved.
|
|
64
|
-
if (!placements.length && featureIds.length) {
|
|
65
|
-
placements.push({
|
|
66
|
-
type: 'model',
|
|
67
|
-
value: curie,
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return placements
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const attachSomaLocationMarkerMethods = function (mapImp) {
|
|
75
|
-
if (!mapImp || mapImp.addSomaLocationMarkers) {
|
|
76
|
-
return mapImp
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
let markerIds = []
|
|
80
|
-
|
|
81
|
-
mapImp.clearSomaLocationMarkers = function () {
|
|
82
|
-
markerIds.forEach((markerId) => {
|
|
83
|
-
mapImp.removeMarker(markerId)
|
|
84
|
-
})
|
|
85
|
-
markerIds = []
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
mapImp.addSomaLocationMarkers = function (somaLocations) {
|
|
89
|
-
const normalizedSomaLocations = normalizeSomaLocations(somaLocations)
|
|
90
|
-
const placedSomaLocations = []
|
|
91
|
-
|
|
92
|
-
mapImp.clearSomaLocationMarkers()
|
|
93
|
-
|
|
94
|
-
normalizedSomaLocations.forEach((somaLocation) => {
|
|
95
|
-
const placements = resolveMarkerPlacement(mapImp, somaLocation.curie)
|
|
96
|
-
if (!placements.length) return
|
|
97
|
-
|
|
98
|
-
let somaLocationPlaced = false
|
|
99
|
-
placements.forEach((placement) => {
|
|
100
|
-
const markerElement = createSomaLocationMarkerElement(somaLocation)
|
|
101
|
-
let addedMarkerIds = []
|
|
102
|
-
|
|
103
|
-
if (placement.type === 'feature-uri') {
|
|
104
|
-
addedMarkerIds = mapImp.addMarkerByFeatureUri(placement.value, { element: markerElement })
|
|
105
|
-
} else if (placement.type === 'model') {
|
|
106
|
-
const markerId = mapImp.addMarker(placement.value, { element: markerElement })
|
|
107
|
-
addedMarkerIds = markerId > -1 ? [markerId] : []
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (!addedMarkerIds.length) return
|
|
111
|
-
|
|
112
|
-
markerIds.push(...addedMarkerIds)
|
|
113
|
-
somaLocationPlaced = true
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
if (somaLocationPlaced) {
|
|
117
|
-
placedSomaLocations.push(somaLocation)
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
return placedSomaLocations
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return mapImp
|
|
125
|
-
}
|