@abi-software/map-side-bar 2.4.2-beta.0 → 2.4.2

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/map-side-bar",
3
- "version": "2.4.2-beta.0",
3
+ "version": "2.4.2",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -38,23 +38,22 @@
38
38
  "./src/*": "./src/*"
39
39
  },
40
40
  "dependencies": {
41
- "@abi-software/gallery": "^1.1.1",
42
- "@abi-software/map-utilities": "^1.1.0",
43
- "@abi-software/svg-sprite": "^1.0.0",
41
+ "@abi-software/gallery": "^1.1.2",
42
+ "@abi-software/map-utilities": "^1.1.2",
43
+ "@abi-software/svg-sprite": "^1.0.1",
44
44
  "@element-plus/icons-vue": "^2.3.1",
45
45
  "algoliasearch": "^4.10.5",
46
- "element-plus": "^2.5.3",
46
+ "element-plus": "2.8.4",
47
47
  "marked": "^4.1.1",
48
48
  "mitt": "^3.0.1",
49
49
  "unplugin-vue-components": "^0.26.0",
50
- "vue": "^3.3.13",
50
+ "vue": "^3.4.21",
51
51
  "xss": "^1.0.14"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@vitejs/plugin-vue": "^4.6.2",
55
55
  "@vue/compiler-sfc": "^3.3.13",
56
56
  "@vuese/markdown-render": "^2.11.3",
57
- "@vuese/parser": "^2.10.3",
58
57
  "auto-changelog": "^2.4.0",
59
58
  "autoprefixer": "^10.4.17",
60
59
  "chokidar": "^3.6.0",
@@ -64,7 +63,6 @@
64
63
  "cypress-wait-until": "^3.0.1",
65
64
  "eslint": "^8.56.0",
66
65
  "eslint-plugin-vue": "^9.19.2",
67
- "file-loader": "^5.0.2",
68
66
  "mochawesome": "^7.1.3",
69
67
  "raw-loader": "^0.5.1",
70
68
  "sass": "^1.70.0",
@@ -73,6 +71,6 @@
73
71
  "vite": "^5.0.10",
74
72
  "vitepress": "^1.0.2",
75
73
  "vue-custom-element": "^3.3.0",
76
- "webpack-node-externals": "^2.5.2"
74
+ "vue-docgen-api": "^4.79.2"
77
75
  }
78
76
  }
package/src/App.vue CHANGED
@@ -14,7 +14,6 @@
14
14
  <el-button @click="neuronSearch">open neuron search</el-button>
15
15
  <el-button @click="keywordSearch">keyword search</el-button>
16
16
  <el-button @click="getFacets">Get facets</el-button>
17
- <el-button @click="showImages">Show Images</el-button>
18
17
  </div>
19
18
  <SideBar
20
19
  :envVars="envVars"
@@ -24,13 +23,10 @@
24
23
  :tabs="tabs"
25
24
  :activeTabId="activeId"
26
25
  :connectivityInfo="connectivityInput"
27
- :imageThumbnails="imageThumbnails"
28
26
  @tabClicked="tabClicked"
29
27
  @search-changed="searchChanged($event)"
30
28
  @hover-changed="hoverChanged($event)"
31
29
  @actionClick="action"
32
- @connectivity-info-close="onConnectivityInfoClose"
33
- @image-thumbnail-close="onImageThumbnailClose"
34
30
  />
35
31
  </div>
36
32
  </template>
@@ -41,7 +37,6 @@
41
37
  import SideBar from './components/SideBar.vue'
42
38
  import EventBus from './components/EventBus.js'
43
39
  import exampleConnectivityInput from './exampleConnectivityInput.js'
44
- import imageThumbnails from './data/images.json';
45
40
 
46
41
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
47
42
 
