@abi-software/map-side-bar 2.17.1-demo.1 → 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 (41) 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 +5906 -7001
  5. package/dist/map-side-bar.umd.cjs +62 -65
  6. package/dist/style.css +1 -1
  7. package/eslint.config.js +44 -9
  8. package/package.json +12 -5
  9. package/reporter-config.json +1 -1
  10. package/src/App.vue +80 -86
  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 +22 -19
  20. package/src/components/ConnectivityExplorer.vue +107 -128
  21. package/src/components/ConnectivityInfo.vue +169 -128
  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 +381 -408
  27. package/src/components/SearchHistory.vue +75 -91
  28. package/src/components/SideBar.vue +86 -193
  29. package/src/components/Tabs.vue +16 -30
  30. package/src/components/index.js +3 -5
  31. package/src/components/species-map.js +7 -7
  32. package/src/components.d.ts +0 -3
  33. package/src/exampleConnectivityInput.js +310 -318
  34. package/src/main.js +6 -6
  35. package/src/mixins/S3Bucket.vue +10 -13
  36. package/vite.config.js +62 -61
  37. package/vuese-generator.js +47 -55
  38. package/src/components/CellCard.vue +0 -994
  39. package/src/components/CellCardExplorer.vue +0 -882
  40. package/src/components/icons/IconOpenExternal.vue +0 -28
  41. package/src/utils/common.js +0 -71
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.17.1-demo.1",
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",
@@ -47,9 +49,9 @@
47
49
  "./src/*": "./src/*"
48
50
  },
49
51
  "dependencies": {
50
- "@abi-software/gallery": "1.4.0",
51
- "@abi-software/map-utilities": "1.10.0",
52
- "@abi-software/svg-sprite": "1.2.0",
52
+ "@abi-software/gallery": "1.6.0",
53
+ "@abi-software/map-utilities": "1.12.0",
54
+ "@abi-software/svg-sprite": "1.4.0",
53
55
  "@element-plus/icons-vue": "^2.3.2",
54
56
  "algoliasearch": "^4.27.0",
55
57
  "element-plus": "^2.14.5",
@@ -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
@@ -15,7 +15,6 @@
15
15
  <el-button @click="getFacets">Get facets</el-button>
16
16
  <el-button @click="toggleCreateData">Create Data/Annotation</el-button>
17
17
  <el-button @click="openConnectivitySearch()">Connectivity Search</el-button>
18
- <el-button @click="showCellCardExplorer()">Show Cell Card Explorer</el-button>
19
18
  </div>
20
19
  <SideBar
21
20
  :envVars="envVars"
@@ -27,7 +26,6 @@
27
26
  :connectivityEntry="connectivityEntry"
28
27
  :connectivityKnowledge="connectivityKnowledge"
29
28
  :showVisibilityFilter="true"
30
- :showCellCards="showCellCards"
31
29
  @search-changed="searchChanged($event)"
32
30
  @hover-changed="hoverChanged($event)"
33
31
  @connectivity-hovered="onConnectivityHovered"
@@ -38,25 +36,25 @@
38
36
  </template>
39
37
 
40
38
  <script>
41
- /* eslint-disable no-alert, no-console */
42
39
  // optionally import default styles
43
- import SideBar from './components/SideBar.vue'
44
- import EventBus from './components/EventBus.js'
45
- import exampleConnectivityInput from './exampleConnectivityInput.js'
46
- import { capitalise } from './utils/common.js'
40
+ import SideBar from './components/SideBar.vue';
41
+ import EventBus from './components/EventBus.js';
42
+ import exampleConnectivityInput from './exampleConnectivityInput.js';
43
+
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,32 +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
- CELL_CARDS_API: import.meta.env.VITE_APP_CELL_CARDS_API,
136
137
  },
137
138
  connectivityEntry: [],
138
139
  createData: {
139
140
  toBeConfirmed: false,
140
141
  points: [],
141
- shape: "",
142
+ shape: '',
142
143
  x: 0,
143
144
  y: 0,
144
145
  },
@@ -149,8 +150,7 @@ export default {
149
150
  query: '',
150
151
  filter: [],
151
152
  target: [],
152
- showCellCards: false,
153
- }
153
+ };
154
154
  },
