@abi-software/flatmapvuer 1.17.1-demo.1 → 1.18.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^24.20.0"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"./src/*": "./src/*"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@abi-software/map-utilities": "1.
|
|
53
|
+
"@abi-software/map-utilities": "1.12.0",
|
|
54
54
|
"@abi-software/sparc-annotation": "0.3.2",
|
|
55
55
|
"@abi-software/svg-sprite": "1.4.0",
|
|
56
56
|
"@element-plus/icons-vue": "^2.3.2",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@eslint/js": "^10.0.1",
|
|
65
65
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
66
|
-
"unplugin-vue-components": "^32.1.0",
|
|
67
66
|
"@vuese/markdown-render": "^2.11.3",
|
|
68
67
|
"auto-changelog": "^2.6.0",
|
|
69
68
|
"chokidar": "^5.0.0",
|
|
@@ -74,14 +73,15 @@
|
|
|
74
73
|
"cypress-wait-until": "^3.0.2",
|
|
75
74
|
"eslint": "^10.9.1",
|
|
76
75
|
"eslint-config-prettier": "^10.1.8",
|
|
77
|
-
"eslint-plugin-prettier": "^5.5.6",
|
|
78
76
|
"eslint-plugin-cypress": "^7.0.0",
|
|
77
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
79
78
|
"eslint-plugin-vue": "^10.10.0",
|
|
80
79
|
"globals": "^17.11.0",
|
|
81
80
|
"mochawesome": "^8.0.1",
|
|
82
81
|
"prettier": "3.9.6",
|
|
83
82
|
"sass": "^1.103.1",
|
|
84
83
|
"unplugin-auto-import": "^21.1.0",
|
|
84
|
+
"unplugin-vue-components": "^32.1.0",
|
|
85
85
|
"vite": "^8.2.1",
|
|
86
86
|
"vitepress": "^1.6.4",
|
|
87
87
|
"vue-docgen-api": "^4.79.2"
|
|
@@ -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
|
-
}
|