@@ -106,11 +101,7 @@ export default {
106
101
  data: function () {
107
102
  return {
108
103
  contextArray: [null, null],
109
- tabArray: [
110
- { title: 'Flatmap', id: 1, type: 'search'},
111
- { title: 'Connectivity', id: 2, type: 'connectivity' },
112
- { title: 'Images', id: 3, type: 'images' },
113
- ],
104
+ tabArray: [{ title: 'Flatmap', id: 1, type: 'search'}, { title: 'Connectivity', id: 2, type: 'connectivity' }],
114
105
  sideBarVisibility: true,
115
106
  envVars: {
116
107
  API_LOCATION: import.meta.env.VITE_APP_API_LOCATION,
@@ -123,7 +114,6 @@ export default {
123
114
  ROOT_URL: import.meta.env.VITE_APP_ROOT_URL,
124
115
  },
125
116
  connectivityInput: exampleConnectivityInput,
126
- imageThumbnails: imageThumbnails,
127
117
  activeId: 1,
128
118
  }
129
119
  },
@@ -234,18 +224,6 @@ export default {
234
224
  let facets = await this.$refs.sideBar.getAlgoliaFacets()
235
225
  console.log('Algolia facets:', facets)
236
226
  },
237
- showImages: function () {
238
- if (this.$refs.sideBar) {
239
- this.tabClicked({id: 3, type: 'images'});
240
- this.$refs.sideBar.setDrawerOpen(true);
241
- }
242
- },
243
- onConnectivityInfoClose: function () {
244
- console.log('connectivity-info-close');
245
- },
246
- onImageThumbnailClose: function () {
247
- console.log('image-thumbnail-close');
248
- },
249
227
  },
250
228
  mounted: function () {
251
229
  console.log('mounted app')
@@ -22,11 +22,9 @@
22
22
  </div>
23
23
  <div class="sidebar-container">
24
24
  <Tabs
25
- v-if="tabs.length > 1 && (connectivityInfo || imageThumbnails.length)"
25
+ v-if="tabs.length > 1 && connectivityInfo"
26
26
  :tabTitles="tabs"
27
27
  :activeId="activeTabId"
28
- :hasConnectivityInfo="!!connectivityInfo"
29
- :hasImageThumbnails="!!imageThumbnails.length"
30
28
  @titleClicked="tabClicked"
31
29
  @tab-close="tabClose"
32
30
  />
@@ -41,13 +39,6 @@
41
39
  @show-connectivity="showConnectivity"
42
40
  />
43
41
  </template>
44
- <template v-else-if="tab.type === 'images'">
45
- <ImageThumbnails
46
- v-if="imageThumbnails.length"
47
- v-show="tab.id === activeTabId"
48
- :imageThumbnails="imageThumbnails"
49
- />
50
- </template>
51
42
  <template v-else>
52
43
  <SidebarContent
53
44
  class="sidebar-content-container"
@@ -77,7 +68,6 @@ import SidebarContent from './SidebarContent.vue'
77
68
  import EventBus from './EventBus.js'
78
69
  import Tabs from './Tabs.vue'
79
70
  import ConnectivityInfo from './ConnectivityInfo.vue'
80
- import ImageThumbnails from './ImageThumbnails.vue'
81
71
 
82
72
  /**
83
73
  * Aims to provide a sidebar for searching capability for SPARC portal.
@@ -91,7 +81,6 @@ export default {
91
81
  Drawer,
92
82
  Icon,
93
83
  ConnectivityInfo,
94
- ImageThumbnails,
95
84
  },
96
85
  name: 'SideBar',
97
86
  props: {
@@ -119,8 +108,7 @@ export default {
119
108
  type: Array,
120
109
  default: () => [
121
110
  { id: 1, title: 'Search', type: 'search' },
122
- { id: 2, title: 'Connectivity', type: 'connectivity' },
123
- { id: 3, title: 'Images', type: 'images' }, // Temporary
111
+ { id: 2, title: 'Connectivity', type: 'connectivity' }
124
112
  ],
125
113
  },
126
114
  /**
@@ -144,13 +132,6 @@ export default {
144
132
  type: Object,
145
133
  default: null,
146
134
  },
147
- /**
148
- * The image thumbnails data to show in sidebar.
149
- */
150
- imageThumbnails: {
151
- type: Array,
152
- default: [],
153
- },
154
135
  },
155
136
  data: function () {
156
137
  return {
@@ -181,15 +162,15 @@ export default {
181
162
  this.$emit('search-changed', { ...data, id: id })
182
163
  },
183
164
  /**
184
- * @vuese
185
165
  * The function to close sidebar.
166
+ * @public
186
167
  */
187
168
  close: function () {
188
169
  this.drawerOpen = false
189
170
  },
190
171
  /**
191
- * @vuese
192
172
  * The function to toggle (open and close) sidebar.
173
+ * @public
193
174
  */
194
175
  toggleDrawer: function () {
195
176
  this.drawerOpen = !this.drawerOpen
@@ -231,9 +212,10 @@ export default {
231
212
  return this.$refs[searchTabRefId][0];
232
213
  },
233
214
  /**
234
- * @vuese
235
215
  * The function to add filters to sidebar search.
236
- * @arg filter `object`
216
+ *
217
+ * @param {Object} filter
218
+ * @public
237
219
  */
238
220
  addFilter: function (filter) {
239
221
  this.drawerOpen = true
@@ -266,25 +248,20 @@ export default {
266
248
  this.drawerOpen = value
267
249
  },
268
250
  /**
269
- * @vuese
270
251
  * The function to emit 'tabClicked' event with tab's `id` and tab's `type`
271
252
  * when user clicks the sidebar tab.
272
- * @arg {id, type}
253
+ * @param {Object} {id, type}
254
+ * @public
273
255
  */
274
256
  tabClicked: function ({id, type}) {
275
257
  /**
276
258
  * This event is emitted when user click sidebar's tab.
277
- * @arg {id, type}
259
+ * @arg {Object} {id, type}
278
260
  */
279
261
  this.$emit('tabClicked', {id, type});
280
262
  },
281
263
  tabClose: function (id) {
282
- const closedTab = this.tabs.find((tab) => tab.id === id);
283
- if (closedTab.type === 'connectivity') {
284
- this.$emit('connectivity-info-close');
285
- } else if (closedTab.type === 'images') {
286
- this.$emit('image-thumbnail-close');
287
- }
264
+ this.$emit('connectivity-info-close');
288
265
  },
289
266
  },
290
267
  created: function () {
@@ -2,7 +2,7 @@
2
2
  <div class="tab-container">
3
3
  <div
4
4
  class="title"
5
- v-for="title in titles"
5
+ v-for="title in tabTitles"
6
6
  :key="title.id"
7
7
  :class="{ 'active-tab': title.id == activeId }"
8
8
  >
@@ -16,7 +16,7 @@
16
16
  </div>
17
17
  </div>
18
18
  <el-button
19
- v-if="title.type === 'connectivity' || title.type === 'images'"
19
+ v-if="title.id === 2"
20
20
  @click="tabClose(title.id)"
21
21
  class="button-tab-close"
22
22
  aria-label="Close"
@@ -42,25 +42,6 @@ export default {
42
42
  type: Number,
43
43
  default: 1,
44
44
  },
45
- hasConnectivityInfo: {
46
- type: Boolean,
47
- default: true,
48
- },
49
- hasImageThumbnails: {
50
- type: Boolean,
51
- default: true,
52
- },
53
- },
54
- computed: {
55
- titles: function() {
56
- if (!this.hasConnectivityInfo) {
57
- return this.tabTitles.filter((tab) => tab.type !== 'connectivity');
58
- }
59
- else if (!this.hasImageThumbnails) {
60
- return this.tabTitles.filter((tab) => tab.type !== 'images');
61
- }
62
- return this.tabTitles;
63
- },
64
45
  },
65
46
  methods: {
66
47
  titleClicked: function (id, type) {
@@ -92,7 +73,6 @@ $tab-height: 30px;
92
73
  align-items: center;
93
74
  position: relative;
94
75
  cursor: pointer;
95
- z-index: 2;
96
76
  }
97
77
 
98
78
  .title-text {
@@ -20,7 +20,6 @@ declare module 'vue' {
20
20
  ElIconLocation: typeof import('@element-plus/icons-vue')['Location']
21
21
  ElIconWarning: typeof import('@element-plus/icons-vue')['Warning']
22
22
  ElIconWarnTriangleFilled: typeof import('@element-plus/icons-vue')['WarnTriangleFilled']
23
- ElImage: typeof import('element-plus/es')['ElImage']
24
23
  ElInput: typeof import('element-plus/es')['ElInput']
25
24
  ElOption: typeof import('element-plus/es')['ElOption']
26
25
  ElPagination: typeof import('element-plus/es')['ElPagination']
@@ -29,7 +28,6 @@ declare module 'vue' {
29
28
  ElTag: typeof import('element-plus/es')['ElTag']
30
29
  ExternalResourceCard: typeof import('./components/ExternalResourceCard.vue')['default']
31
30
  ImageGallery: typeof import('./components/ImageGallery.vue')['default']
32
- ImageThumbnails: typeof import('./components/ImageThumbnails.vue')['default']
33
31
  SearchFilters: typeof import('./components/SearchFilters.vue')['default']
34
32
  SearchHistory: typeof import('./components/SearchHistory.vue')['default']
35
33
  SideBar: typeof import('./components/SideBar.vue')['default']
@@ -8,7 +8,8 @@
8
8
  import fs from 'fs'
9
9
  import path from 'path'
10
10
  import chokidar from 'chokidar'
11
- import { parser } from '@vuese/parser'
11
+ // import { parser } from '@vuese/parser'
12
+ import { parseSource } from 'vue-docgen-api'
12
13
  import { Render } from '@vuese/markdown-render'
13
14
 
14
15
  const watchMode = process.argv.find((argv) => argv === 'watch')
@@ -22,29 +23,87 @@ function generateMarkdown(file) {
22
23
  const fileContent = fs.readFileSync(fileWithPath, 'utf-8')
23
24
 
24
25
  try {
25
- const parserResult = parser(fileContent)
26
- const r = new Render(parserResult)
27
- const renderResult = r.render()
28
- const markdownResult = r.renderMarkdown()
29
- const markdownContent = markdownResult.content
30
- const componentName = path.basename(fileWithPath, '.vue')
31
-
32
- if (!fs.existsSync(outputDir)) {
33
- fs.mkdirSync(outputDir)
34
- }
26
+ // const parserResult = parser(fileContent)
27
+ const parserResult = parseSource(fileContent, fileWithPath)
28
+ parserResult.then((result) => {
29
+ const {
30
+ displayName: name,
31
+ description: desc,
32
+ props,
33
+ events,
34
+ methods
35
+ } = result
36
+
37
+ // transform props to vuese styles
38
+ const parseResult = {
39
+ name: name,
40
+ componentDesc: {
41
+ default: [desc]
42
+ },
43
+ props: transformData(props),
44
+ events: transformData(events),
45
+ methods: transformData(methods),
46
+ }
47
+ const r = new Render(parseResult)
48
+ const renderResult = r.render()
49
+ const markdownResult = r.renderMarkdown()
50
+ const markdownContent = markdownResult.content
51
+ const componentName = path.basename(fileWithPath, '.vue')
35
52
 
36
- fs.writeFile(`${outputDir}/${componentName}.md`, markdownContent, (err) => {
37
- if (err) {
38
- console.error(`Error writing markdown file for ${componentName}`, err)
39
- } else {
40
- console.log(`Markdown file for ${componentName} is generated!`)
53
+ if (!fs.existsSync(outputDir)) {
54
+ fs.mkdirSync(outputDir)
41
55
  }
56
+
57
+ fs.writeFile(`${outputDir}/${componentName}.md`, markdownContent, (err) => {
58
+ if (err) {
59
+ console.error(`Error writing markdown file for ${componentName}`, err)
60
+ } else {
61
+ console.log(`Markdown file for ${componentName} is generated!`)
62
+ }
63
+ })
42
64
  })
43
65
  } catch(e) {
44
66
  console.error(e)
45
67
  }
46
68
  }
47
69
 
70
+ function transformData(data) {
71
+ data.forEach((prop) => {
72
+ prop.name = prop.name
73
+
74
+ if (prop.description) {
75
+ prop.describe = [prop.description.replaceAll('\n', ' ')]
76
+ }
77
+
78
+ if (prop.type) {
79
+ prop.type = prop.type.name
80
+ }
81
+
82
+ if (prop.defaultValue) {
83
+ prop.default = prop.defaultValue.value.replaceAll('\n', ' ')
84
+ }
85
+
86
+ // events
87
+ if (prop.properties) {
88
+ prop.argumentsDesc = []
89
+ prop.properties.forEach((param) => {
90
+ const argName = param.name || param.description
91
+ prop.argumentsDesc.push(argName)
92
+ })
93
+ }
94
+
95
+ // methods
96
+ if (prop.params) {
97
+ prop.argumentsDesc = []
98
+ prop.params.forEach((param) => {
99
+ const argName = param.name || param.description
100
+ prop.argumentsDesc.push(argName)
101
+ })
102
+ }
103
+ })
104
+ return data
105
+ }
106
+
48
107
  // To generate markdown files - one time
49
108
  components.forEach((component) => {
50
109
  console.log(`Write markdown file for ${component} on first load.`)