@abi-software/map-side-bar 2.18.0 → 2.19.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 (36) hide show
  1. package/.postcssrc.json +5 -5
  2. package/README.md +8 -9
  3. package/cypress.config.js +6 -7
  4. package/dist/map-side-bar.js +5878 -5991
  5. package/dist/map-side-bar.umd.cjs +58 -58
  6. package/dist/style.css +1 -1
  7. package/eslint.config.js +44 -9
  8. package/package.json +10 -3
  9. package/reporter-config.json +1 -1
  10. package/src/App.vue +79 -78
  11. package/src/algolia/algolia.js +173 -167
  12. package/src/algolia/utils.js +34 -38
  13. package/src/assets/_variables.scss +12 -10
  14. package/src/assets/connectivity-explorer.scss +1 -1
  15. package/src/assets/fonts.scss +0 -1
  16. package/src/assets/searchPopover.scss +1 -2
  17. package/src/components/AnnotationTool.vue +9 -32
  18. package/src/components/BadgesGroup.vue +29 -32
  19. package/src/components/ConnectivityCard.vue +21 -18
  20. package/src/components/ConnectivityExplorer.vue +109 -130
  21. package/src/components/ConnectivityInfo.vue +143 -145
  22. package/src/components/ContributorItem.vue +15 -11
  23. package/src/components/DatasetCard.vue +166 -201
  24. package/src/components/DatasetExplorer.vue +160 -201
  25. package/src/components/ImageGallery.vue +35 -36
  26. package/src/components/SearchFilters.vue +377 -403
  27. package/src/components/SearchHistory.vue +61 -89
  28. package/src/components/SideBar.vue +83 -89
  29. package/src/components/Tabs.vue +10 -15
  30. package/src/components/index.js +3 -5
  31. package/src/components/species-map.js +7 -7
  32. package/src/exampleConnectivityInput.js +310 -318
  33. package/src/main.js +6 -6
  34. package/src/mixins/S3Bucket.vue +10 -13
  35. package/vite.config.js +62 -61
  36. package/vuese-generator.js +47 -55
package/eslint.config.js CHANGED
@@ -1,23 +1,58 @@
1
- import js from "@eslint/js";
2
- import vue from "eslint-plugin-vue";
3
- import globals from "globals";
1
+ import js from '@eslint/js';
2
+ import { includeIgnoreFile } from 'eslint/config';
3
+ import prettier from 'eslint-plugin-prettier';
4
+ import prettierConfig from 'eslint-config-prettier';
5
+ import cypress from 'eslint-plugin-cypress';
6
+ import vue from 'eslint-plugin-vue';
7
+ import globals from 'globals';
8
+ import { fileURLToPath } from 'node:url';
9
+
10
+ const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url));
4
11
 
