@abi-software/map-side-bar 2.18.0 → 2.19.1-demo.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 +6890 -6026
  5. package/dist/map-side-bar.umd.cjs +65 -62
  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 +89 -80
  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/CellCard.vue +992 -0
  20. package/src/components/CellCardExplorer.vue +879 -0
  21. package/src/components/ConnectivityCard.vue +22 -19
  22. package/src/components/ConnectivityExplorer.vue +109 -130
  23. package/src/components/ConnectivityInfo.vue +142 -171
  24. package/src/components/ContributorItem.vue +15 -11
  25. package/src/components/DatasetCard.vue +166 -201
  26. package/src/components/DatasetExplorer.vue +160 -201
  27. package/src/components/ImageGallery.vue +35 -36
  28. package/src/components/SearchFilters.vue +384 -407
  29. package/src/components/SearchHistory.vue +69 -103
  30. package/src/components/SideBar.vue +186 -94
  31. package/src/components/Tabs.vue +25 -21
  32. package/src/components/icons/IconOpenExternal.vue +23 -0
  33. package/src/components/index.js +3 -5
  34. package/src/components/species-map.js +7 -7
  35. package/src/components.d.ts +3 -0
  36. package/src/exampleConnectivityInput.js +310 -318
  37. package/src/main.js +6 -6
  38. package/src/mixins/S3Bucket.vue +10 -13
  39. package/src/utils/common.js +59 -0
  40. package/vite.config.js +62 -61
  41. 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.1-demo.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
@@ -15,6 +15,7 @@
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>
18
19
  </div>
19
20
  <SideBar
20
21
  :envVars="envVars"
@@ -26,6 +27,7 @@
26
27
  :connectivityEntry="connectivityEntry"
27
28
  :connectivityKnowledge="connectivityKnowledge"
28
29
  :showVisibilityFilter="true"
30
+ :showCellCards="showCellCards"
29
31
  @search-changed="searchChanged($event)"
30
32
  @hover-changed="hoverChanged($event)"
31
33
  @connectivity-hovered="onConnectivityHovered"
@@ -36,27 +38,24 @@
36
38
  </template>
37
39
 
38
40
  <script>
39
- /* eslint-disable no-alert, no-console */
40
41
  // 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
-
45
-
46
- const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
42
+ import SideBar from './components/SideBar.vue';
43
+ import EventBus from './components/EventBus.js';
44
+ import exampleConnectivityInput from './exampleConnectivityInput.js';
45
+ import { capitalise } from './utils/common.js';
47
46
 
48
47
  const flatmapQuery = (flatmapApi, sql) => {
49
48
  const data = { sql: sql };
50
49
  return fetch(`${flatmapApi}knowledge/query/`, {
51
- method: "POST",
50
+ method: 'POST',
52
51
  headers: {
53
- "Content-Type": "application/json",
52
+ 'Content-Type': 'application/json',
54
53
  },
55
54
  body: JSON.stringify(data),
56
55
  })
57
56
  .then((response) => response.json())
58
57
  .catch((error) => {
59
- console.error("Error:", error);
58
+ console.error('Error:', error);
60
59
  });
61
60
  };
62
61
 
@@ -113,31 +112,36 @@ export default {
113
112
  return {
114
113
  $annotator: undefined,
115
114
  userApiKey: undefined,
116
- }
115
+ };
117
116
  },
118
117
  data: function () {
119
118
  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
- }],
119
+ annotationEntry: [
120
+ {
121
+ featureId: 'epicardium',
122
+ resourceId:
123
+ 'https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json',
124
+ resource:
125
+ 'https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json',
126
+ },
127
+ ],
125
128
  sideBarVisibility: true,
126
129
  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,
