@abi-software/flatmapvuer 0.5.9 → 0.6.0-vue3-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.
Files changed (41) hide show
  1. package/babel.config.js +0 -14
  2. package/dist/favicon.ico +0 -0
  3. package/dist/flatmapvuer.js +69542 -0
  4. package/dist/flatmapvuer.umd.cjs +1021 -0
  5. package/dist/index.html +17 -0
  6. package/dist/style.css +1 -0
  7. package/package.json +29 -21
  8. package/src/App.vue +180 -105
  9. package/src/assets/styles.scss +2 -3
  10. package/src/components/AnnotationTool.vue +193 -153
  11. package/src/components/EventBus.js +3 -3
  12. package/src/components/ExternalResourceCard.vue +39 -30
  13. package/src/components/FlatmapVuer.vue +734 -676
  14. package/src/components/MultiFlatmapVuer.vue +313 -246
  15. package/src/components/ProvenancePopup.vue +195 -121
  16. package/src/components/SelectionsGroup.vue +93 -84
  17. package/src/components/Tooltip.vue +11 -13
  18. package/src/components/TreeControls.vue +67 -64
  19. package/src/components/index.js +4 -7
  20. package/src/components/legends/DynamicLegends.vue +13 -19
  21. package/src/components/legends/SvgLegends.vue +72 -27
  22. package/src/components.d.ts +46 -0
  23. package/src/icons/flatmap-marker.js +1 -1
  24. package/src/icons/fonts/mapicon-species.eot +0 -0
  25. package/src/icons/fonts/mapicon-species.svg +0 -0
  26. package/src/icons/yellowstar.js +2 -2
  27. package/src/legends/legend.svg +0 -0
  28. package/src/main.js +2 -6
  29. package/src/services/flatmapQueries.js +175 -139
  30. package/vite.config.js +76 -0
  31. package/vue.config.js +14 -0
  32. package/CHANGELOG.md +0 -402
  33. package/dist/demo.html +0 -10
  34. package/dist/flatmapvuer.common.js +0 -22741
  35. package/dist/flatmapvuer.common.js.map +0 -1
  36. package/dist/flatmapvuer.css +0 -1
  37. package/dist/flatmapvuer.umd.js +0 -22751
  38. package/dist/flatmapvuer.umd.js.map +0 -1
  39. package/dist/flatmapvuer.umd.min.js +0 -4
  40. package/dist/flatmapvuer.umd.min.js.map +0 -1
  41. package/package-lock.json +0 -18473
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.5.9",
3
+ "version": "0.6.0-vue3-0",
4
4
  "license": "Apache-2.0",
5
- "main": "./dist/flatmapvuer.common.js",
6
5
  "files": [
7
6
  "dist/*",
8
7
  "src/*",
@@ -16,9 +15,9 @@
16
15
  },
17
16
  "scripts": {
18
17
  "start": "vue-cli-service serve",
19
- "serve": "vue-cli-service serve --port 8082",
18
+ "serve": "vite --host",
20
19
  "build": "vue-cli-service build --dest test_html --mode staging",
21
- "build-bundle": "vue-cli-service build --target lib --name flatmapvuer ./src/components/index.js",
20
+ "build-bundle": "vite build",
22
21
  "lint": "vue-cli-service lint",
23
22
  "release:beta": "npm version prerelease --preid=beta; npm publish --tag beta",
24
23
  "release:minor": "npm version minor; npm publish",
@@ -26,31 +25,45 @@
26
25
  "changelog": "auto-changelog -p --output CHANGELOG.md --template keepachangelog",
27
26
  "version": "npm run build-bundle;npm run changelog; git add CHANGELOG.md"
28
27
  },
28
+ "type": "module",
29
+ "main": "./dist/flatmapvuer.umd.cjs",
30
+ "module": "./dist/flatmapvuer.js",
31
+ "exports": {
32
+ ".": {
33
+ "import": "./dist/flatmapvuer.js",
34
+ "require": "./dist/flatmapvuer.umd.cjs"
35
+ },
36
+ "./dist/style.css": "./dist/style.css"
37
+ },
29
38
  "dependencies": {
30
39
  "@abi-software/flatmap-viewer": "^2.4.3",
31
40
  "@abi-software/sparc-annotation": "0.0.5",
32
41
  "@abi-software/svg-sprite": "^0.3.0",
33
- "core-js": "^3.3.2",
42
+ "@element-plus/icons-vue": "^2.3.1",
43
+ "@vue/compat": "^3.3.13",
44
+ "core-js": "^3.6.5",
34
45
  "css-element-queries": "^1.2.2",
35
46
  "current-script-polyfill": "^1.0.0",
36
- "element-ui": "^2.13.0",
47
+ "element-plus": "^2.4.4",
37
48
  "file-loader": "^5.0.2",
38
49
  "lodash": "^4.17.21",
39
- "vue": "^2.6.10"
50
+ "mitt": "^3.0.1",
51
+ "unocss": "^0.58.0",
52
+ "unplugin-vue-components": "^0.26.0",
53
+ "vue": "^3.3.13",
54
+ "vue3-component-svg-sprite": "^0.0.1"
40
55
  },