5
12
  export default [
13
+ includeIgnoreFile(gitignorePath, { gitignoreResolution: true }),
6
14
  {
7
- ignores: ["dist/**", "docs/.vitepress/**", "docs/components/**"],
15
+ ignores: ['dist/**', 'docs/.vitepress/**', 'docs/components/**'],
8
16
  },
9
17
  js.configs.recommended,
10
- ...vue.configs["flat/essential"],
18
+ ...vue.configs['flat/essential'],
19
+ prettierConfig,
20
+ {
21
+ ...cypress.configs.recommended,
22
+ files: ['cypress/**/*.js'],
23
+ },
11
24
  {
12
- files: ["**/*.{js,vue}"],
25
+ files: ['**/*.{js,vue}'],
26
+ plugins: {
27
+ prettier,
28
+ },
13
29
  languageOptions: {
14
- ecmaVersion: "latest",
15
- sourceType: "module",
30
+ ecmaVersion: 'latest',
31
+ sourceType: 'module',
16
32
  globals: {
17
33
  ...globals.node,
18
34
  ...globals.browser,
19
35
  },
20
36
  },
21
- rules: {},
37
+ rules: {
38
+ 'prettier/prettier': [
39
+ 'error',
40
+ {
41
+ singleQuote: true,
42
+ trailingComma: 'all',
43
+ },
44
+ ],
45
+ 'arrow-body-style': 'off',
46
+ 'prefer-arrow-callback': 'off',
47
+ 'no-unused-vars': [
48
+ 'error',
49
+ {
50
+ varsIgnorePattern: '^_',
51
+ argsIgnorePattern: '^_',
52
+ caughtErrorsIgnorePattern: '^_',
53
+ },
54
+ ],
55
+ 'vue/multi-word-component-names': 'off',
56
+ },
22
57
  },
23
58
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "2.18.0",
3
+ "version": "2.19.0",
4
4
  "license": "Apache-2.0",
5
5
  "engines": {
6
6
  "node": "^24.20.0"
@@ -21,6 +21,8 @@
21
21
  "build-bundle": "vite build",
22
22
  "preview": "vite preview",
23
23
  "lint": "eslint .",
24
+ "format": "prettier --write .",
25
+ "format:check": "prettier --check .",
24
26
  "test": "cypress run --component",
25
27
  "cypress:open": "cypress open",
26
28
  "release:beta": "npm version prerelease --preid=beta; npm publish --tag beta",
@@ -48,7 +50,7 @@
48
50
  },
49
51
  "dependencies": {
50
52
  "@abi-software/gallery": "1.6.0",
51
- "@abi-software/map-utilities": "1.11.0",
53
+ "@abi-software/map-utilities": "1.12.0",
52
54
  "@abi-software/svg-sprite": "1.4.0",
53
55
  "@element-plus/icons-vue": "^2.3.2",
54
56
  "algoliasearch": "^4.27.0",
@@ -62,7 +64,6 @@
62
64
  "devDependencies": {
63
65
  "@eslint/js": "^10.0.1",
64
66
  "@vitejs/plugin-vue": "^6.0.8",
65
- "unplugin-vue-components": "^32.1.0",
66
67
  "@vue/compiler-sfc": "^3.5.41",
67
68
  "@vuese/markdown-render": "^2.11.3",
68
69
  "auto-changelog": "^2.6.0",
@@ -73,13 +74,19 @@
73
74
  "cypress-multi-reporters": "^2.0.5",
74
75
  "cypress-wait-until": "^3.0.2",
75
76
  "eslint": "^10.9.1",
77
+ "eslint-config-prettier": "^10.1.8",
78
+ "eslint-plugin-prettier": "^5.5.6",
79
+ "eslint-plugin-cypress": "^7.0.0",
76
80
  "eslint-plugin-vue": "^10.10.0",
77
81
  "globals": "^17.11.0",
78
82
  "mochawesome": "^8.0.1",
83
+ "prettier": "3.9.6",
79
84
  "raw-loader": "^4.0.2",
80
85
  "sass": "^1.103.1",
81
86
  "transform-loader": "^0.2.4",
82
87
  "typescript": "^7.0.2",
88
+ "unplugin-auto-import": "^21.1.0",
89
+ "unplugin-vue-components": "^32.1.0",
83
90
  "vite": "^8.2.1",
84
91
  "vitepress": "^1.6.4",
85
92
  "vue-custom-element": "^3.3.0",
@@ -7,4 +7,4 @@
7
7
  "html": true,
8
8
  "json": true
9
9
  }
10
- }
10
+ }
package/src/App.vue CHANGED
@@ -36,27 +36,25 @@
36
36
  </template>
37
37
 
38
38
  <script>
39
- /* eslint-disable no-alert, no-console */
40
39
  // optionally import default styles
41
- import SideBar from './components/SideBar.vue'
42
- import EventBus from './components/EventBus.js'
43
- import exampleConnectivityInput from './exampleConnectivityInput.js'
44
-
40
+ import SideBar from './components/SideBar.vue';
41
+ import EventBus from './components/EventBus.js';
42
+ import exampleConnectivityInput from './exampleConnectivityInput.js';
45
43
 
46
44
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
47
45
 
48
46
  const flatmapQuery = (flatmapApi, sql) => {
49
47
  const data = { sql: sql };
50
48
  return fetch(`${flatmapApi}knowledge/query/`, {
51
- method: "POST",
49
+ method: 'POST',
52
50
  headers: {
53
- "Content-Type": "application/json",
51
+ 'Content-Type': 'application/json',
54
52
  },
55
53
  body: JSON.stringify(data),
56
54
  })
57
55
  .then((response) => response.json())
58
56
  .catch((error) => {
59
- console.error("Error:", error);
57
+ console.error('Error:', error);
60
58
  });
61
59
  };
62
60
 
@@ -113,31 +111,35 @@ export default {
113
111
  return {
114
112
  $annotator: undefined,
115
113
  userApiKey: undefined,
116
- }
114
+ };
117
115
  },