130
+ API_LOCATION: import.meta.env.VITE_API_LOCATION,
131
+ ALGOLIA_KEY: import.meta.env.VITE_ALGOLIA_KEY,
132
+ ALGOLIA_ID: import.meta.env.VITE_ALGOLIA_ID,
133
+ ALGOLIA_INDEX: import.meta.env.VITE_ALGOLIA_INDEX,
134
+ PENNSIEVE_API_LOCATION: import.meta.env.VITE_PENNSIEVE_API_LOCATION,
135
+ BL_SERVER_URL: import.meta.env.VITE_BL_SERVER_URL,
136
+ ROOT_URL: import.meta.env.VITE_ROOT_URL,
134
137
  FLATMAPAPI_LOCATION: import.meta.env.VITE_FLATMAPAPI_LOCATION,
138
+ CELL_CARDS_API: import.meta.env.VITE_APP_CELL_CARDS_API,
135
139
  },
136
140
  connectivityEntry: [],
137
141
  createData: {
138
142
  toBeConfirmed: false,
139
143
  points: [],
140
- shape: "",
144
+ shape: '',
141
145
  x: 0,
142
146
  y: 0,
143
147
  },
@@ -148,7 +152,8 @@ export default {
148
152
  query: '',
149
153
  filter: [],
150
154
  target: [],
151
- }
155
+ showCellCards: false,
156
+ };
152
157
  },