41
56
  "devDependencies": {
42
- "@vue/cli-plugin-babel": "^4.0.0",
43
- "@vue/cli-plugin-eslint": "^4.0.0",
44
- "@vue/cli-service": "^4.5.13",
57
+ "@vitejs/plugin-vue": "^4.6.2",
58
+ "@vue/compiler-sfc": "^3.3.13",
45
59
  "auto-changelog": "^2.4.0",
46
- "babel-eslint": "^10.0.3",
60
+ "babel-eslint": "^10.1.0",
47
61
  "babel-plugin-component": "^1.1.1",
48
62
  "base64-inline-loader": "^2.0.1",
49
- "eslint": "^5.16.0",
50
- "eslint-plugin-vue": "^5.0.0",
51
- "node-sass": "^4.14.1",
52
- "sass-loader": "^8.0.2",
53
- "vue-template-compiler": "^2.6.10",
63
+ "eslint": "^8.56.0",
64
+ "eslint-plugin-vue": "^9.19.2",
65
+ "sass": "^1.69.5",
66
+ "vite": "^5.0.10",
54
67
  "webpack-node-externals": "^2.5.2"
55
68
  },
56
69
  "eslintConfig": {
@@ -67,11 +80,6 @@
67
80
  "parser": "babel-eslint"
68
81
  }
69
82
  },
70
- "postcss": {
71
- "plugins": {
72
- "autoprefixer": {}
73
- }
74
- },
75
83
  "browserslist": [
76
84
  "> 1%",
77
85
  "last 2 versions"
package/src/App.vue CHANGED
@@ -3,161 +3,233 @@
3
3
  <el-popover
4
4
  placement="bottom"
5
5
  trigger="click"
6
- width=500
6
+ width="500"
7
7
  class="popover"
8
- :appendToBody=false
9
- >
8
+ :teleported="false"
9
+ >
10
10
  <div class="options-container">
11
11
  <el-row :gutter="20">
12
- <el-button @click="helpMode = !helpMode" size="mini">Help Mode</el-button>
13
- <el-button @click="saveSettings()" size="mini">Save Settings</el-button>
14
- <el-button :disabled="mapSettings.length === 0" @click="restoreSettings()" size="mini">Restore Settings</el-button>
15
- <el-autocomplete class="search-box" placeholder="Search"
12
+ <el-button @click="helpMode = !helpMode" size="small"
13
+ >Help Mode</el-button
14
+ >
15
+ <el-button @click="saveSettings()" size="small"
16
+ >Save Settings</el-button
17
+ >
18
+ <el-button
19
+ :disabled="mapSettings.length === 0"
20
+ @click="restoreSettings()"
21
+ size="small"
22
+ >Restore Settings</el-button
23
+ >
24
+ <el-autocomplete
25
+ class="search-box"
26
+ placeholder="Search"
16
27
  v-model="searchText"
17
28
  :fetch-suggestions="fetchSuggestions"
18
29
  @keyup.enter.native="search"
19
30
  @select="search"
20
- popper-class="autocomplete-popper">
31
+ popper-class="autocomplete-popper"
32
+ :teleported="false"
33
+ >
21
34
  </el-autocomplete>
22
35
  </el-row>
23
36
  </div>
24
- <el-button class="options-button" icon="el-icon-setting" slot="reference">Options</el-button>
37
+ <template #reference>
38
+ <el-button class="options-button" :icon="ElIconSetting"
39
+ >Options</el-button>
40
+ </template>
25
41
  </el-popover>
26
-
27
- <MultiFlatmapVuer ref="multi" :availableSpecies="availableSpecies"
28
- @resource-selected="FlatmapSelected" :minZoom="minZoom"
29
- @pan-zoom-callback="panZoomcallback" @open-map="openMap"
30
- @ready="FlatmapReady" :featureInfo="featureInfo" :searchable="searchable"
42
+
43
+ <MultiFlatmapVuer
44
+ ref="multi"
45
+ :availableSpecies="availableSpecies"
46
+ @resource-selected="FlatmapSelected"
47
+ :minZoom="minZoom"
48
+ @pan-zoom-callback="panZoomcallback"
49
+ @open-map="openMap"
50
+ @ready="FlatmapReady"
51
+ :featureInfo="featureInfo"
52
+ :searchable="searchable"
31
53
  :layerControl="layerControl"
32
- :initial="initial" :pathControls="pathControls" :helpMode="helpMode"
33
- :displayMinimap="true" :enableOpenMapUI="true" :flatmapAPI="flatmapAPI"/>
54
+ :initial="initial"
55
+ :pathControls="pathControls"
56
+ :helpMode="helpMode"
57
+ :displayMinimap="true"
58
+ :enableOpenMapUI="true"
59
+ :flatmapAPI="flatmapAPI"
60
+ />
34
61
  </div>
35
62
  </template>
36
63
 
37
64
  <script>
65
+ import { shallowRef } from 'vue';
66
+ import { Setting as ElIconSetting } from '@element-plus/icons-vue'
38
67
  /* eslint-disable no-alert, no-console */
39
- import Vue from "vue";
40
68
  import MultiFlatmapVuer from './components/MultiFlatmapVuer.vue'
41
69
  import {
42
- Autocomplete,
43
- Button,
44
- Col,
45
- Popover,
46
- Row,
47
- } from 'element-ui';
48
- import "./icons/mapicon-species-style.css";
49
- Vue.use(Autocomplete);
50
- Vue.use(Button);
51
- Vue.use(Col);
52
- Vue.use(Popover);
53
- Vue.use(Row);
70
+ ElAutocomplete as Autocomplete,
71
+ ElButton as Button,
72
+ ElCol as Col,
73
+ ElPopover as Popover,
74
+ ElRow as Row,
75
+ } from 'element-plus'
76
+ import './icons/mapicon-species-style.css'
54
77
 