118
116
  data: function () {
119
117
  return {
120
- annotationEntry: [{
121
- featureId: "epicardium",
122
- resourceId: "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json",
123
- "resource": "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json"
124
- }],
118
+ annotationEntry: [
119
+ {
120
+ featureId: 'epicardium',
121
+ resourceId:
122
+ 'https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json',
123
+ resource:
124
+ 'https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json',
125
+ },
126
+ ],
125
127
  sideBarVisibility: true,
126
128
  envVars: {
127
- API_LOCATION: import.meta.env.VITE_APP_API_LOCATION,
128
- ALGOLIA_KEY: import.meta.env.VITE_APP_ALGOLIA_KEY,
129
- ALGOLIA_ID: import.meta.env.VITE_APP_ALGOLIA_ID,
130
- ALGOLIA_INDEX: import.meta.env.VITE_APP_ALGOLIA_INDEX,
131
- PENNSIEVE_API_LOCATION: import.meta.env.VITE_APP_PENNSIEVE_API_LOCATION,
132
- BL_SERVER_URL: import.meta.env.VITE_APP_BL_SERVER_URL,
133
- ROOT_URL: import.meta.env.VITE_APP_ROOT_URL,
129
+ API_LOCATION: import.meta.env.VITE_API_LOCATION,
130
+ ALGOLIA_KEY: import.meta.env.VITE_ALGOLIA_KEY,
131
+ ALGOLIA_ID: import.meta.env.VITE_ALGOLIA_ID,
132
+ ALGOLIA_INDEX: import.meta.env.VITE_ALGOLIA_INDEX,
133
+ PENNSIEVE_API_LOCATION: import.meta.env.VITE_PENNSIEVE_API_LOCATION,
134
+ BL_SERVER_URL: import.meta.env.VITE_BL_SERVER_URL,
135
+ ROOT_URL: import.meta.env.VITE_ROOT_URL,
134
136
  FLATMAPAPI_LOCATION: import.meta.env.VITE_FLATMAPAPI_LOCATION,
135
137
  },
136
138
  connectivityEntry: [],
137
139
  createData: {
138
140
  toBeConfirmed: false,
139
141
  points: [],
140
- shape: "",
142
+ shape: '',
141
143
  x: 0,
142
144
  y: 0,
143
145
  },
@@ -148,7 +150,7 @@ export default {
148
150
  query: '',
149
151
  filter: [],
150
152
  target: [],
151
- }
153
+ };
152
154
  },