153
158
  methods: {
154
159
  loadConnectivityKnowledge: async function () {
@@ -156,8 +161,8 @@ export default {
156
161
  where source="${this.sckanVersion}"
157
162
  order by source desc`;
158
163
  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));
164
+ const mappedData = response.values.map((x) => x[0]);
165
+ const knowledge = mappedData.map((x) => JSON.parse(x));
161
166
  this.flatmapKnowledge = knowledge.filter((item) => {
162
167
  if (item.connectivity?.length) return true;
163
168
  return false;
@@ -166,66 +171,65 @@ export default {
166
171
  },
167
172
  connectivityQueryFilter: async function (payload) {
168
173
  let results = this.flatmapKnowledge;
169
- if (payload.type === "query-update") {
174
+ if (payload.type === 'query-update') {
170
175
  if (this.query !== payload.value) this.target = [];
171
176
  this.query = payload.value;
172
- } else if (payload.type === "filter-update") {
177
+ } else if (payload.type === 'filter-update') {
173
178
  this.filter = payload.value;
174
179
  this.target = [];
175
- } else if (payload.type === "query-filter-update") {
180
+ } else if (payload.type === 'query-filter-update') {
176
181
  this.query = payload.query;
177
182
  this.filter = payload.filter;
178
183
  this.target = payload.data;
179
184
  }
180
185
  if (this.query) {
181
- let flag = "", order = [], paths = [];
186
+ let flag = '',
187
+ order = [],
188
+ paths = [];
182
189
  const labels = ['neuron type aacar 11'];
183
190
  flag = 'label';
184
191
  order = labels;
185
192
  if (labels.length === 1) {
186
- paths =['ilxtr:neuron-type-aacar-11', 'ilxtr:neuron-type-bolew-unbranched-11'];
193
+ paths = ['ilxtr:neuron-type-aacar-11', 'ilxtr:neuron-type-bolew-unbranched-11'];
187
194
  flag = 'id';
188
- order = [this.query, ...paths.filter(item => item !== this.query)];
195
+ order = [this.query, ...paths.filter((item) => item !== this.query)];
189
196
  }
190
- results = results.filter(item => paths.includes(item.id) || labels.includes(item.label));
197
+ results = results.filter((item) => paths.includes(item.id) || labels.includes(item.label));
191
198
  results.sort((a, b) => order.indexOf(a[flag]) - order.indexOf(b[flag]));
192
199
  }
193
200
  this.connectivityKnowledge = results;
194
201
  },
195
202
  hoverChanged: function (data) {
196
- console.log('hoverChanged', data)
203
+ console.log('hoverChanged', data);
197
204
  },
198
205
  searchChanged: function (data) {
199
206
  if (!this.flatmapKnowledge.length) {
200
207
  this.loadConnectivityKnowledge();
201
208
  }
202
209
  if (data.id === 2) {
203
- this.connectivityQueryFilter(data)
210
+ this.connectivityQueryFilter(data);
204
211
  }
205
212
  },
206
213
  // For connectivity input actions
207
214
  action: function (action) {
208
- console.log('action fired: ', action)
215
+ console.log('action fired: ', action);
209
216
  let facets = [];
210
217
  if (action.labels) {
211
218
  facets.push(
212
- ...action.labels.map(val => ({
219
+ ...action.labels.map((val) => ({
213
220
  facet: capitalise(val),
214
- term: "Anatomical structure",
215
- facetPropPath: "anatomy.organ.category.name",
216
- }))
221
+ term: 'Anatomical structure',
222
+ facetPropPath: 'anatomy.organ.category.name',
223
+ })),
217
224
  );
218
225
  }
219
226
  if (this.$refs.sideBar && facets?.length) {
220
- console.log('openSearch', facets)
221
- this.$refs.sideBar.openSearch(facets, "");
227
+ console.log('openSearch', facets);
228
+ this.$refs.sideBar.openSearch(facets, '');
222
229
  }
223
230
  },
224
231
  openSearch: function () {
225
- this.$refs.sideBar.openSearch(
226
- [],
227
- 'http://purl.obolibrary.org/obo/UBERON_0001103'
228
- )
232
+ this.$refs.sideBar.openSearch([], 'http://purl.obolibrary.org/obo/UBERON_0001103');
229
233
  },
230
234
  singleFacets: function () {
231
235
  this.$refs.sideBar.addFilter({
@@ -234,7 +238,7 @@ export default {
234
238
  term: 'Anatomical structure',
235
239
  facetPropPath: 'anatomy.organ.category.name',
236
240
  AND: true,
237
- })
241
+ });
238
242
  },
239
243
  addStomach: function () {
240
244
  this.$refs.sideBar.addFilter({
@@ -242,7 +246,7 @@ export default {
242
246
  term: 'Anatomical structure',
243
247
  facetPropPath: 'anatomy.organ.category.name',
244
248
  AND: true,
245
- })
249
+ });
246
250
  },
247
251
  addDRG: function () {
248
252
  this.$refs.sideBar.addFilter({
@@ -250,7 +254,7 @@ export default {
250
254
  term: 'Anatomical structure',
251
255
  facetPropPath: 'anatomy.organ.category.name',
252
256
  AND: true,
253
- })
257
+ });
254
258
  },
255
259
  addSubsubPath: function () {
256
260
  this.$refs.sideBar.addFilter({
@@ -258,7 +262,7 @@ export default {
258
262
  term: 'Anatomical structure',
259
263
  facetPropPath: 'anatomy.organ.category.name',
260
264
  AND: true,
261
- })
265
+ });
262
266
  },
263
267
  addInferiorVagus: function () {
264
268
  this.$refs.sideBar.addFilter({
@@ -266,7 +270,7 @@ export default {
266
270
  term: 'Anatomical structure',
267
271
  facetPropPath: 'anatomy.organ.category.name',
268
272
  AND: true,
269
- })
273
+ });
270
274
  },
271
275
  addInvalidTerm: function () {
272
276
  this.$refs.sideBar.addFilter({
@@ -274,7 +278,7 @@ export default {
274
278
  term: 'Anatomical structure',
275
279
  facetPropPath: 'anatomy.organ.name',
276
280
  AND: true,
277
- })
281
+ });
278
282
  },
279
283
  multiFacets: function () {
280
284
  this.$refs.sideBar.openSearch(
@@ -287,9 +291,9 @@ export default {
287
291
  {
288
292
  facet: 'Heart',
289
293
  term: 'Anatomical structure',
290
- facetSubPropPath: "anatomy.organ.name",
294
+ facetSubPropPath: 'anatomy.organ.name',
291
295
  facetPropPath: 'anatomy.organ.category.name',
292
- label :'Heart',
296
+ label: 'Heart',
293
297
  AND: true,
294
298
  },
295
299
  {
@@ -298,8 +302,8 @@ export default {
298
302
  facetPropPath: 'anatomy.organ.name',
299
303
  },
300
304
  ],
301
- ''
302
- )
305
+ '',
306
+ );
303
307
  },
304
308
  keywordSearch: function () {
305
309
  this.$refs.sideBar.addFilter({
@@ -309,7 +313,7 @@ export default {
309
313
  facetPropPath: 'item.keywords.keyword',
310
314
  term: 'Keywords',
311
315
  AND: true,
312
- })
316
+ });
313
317
  },
314
318
  markerFromFlatmap: function () {
315
319
  this.$refs.sideBar.openSearch([
@@ -318,62 +322,67 @@ export default {
318
322
  term: 'Keywords',
319
323
  facetPropPath: 'item.keywords.keyword',
320
324
  },
321
- ])
325
+ ]);
322
326
  },
323
327
  neuronSearch: function () {
324
- this.$refs.sideBar.openNeuronSearch('ilxtr:neuron-type-keast-10')
328
+ this.$refs.sideBar.openNeuronSearch('ilxtr:neuron-type-keast-10');
325
329
  },
326
330
  getFacets: async function () {
327
- let facets = await this.$refs.sideBar.getAlgoliaFacets()
328
- console.log('Algolia facets:', facets)
331
+ let facets = await this.$refs.sideBar.getAlgoliaFacets();
332
+ console.log('Algolia facets:', facets);
329
333
  },
330
- toggleCreateData : function() {
334
+ toggleCreateData: function () {
331
335
  if (!this.createDataSet) {
332
336
  this.createData = {
333
337
  drawingBox: false,
334
338
  toBeConfirmed: true,
335
339
  points: [[1.0, 1.0, 1.0]],
336
- shape: "Lines",
340
+ shape: 'Lines',
337
341
  x: 0,
338
342
  y: 0,
339
343
  editingIndex: -1,
340
344
  faceIndex: -1,
341
345
  toBeDeleted: false,
342
- }
343
- this.createDataSet = true
346
+ };
347
+ this.createDataSet = true;
344
348
  } else {
345
349
  this.createData = {
346
350
  toBeConfirmed: false,
347
351
  points: [],
348
- shape: "",
352
+ shape: '',
349
353
  x: 0,
350
354
  y: 0,
351
- }
352
- this.createDataSet = false
355
+ };
356
+ this.createDataSet = false;
353
357
  }
354
358
  },
355
- onConnectivityHovered: function(data) {
356
- console.log("onConnectivityHovered" , data)
359
+ onConnectivityHovered: function (data) {
360
+ console.log('onConnectivityHovered', data);
357
361
  },
358
362
  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)
363
+ const query = entry ? entry.query : 'ilxtr:neuron-type-aacar-5';
364
+ const filter = entry ? entry.filter : [];
365
+ this.$refs.sideBar.openConnectivitySearch(filter, query);
362
366
  },
363
367
  onConnectivityCollapseChange: function () {
364
- this.connectivityEntry = [...exampleConnectivityInput]
365
- }
368
+ this.connectivityEntry = [...exampleConnectivityInput];
369
+ },
370
+ showCellCardExplorer: function () {
371
+ this.showCellCards = true;
372
+ this.$refs.sideBar.tabClicked({ id: 4, type: 'cellCardExplorer' });
373
+ this.$refs.sideBar.setDrawerOpen(true);
374
+ },
366
375
  },
367
376
  mounted: async function () {
368
- console.log('mounted app')
377
+ console.log('mounted app');
369
378
  EventBus.on('contextUpdate', (payLoad) => {
370
- console.log('contextUpdate', payLoad)
379
+ console.log('contextUpdate', payLoad);
371
380
  });
372
381
  EventBus.on('datalink-clicked', (payLoad) => {
373
- console.log('datalink-clicked', payLoad)
382
+ console.log('datalink-clicked', payLoad);
374
383
  });
375
384
  },
376
- }
385
+ };
377
386
  </script>
378
387
 
379
388
  <style lang="scss">