55
78
  export default {
56
79
  name: 'app',
80
+ components: {
81
+ Autocomplete,
82
+ Button,
83
+ Col,
84
+ ElIconSetting,
85
+ Popover,
86
+ Row,
87
+ },
57
88
  methods: {
58
- saveSettings: function() {
59
- this.mapSettings.push(this.$refs.multi.getState());
89
+ saveSettings: function () {
90
+ this.mapSettings.push(this.$refs.multi.getState())
60
91
  },
61
- restoreSettings: function() {
92
+ restoreSettings: function () {
62
93
  if (this.mapSettings.length > 0)
63
- this.$refs.multi.setState(this.mapSettings.pop());
94
+ this.$refs.multi.setState(this.mapSettings.pop())
64
95
  },
65
- FlatmapSelected: function(resource) {
66
- if (resource.eventType === "click") {
67
- console.log('resource', resource);
96
+ FlatmapSelected: function (resource) {
97
+ if (resource.eventType === 'click') {
98
+ console.log('resource', resource)
68
99
  }
69
100
  },
70
- FlatmapReady: function(component) {
71
- console.log(component);
72
- let taxon = component.mapImp.describes;
73
- let id = component.mapImp.addMarker("UBERON:0000948");
74
- window.flatmapImp = component.mapImp;
75
- component.enablePanZoomEvents(true);
101
+ FlatmapReady: function (component) {
102
+ console.log(component)
103
+ let taxon = component.mapImp.describes
104
+ let id = component.mapImp.addMarker('UBERON:0000948')
105
+ window.flatmapImp = component.mapImp
106
+ component.enablePanZoomEvents(true)
76
107
  //component.showPathwaysDrawer(false);
77
- console.log(taxon, id);
108
+ console.log(taxon, id)
78
109
  //component.searchAndShowResult("heart");
79
110
  },
80
- panZoomcallback: function(payload) {
111
+ panZoomcallback: function (payload) {
81
112
  this.payload = payload
82
113
  },
83
114
  openMap: function (map) {
84
115
  console.log(map)
85
116
  },
86
- fetchSuggestions: function(term, cb) {
87
- if (term === "") {
88
- cb([]);
117
+ fetchSuggestions: function (term, cb) {
118
+ if (term === '') {
119
+ cb([])
89
120
  } else {
90
- const suggestions = [];
91
- const results = this.$refs.multi.getCurrentFlatmap().searchSuggestions(term);
92
- results.__featureIds.forEach(id => {
93
- const annotation = this.$refs.multi.getCurrentFlatmap().mapImp.annotation(id);
94
- if (annotation && annotation.label)
95
- suggestions.push(annotation.label);
96
- });
97
- const unique = new Set(suggestions);
98
- suggestions.length = 0;
121
+ const suggestions = []
122
+ const results = this.$refs.multi
123
+ .getCurrentFlatmap()
124
+ .searchSuggestions(term)
125
+ results.__featureIds.forEach((id) => {
126
+ const annotation = this.$refs.multi
127
+ .getCurrentFlatmap()
128
+ .mapImp.annotation(id)
129
+ if (annotation && annotation.label) suggestions.push(annotation.label)
130
+ })
131
+ const unique = new Set(suggestions)
132
+ suggestions.length = 0
99
133
  for (const item of unique) {
100
- suggestions.push({"value": "\"" + item +"\""});
134
+ suggestions.push({ value: '"' + item + '"' })
101
135
  }
102
- cb(suggestions);
136
+ cb(suggestions)
103
137
  }
104
138
  },
105
- search: function() {
139
+ search: function () {
106
140
  console.log(this.searchText)
107
- this.$refs.multi.getCurrentFlatmap().searchAndShowResult(this.searchText, true);
108
- }
141
+ this.$refs.multi
142
+ .getCurrentFlatmap()
143
+ .searchAndShowResult(this.searchText, true)
144
+ },
109
145
  },
110
- data: function(){
146
+ data: function () {
111
147
  return {
112
- searchText: "",
148
+ searchText: '',
113
149
  featureInfo: true,
114
150
  searchable: true,
115
151
  pathControls: true,
116
152
  layerControl: true,
117
153
  minZoom: 4,
118
- availableSpecies : {
119
- "Human Female":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000383", iconClass:"mapicon-icon_human", displayWarning:true},
120
- "Human Male":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000384", iconClass:"mapicon-icon_human", displayWarning:true},
121
- "Rat":{taxo: "NCBITaxon:10114", iconClass:"mapicon-icon_rat", displayWarning:true, displayLatestChanges:true},
122
- "Rat (NPO)":{taxo: "NCBITaxon:10116", iconClass:"mapicon-icon_rat", displayWarning:true, displayLatestChanges:true},
123
- "Mouse":{taxo: "NCBITaxon:10090", iconClass:"mapicon-icon_mouse", displayWarning:true},
124
- "Kember":{taxo: "ABI:1000001", displayWarning:true},
125
- "Pig":{taxo: "NCBITaxon:9823", iconClass:"mapicon-icon_pig", displayWarning:true},
126
- "Cat":{taxo: "NCBITaxon:9685", iconClass:"mapicon-icon_cat", displayWarning:true},
127
- "Sample":{taxo: "NCBITaxon:1", displayWarning:true},
128
- "Functional Connectivity": {taxo: "FunctionalConnectivity", displayWarning:true},
154
+ availableSpecies: {
155
+ 'Human Female': {
156
+ taxo: 'NCBITaxon:9606',
157
+ biologicalSex: 'PATO:0000383',
158
+ iconClass: 'mapicon-icon_human',
159
+ displayWarning: true,
160
+ },
161
+ 'Human Male': {
162
+ taxo: 'NCBITaxon:9606',
163
+ biologicalSex: 'PATO:0000384',
164
+ iconClass: 'mapicon-icon_human',
165
+ displayWarning: true,
166
+ },
167
+ Rat: {
168
+ taxo: 'NCBITaxon:10114',
169
+ iconClass: 'mapicon-icon_rat',
170
+ displayWarning: true,
171
+ displayLatestChanges: true,
172
+ },
173
+ 'Rat (NPO)': {
174
+ taxo: 'NCBITaxon:10116',
175
+ iconClass: 'mapicon-icon_rat',
176
+ displayWarning: true,
177
+ displayLatestChanges: true,
178
+ },
179
+ Mouse: {
180
+ taxo: 'NCBITaxon:10090',
181
+ iconClass: 'mapicon-icon_mouse',
182
+ displayWarning: true,
183
+ },
184
+ Kember: { taxo: 'ABI:1000001', displayWarning: true },
185
+ Pig: {
186
+ taxo: 'NCBITaxon:9823',
187
+ iconClass: 'mapicon-icon_pig',
188
+ displayWarning: true,
189
+ },
190
+ Cat: {
191
+ taxo: 'NCBITaxon:9685',
192
+ iconClass: 'mapicon-icon_cat',
193
+ displayWarning: true,
194
+ },
195
+ Sample: { taxo: 'NCBITaxon:1', displayWarning: true },
196
+ 'Functional Connectivity': {
197
+ taxo: 'FunctionalConnectivity',
198
+ displayWarning: true,
199
+ },
129
200
  },
130
201
  tooltipContent: undefined,
131
202
  tStyle: {
132
- top: "200px",
133
- left: "200px",
134
- position: "absolute"
203
+ top: '200px',
204
+ left: '200px',
205
+ position: 'absolute',
135
206
  },
136
207
  displayCloseButton: false,
137
- initial: "Rat (NPO)",
208
+ initial: 'Rat (NPO)',
138
209
  helpMode: false,
139
210
  mapSettings: [],
140
211
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
141
212
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
142
213
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/"
143
- flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v4/"
214
+ flatmapAPI: 'https://mapcore-demo.org/devel/flatmap/v4/',
144
215
  //flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
145
216
  //flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/"
146
- // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/"
217
+ // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/",
218
+ ElIconSetting: shallowRef(ElIconSetting)
147
219
  }
148
220
  },
149
221
  components: {
150
222
  MultiFlatmapVuer,
151
- }
223
+ },
152
224
  }
153
225
  </script>
154
226
 
155
227
  <style lang="scss">
156
- @import "~element-ui/packages/theme-chalk/src/autocomplete";
157
- @import "~element-ui/packages/theme-chalk/src/button";
158
- @import "~element-ui/packages/theme-chalk/src/col";
159
- @import "~element-ui/packages/theme-chalk/src/popover";
160
- @import "~element-ui/packages/theme-chalk/src/row";
228
+ @use 'element-plus/theme-chalk/src/autocomplete';
229
+ @use 'element-plus/theme-chalk/src/button';
230
+ @use 'element-plus/theme-chalk/src/col';
231
+ @use 'element-plus/theme-chalk/src/popover';
232
+ @use 'element-plus/theme-chalk/src/row';
161
233
 
162
234
  #app {
163
235
  font-family: 'Asap', 'Avenir', Helvetica, Arial, sans-serif;
@@ -165,22 +237,22 @@ export default {
165
237
  -moz-osx-font-smoothing: grayscale;
166
238
  text-align: center;
167
239
  color: #2c3e50;
168
- height:100%;
240
+ height: 100%;
169
241
  width: 100%;
170
- position:absolute;
242
+ position: absolute;
171
243
  }
172
244
 
173
245
  .maplibregl-ctrl-top-left .maplibregl-ctrl {
174
- margin-top:120px;
246
+ margin-top: 120px;
175
247
  }
176
248
 
177
249
  .search-box {
178
250
  margin-top: 2px;
179
- height:28px;
180
- ::v-deep .el-input__inner {
251
+ height: 28px;
252
+ :deep(.el-input__inner) {
181
253
  background-color: $background;
182
- height:28px;
183
- line-height:28px;
254
+ height: 28px;
255
+ line-height: 28px;
184
256
  border: 1px solid rgb(144, 147, 153);
185
257
  border-radius: 4px;
186
258
  &:focus {
@@ -189,9 +261,9 @@ export default {
189
261
  }
190
262
  }
191
263
 
192
- ::v-deep .autocomplete-popper {
193
- min-width:137px!important;
194
- width: auto!important;
264
+ :deep(.autocomplete-popper) {
265
+ min-width: 137px !important;
266
+ width: auto !important;
195
267
  }
196
268
 
197
269
  body {
@@ -199,14 +271,14 @@ body {
199
271
  }
200
272
 
201
273
  .maplibregl-ctrl-top-left .maplibregl-ctrl {
202
- margin-top:120px;
274
+ margin-top: 120px;
203
275
  }
204
276
 
205
- .popover{
206
- top:5px;
207
- right:calc( 50% - 20px);
208
- position:absolute;
209
- z-index:1000;
277
+ .popover {
278
+ top: 5px;
279
+ right: calc(50% - 20px);
280
+ position: absolute;
281
+ z-index: 1000;
210
282
  }
211
283
 
212
284
  .el-row {
@@ -216,13 +288,16 @@ body {
216
288
  }
217
289
  }
218
290
 
219
- .options-container{
291
+ .options-button {
292
+ z-index:100;
293
+ position: absolute;
294
+ }
220
295
 
296
+ .options-container {
221
297
  text-align: center;
222
298
  }
223
299
 
224
300
  .el-tabs__content {
225
- height:100%;
301
+ height: 100%;
226
302
  }
227
-
228
303
  </style>
@@ -1,7 +1,6 @@
1
- @import url('https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap');
2
1
 
3
2
  @import '_variables';
4
3
 
5
- /* icon font path, required */
4
+ @import url('https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap');
5
+
6
6
  $--color-primary: $app-primary-color !default;
7
- $--font-path: '~element-ui/lib/theme-chalk/fonts';