153
155
  methods: {
154
156
  loadConnectivityKnowledge: async function () {
@@ -156,8 +158,8 @@ export default {
156
158
  where source="${this.sckanVersion}"
157
159
  order by source desc`;
158
160
  const response = await flatmapQuery(this.envVars.FLATMAPAPI_LOCATION, sql);
159
- const mappedData = response.values.map(x => x[0]);
160
- const knowledge = mappedData.map(x => JSON.parse(x));
161
+ const mappedData = response.values.map((x) => x[0]);
162
+ const knowledge = mappedData.map((x) => JSON.parse(x));
161
163
  this.flatmapKnowledge = knowledge.filter((item) => {
162
164
  if (item.connectivity?.length) return true;
163
165
  return false;
@@ -166,66 +168,65 @@ export default {
166
168
  },
167
169
  connectivityQueryFilter: async function (payload) {
168
170
  let results = this.flatmapKnowledge;
169
- if (payload.type === "query-update") {
171
+ if (payload.type === 'query-update') {
170
172
  if (this.query !== payload.value) this.target = [];
171
173
  this.query = payload.value;
172
- } else if (payload.type === "filter-update") {
174
+ } else if (payload.type === 'filter-update') {
173
175
  this.filter = payload.value;
174
176
  this.target = [];
175
- } else if (payload.type === "query-filter-update") {
177
+ } else if (payload.type === 'query-filter-update') {
176
178
  this.query = payload.query;
177
179
  this.filter = payload.filter;
178
180
  this.target = payload.data;
179
181
  }
180
182
  if (this.query) {
181
- let flag = "", order = [], paths = [];
183
+ let flag = '',
184
+ order = [],
185
+ paths = [];
182
186
  const labels = ['neuron type aacar 11'];
183
187
  flag = 'label';
184
188
  order = labels;
185
189
  if (labels.length === 1) {
186
- paths =['ilxtr:neuron-type-aacar-11', 'ilxtr:neuron-type-bolew-unbranched-11'];
190
+ paths = ['ilxtr:neuron-type-aacar-11', 'ilxtr:neuron-type-bolew-unbranched-11'];
187
191
  flag = 'id';
188
- order = [this.query, ...paths.filter(item => item !== this.query)];
192
+ order = [this.query, ...paths.filter((item) => item !== this.query)];
189
193
  }
190
- results = results.filter(item => paths.includes(item.id) || labels.includes(item.label));
194
+ results = results.filter((item) => paths.includes(item.id) || labels.includes(item.label));
191
195
  results.sort((a, b) => order.indexOf(a[flag]) - order.indexOf(b[flag]));
192
196
  }
193
197
  this.connectivityKnowledge = results;
194
198
  },
195
199
  hoverChanged: function (data) {
196
- console.log('hoverChanged', data)
200
+ console.log('hoverChanged', data);
197
201
  },
198
202
  searchChanged: function (data) {
199
203
  if (!this.flatmapKnowledge.length) {
200
204
  this.loadConnectivityKnowledge();
201
205
  }
202
206
  if (data.id === 2) {
203
- this.connectivityQueryFilter(data)
207
+ this.connectivityQueryFilter(data);
204
208
  }
205
209
  },
206
210
  // For connectivity input actions
207
211
  action: function (action) {
208
- console.log('action fired: ', action)
212
+ console.log('action fired: ', action);
209
213
  let facets = [];
210
214
  if (action.labels) {
211
215
  facets.push(
212
- ...action.labels.map(val => ({
216
+ ...action.labels.map((val) => ({
213
217
  facet: capitalise(val),
214
- term: "Anatomical structure",
215
- facetPropPath: "anatomy.organ.category.name",
216
- }))
218
+ term: 'Anatomical structure',
219
+ facetPropPath: 'anatomy.organ.category.name',
220
+ })),
217
221
  );
218
222
  }
219
223
  if (this.$refs.sideBar && facets?.length) {
220
- console.log('openSearch', facets)
221
- this.$refs.sideBar.openSearch(facets, "");
224
+ console.log('openSearch', facets);
225
+ this.$refs.sideBar.openSearch(facets, '');
222
226
  }
223
227
  },
224
228
  openSearch: function () {
225
- this.$refs.sideBar.openSearch(
226
- [],
227
- 'http://purl.obolibrary.org/obo/UBERON_0001103'
228
- )
229
+ this.$refs.sideBar.openSearch([], 'http://purl.obolibrary.org/obo/UBERON_0001103');
229
230
  },
230
231
  singleFacets: function () {
231
232
  this.$refs.sideBar.addFilter({
@@ -234,7 +235,7 @@ export default {
234
235
  term: 'Anatomical structure',
235
236
  facetPropPath: 'anatomy.organ.category.name',
236
237
  AND: true,
237
- })
238
+ });
238
239
  },
239
240
  addStomach: function () {
240
241
  this.$refs.sideBar.addFilter({
@@ -242,7 +243,7 @@ export default {
242
243
  term: 'Anatomical structure',
243
244
  facetPropPath: 'anatomy.organ.category.name',
244
245
  AND: true,
245
- })
246
+ });
246
247
  },
247
248
  addDRG: function () {
248
249
  this.$refs.sideBar.addFilter({
@@ -250,7 +251,7 @@ export default {
250
251
  term: 'Anatomical structure',
251
252
  facetPropPath: 'anatomy.organ.category.name',
252
253
  AND: true,
253
- })
254
+ });
254
255
  },
255
256
  addSubsubPath: function () {
256
257
  this.$refs.sideBar.addFilter({
@@ -258,7 +259,7 @@ export default {
258
259
  term: 'Anatomical structure',
259
260
  facetPropPath: 'anatomy.organ.category.name',
260
261
  AND: true,
261
- })
262
+ });
262
263
  },
263
264
  addInferiorVagus: function () {
264
265
  this.$refs.sideBar.addFilter({
@@ -266,7 +267,7 @@ export default {
266
267
  term: 'Anatomical structure',
267
268
  facetPropPath: 'anatomy.organ.category.name',
268
269
  AND: true,
269
- })
270
+ });
270
271
  },
271
272
  addInvalidTerm: function () {
272
273
  this.$refs.sideBar.addFilter({
@@ -274,7 +275,7 @@ export default {
274
275
  term: 'Anatomical structure',
275
276
  facetPropPath: 'anatomy.organ.name',
276
277
  AND: true,
277
- })
278
+ });
278
279
  },
279
280
  multiFacets: function () {
280
281
  this.$refs.sideBar.openSearch(
@@ -287,9 +288,9 @@ export default {
287
288
  {
288
289
  facet: 'Heart',
289
290
  term: 'Anatomical structure',
290
- facetSubPropPath: "anatomy.organ.name",
291
+ facetSubPropPath: 'anatomy.organ.name',
291
292
  facetPropPath: 'anatomy.organ.category.name',
292
- label :'Heart',
293
+ label: 'Heart',
293
294
  AND: true,
294
295
  },
295
296
  {
@@ -298,8 +299,8 @@ export default {
298
299
  facetPropPath: 'anatomy.organ.name',
299
300
  },
300
301
  ],
301
- ''
302
- )
302
+ '',
303
+ );
303
304
  },
304
305
  keywordSearch: function () {
305
306
  this.$refs.sideBar.addFilter({
@@ -309,7 +310,7 @@ export default {
309
310
  facetPropPath: 'item.keywords.keyword',
310
311
  term: 'Keywords',
311
312
  AND: true,
312
- })
313
+ });
313
314
  },
314
315
  markerFromFlatmap: function () {
315
316
  this.$refs.sideBar.openSearch([
@@ -318,62 +319,62 @@ export default {
318
319
  term: 'Keywords',
319
320
  facetPropPath: 'item.keywords.keyword',
320
321
  },
321
- ])
322
+ ]);
322
323
  },
323
324
  neuronSearch: function () {
324
- this.$refs.sideBar.openNeuronSearch('ilxtr:neuron-type-keast-10')
325
+ this.$refs.sideBar.openNeuronSearch('ilxtr:neuron-type-keast-10');
325
326
  },
326
327
  getFacets: async function () {
327
- let facets = await this.$refs.sideBar.getAlgoliaFacets()
328
- console.log('Algolia facets:', facets)
328
+ let facets = await this.$refs.sideBar.getAlgoliaFacets();
329
+ console.log('Algolia facets:', facets);
329
330
  },
330
- toggleCreateData : function() {
331
+ toggleCreateData: function () {
331
332
  if (!this.createDataSet) {
332
333
  this.createData = {
333
334
  drawingBox: false,
334
335
  toBeConfirmed: true,
335
336
  points: [[1.0, 1.0, 1.0]],
336
- shape: "Lines",
337
+ shape: 'Lines',
337
338
  x: 0,
338
339
  y: 0,
339
340
  editingIndex: -1,
340
341
  faceIndex: -1,
341
342
  toBeDeleted: false,
342
- }
343
- this.createDataSet = true
343
+ };
344
+ this.createDataSet = true;
344
345
  } else {
345
346
  this.createData = {
346
347
  toBeConfirmed: false,
347
348
  points: [],
348
- shape: "",
349
+ shape: '',
349
350
  x: 0,
350
351
  y: 0,
351
- }
352
- this.createDataSet = false
352
+ };
353
+ this.createDataSet = false;
353
354
  }
354
355
  },
355
- onConnectivityHovered: function(data) {
356
- console.log("onConnectivityHovered" , data)
356
+ onConnectivityHovered: function (data) {
357
+ console.log('onConnectivityHovered', data);
357
358
  },
358
359
  openConnectivitySearch: function (entry) {
359
- const query = entry ? entry.query : 'ilxtr:neuron-type-aacar-5'
360
- const filter = entry ? entry.filter : []
361
- this.$refs.sideBar.openConnectivitySearch(filter, query)
360
+ const query = entry ? entry.query : 'ilxtr:neuron-type-aacar-5';
361
+ const filter = entry ? entry.filter : [];
362
+ this.$refs.sideBar.openConnectivitySearch(filter, query);
362
363
  },
363
364
  onConnectivityCollapseChange: function () {
364
- this.connectivityEntry = [...exampleConnectivityInput]
365
- }
365
+ this.connectivityEntry = [...exampleConnectivityInput];
366
+ },
366
367
  },
367
368
  mounted: async function () {
368
- console.log('mounted app')
369
+ console.log('mounted app');
369
370
  EventBus.on('contextUpdate', (payLoad) => {
370
- console.log('contextUpdate', payLoad)
371
+ console.log('contextUpdate', payLoad);
371
372
  });
372
373
  EventBus.on('datalink-clicked', (payLoad) => {
373
- console.log('datalink-clicked', payLoad)
374
+ console.log('datalink-clicked', payLoad);
374
375
  });
375
376
  },
376
- }
377
+ };
377
378
  </script>
378
379
 
379
380
  <style lang="scss">