@abi-software/map-side-bar 2.4.1 → 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.1",
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
  }
@@ -162,15 +162,15 @@ export default {
162
162
  this.$emit('search-changed', { ...data, id: id })
163
163
  },
164
164
  /**
165
- * @vuese
166
165
  * The function to close sidebar.
166
+ * @public
167
167
  */
168
168
  close: function () {
169
169
  this.drawerOpen = false
170
170
  },
171
171
  /**
172
- * @vuese
173
172
  * The function to toggle (open and close) sidebar.
173
+ * @public
174
174
  */
175
175
  toggleDrawer: function () {
176
176
  this.drawerOpen = !this.drawerOpen
@@ -212,9 +212,10 @@ export default {
212
212
  return this.$refs[searchTabRefId][0];
213
213
  },
214
214
  /**
215
- * @vuese
216
215
  * The function to add filters to sidebar search.
217
- * @arg filter `object`
216
+ *
217
+ * @param {Object} filter
218
+ * @public
218
219
  */
219
220
  addFilter: function (filter) {
220
221
  this.drawerOpen = true
@@ -247,15 +248,15 @@ export default {
247
248
  this.drawerOpen = value
248
249
  },
249
250
  /**
250
- * @vuese
251
251
  * The function to emit 'tabClicked' event with tab's `id` and tab's `type`
252
252
  * when user clicks the sidebar tab.
253
- * @arg {id, type}
253
+ * @param {Object} {id, type}
254
+ * @public
254
255
  */
255
256
  tabClicked: function ({id, type}) {
256
257
  /**
257
258
  * This event is emitted when user click sidebar's tab.
258
- * @arg {id, type}
259
+ * @arg {Object} {id, type}
259
260
  */
260
261
  this.$emit('tabClicked', {id, type});
261
262
  },
@@ -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.`)