155
155
  methods: {
156
156
  loadConnectivityKnowledge: async function () {
@@ -158,8 +158,8 @@ export default {
158
158
  where source="${this.sckanVersion}"
159
159
  order by source desc`;
160
160
  const response = await flatmapQuery(this.envVars.FLATMAPAPI_LOCATION, sql);
161
- const mappedData = response.values.map(x => x[0]);
162
- 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));
163
163
  this.flatmapKnowledge = knowledge.filter((item) => {
164
164
  if (item.connectivity?.length) return true;
165
165
  return false;
@@ -168,66 +168,65 @@ export default {
168
168
  },
169
169
  connectivityQueryFilter: async function (payload) {
170
170
  let results = this.flatmapKnowledge;
171
- if (payload.type === "query-update") {
171
+ if (payload.type === 'query-update') {
172
172
  if (this.query !== payload.value) this.target = [];
173
173
  this.query = payload.value;
174
- } else if (payload.type === "filter-update") {
174
+ } else if (payload.type === 'filter-update') {
175
175
  this.filter = payload.value;
176
176
  this.target = [];
177
- } else if (payload.type === "query-filter-update") {
177
+ } else if (payload.type === 'query-filter-update') {
178
178
  this.query = payload.query;
179
179
  this.filter = payload.filter;
180
180
  this.target = payload.data;
181
181
  }
182
182
  if (this.query) {
183
- let flag = "", order = [], paths = [];
183
+ let flag = '',
184
+ order = [],
185
+ paths = [];
184
186
  const labels = ['neuron type aacar 11'];
185
187
  flag = 'label';
186
188
  order = labels;
187
189
  if (labels.length === 1) {
188
- 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'];
189
191
  flag = 'id';
190
- order = [this.query, ...paths.filter(item => item !== this.query)];
192
+ order = [this.query, ...paths.filter((item) => item !== this.query)];
191
193
  }
192
- 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));
193
195
  results.sort((a, b) => order.indexOf(a[flag]) - order.indexOf(b[flag]));
194
196
  }
195
197
  this.connectivityKnowledge = results;
196
198
  },
197
199
  hoverChanged: function (data) {
198
- console.log('hoverChanged', data)
200
+ console.log('hoverChanged', data);
199
201
  },
200
202
  searchChanged: function (data) {
201
203
  if (!this.flatmapKnowledge.length) {
202
204
  this.loadConnectivityKnowledge();
203
205
  }
204
206
  if (data.id === 2) {
205
- this.connectivityQueryFilter(data)
207
+ this.connectivityQueryFilter(data);
206
208
  }
207
209
  },
208
210
  // For connectivity input actions
209
211
  action: function (action) {
210
- console.log('action fired: ', action)
212
+ console.log('action fired: ', action);
211
213
  let facets = [];
212
214
  if (action.labels) {
213
215
  facets.push(
214
- ...action.labels.map(val => ({
216
+ ...action.labels.map((val) => ({
215
217
  facet: capitalise(val),
216
- term: "Anatomical structure",
217
- facetPropPath: "anatomy.organ.category.name",
218
- }))
218
+ term: 'Anatomical structure',
219
+ facetPropPath: 'anatomy.organ.category.name',
220
+ })),
219
221
  );
220
222
  }
221
223
  if (this.$refs.sideBar && facets?.length) {
222
- console.log('openSearch', facets)
223
- this.$refs.sideBar.openSearch(facets, "");
224
+ console.log('openSearch', facets);
225
+ this.$refs.sideBar.openSearch(facets, '');
224
226
  }
225
227
  },
226
228
  openSearch: function () {
227
- this.$refs.sideBar.openSearch(
228
- [],
229
- 'http://purl.obolibrary.org/obo/UBERON_0001103'
230
- )
229
+ this.$refs.sideBar.openSearch([], 'http://purl.obolibrary.org/obo/UBERON_0001103');
231
230
  },
232
231
  singleFacets: function () {
233
232
  this.$refs.sideBar.addFilter({
@@ -236,7 +235,7 @@ export default {
236
235
  term: 'Anatomical structure',
237
236
  facetPropPath: 'anatomy.organ.category.name',
238
237
  AND: true,
239
- })
238
+ });
240
239
  },
241
240
  addStomach: function () {
242
241
  this.$refs.sideBar.addFilter({
@@ -244,7 +243,7 @@ export default {
244
243
  term: 'Anatomical structure',
245
244
  facetPropPath: 'anatomy.organ.category.name',
246
245
  AND: true,
247
- })
246
+ });
248
247
  },
249
248
  addDRG: function () {
250
249
  this.$refs.sideBar.addFilter({
@@ -252,7 +251,7 @@ export default {
252
251
  term: 'Anatomical structure',
253
252
  facetPropPath: 'anatomy.organ.category.name',
254
253
  AND: true,
255
- })
254
+ });
256
255
  },
257
256
  addSubsubPath: function () {
258
257
  this.$refs.sideBar.addFilter({
@@ -260,7 +259,7 @@ export default {
260
259
  term: 'Anatomical structure',
261
260
  facetPropPath: 'anatomy.organ.category.name',
262
261
  AND: true,
263
- })
262
+ });
264
263
  },
265
264
  addInferiorVagus: function () {
266
265
  this.$refs.sideBar.addFilter({
@@ -268,7 +267,7 @@ export default {
268
267
  term: 'Anatomical structure',
269
268
  facetPropPath: 'anatomy.organ.category.name',
270
269
  AND: true,
271
- })
270
+ });
272
271
  },
273
272
  addInvalidTerm: function () {
274
273
  this.$refs.sideBar.addFilter({
@@ -276,7 +275,7 @@ export default {
276
275
  term: 'Anatomical structure',
277
276
  facetPropPath: 'anatomy.organ.name',
278
277
  AND: true,
279
- })
278
+ });
280
279
  },
281
280
  multiFacets: function () {
282
281
  this.$refs.sideBar.openSearch(
@@ -289,9 +288,9 @@ export default {
289
288
  {
290
289
  facet: 'Heart',
291
290
  term: 'Anatomical structure',
292
- facetSubPropPath: "anatomy.organ.name",
291
+ facetSubPropPath: 'anatomy.organ.name',
293
292
  facetPropPath: 'anatomy.organ.category.name',
294
- label :'Heart',
293
+ label: 'Heart',
295
294
  AND: true,
296
295
  },
297
296
  {
@@ -300,8 +299,8 @@ export default {
300
299
  facetPropPath: 'anatomy.organ.name',
301
300
  },
302
301
  ],
303
- ''
304
- )
302
+ '',
303
+ );
305
304
  },
306
305
  keywordSearch: function () {
307
306
  this.$refs.sideBar.addFilter({
@@ -311,7 +310,7 @@ export default {
311
310
  facetPropPath: 'item.keywords.keyword',
312
311
  term: 'Keywords',
313
312
  AND: true,
314
- })
313
+ });
315
314
  },
316
315
  markerFromFlatmap: function () {
317
316
  this.$refs.sideBar.openSearch([
@@ -320,67 +319,62 @@ export default {
320
319
  term: 'Keywords',
321
320
  facetPropPath: 'item.keywords.keyword',
322
321
  },
323
- ])
322
+ ]);
324
323
  },
325
324
  neuronSearch: function () {
326
- this.$refs.sideBar.openNeuronSearch('ilxtr:neuron-type-keast-10')
325
+ this.$refs.sideBar.openNeuronSearch('ilxtr:neuron-type-keast-10');
327
326
  },
328
327
  getFacets: async function () {
329
- let facets = await this.$refs.sideBar.getAlgoliaFacets()
330
- console.log('Algolia facets:', facets)
328
+ let facets = await this.$refs.sideBar.getAlgoliaFacets();
329
+ console.log('Algolia facets:', facets);
331
330
  },
332
- toggleCreateData : function() {
331
+ toggleCreateData: function () {
333
332
  if (!this.createDataSet) {
334
333
  this.createData = {
335
334
  drawingBox: false,
336
335
  toBeConfirmed: true,
337
336
  points: [[1.0, 1.0, 1.0]],
338
- shape: "Lines",
337
+ shape: 'Lines',
339
338
  x: 0,
340
339
  y: 0,
341
340
  editingIndex: -1,
342
341
  faceIndex: -1,
343
342
  toBeDeleted: false,
344
- }
345
- this.createDataSet = true
343
+ };
344
+ this.createDataSet = true;
346
345
  } else {
347
346
  this.createData = {
348
347
  toBeConfirmed: false,
349
348
  points: [],
350
- shape: "",
349
+ shape: '',
351
350
  x: 0,
352
351
  y: 0,
353
- }
354
- this.createDataSet = false
352
+ };
353
+ this.createDataSet = false;
355
354
  }
356
355
  },
357
- onConnectivityHovered: function(data) {
358
- console.log("onConnectivityHovered" , data)
356
+ onConnectivityHovered: function (data) {
357
+ console.log('onConnectivityHovered', data);
359
358
  },
360
359
  openConnectivitySearch: function (entry) {
361
- const query = entry ? entry.query : 'ilxtr:neuron-type-aacar-5'
362
- const filter = entry ? entry.filter : []
363
- 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);
364
363
  },
365
364
  onConnectivityCollapseChange: function () {
366
- this.connectivityEntry = [...exampleConnectivityInput]
367
- },
368
- showCellCardExplorer: function () {
369
- this.showCellCards = true;
370
- this.$refs.sideBar.tabClicked({ id: 4, type: 'cellCardExplorer' });
371
- this.$refs.sideBar.setDrawerOpen(true);
365
+ this.connectivityEntry = [...exampleConnectivityInput];
372
366
  },
373
367
  },
374
368
  mounted: async function () {
375
- console.log('mounted app')
369
+ console.log('mounted app');
376
370
  EventBus.on('contextUpdate', (payLoad) => {
377
- console.log('contextUpdate', payLoad)
371
+ console.log('contextUpdate', payLoad);
378
372
  });
379
373
  EventBus.on('datalink-clicked', (payLoad) => {
380
- console.log('datalink-clicked', payLoad)
374
+ console.log('datalink-clicked', payLoad);
381
375
  });
382
376
  },
383
- }
377
+ };
384
378
  </script>
385
379
 
386
380
  <style lang="scss">