@abi-software/mapintegratedvuer 0.7.1-demo.0 → 0.7.1-vue3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/mapintegratedvuer",
3
- "version": "0.7.1-demo.0",
3
+ "version": "0.7.1-vue3.0",
4
4
  "license": "Apache-2.0",
5
5
  "scripts": {
6
6
  "serve": "vite --host --force",
@@ -16,7 +16,13 @@
16
16
  "release:beta": "npm version prerelease --force --preid=beta; npm publish --access public --tag beta",
17
17
  "release:minor": "npm version minor --force; npm publish --access public",
18
18
  "release:patch": "npm version patch --force; npm publish --access public",
19
- "version": "npm run changelog; git add CHANGELOG.md"
19
+ "version": "npm run changelog; git add CHANGELOG.md",
20
+ "vuese-gen": "node vuese-generator.js",
21
+ "vuese-watch": "node vuese-generator.js watch",
22
+ "docs:dev": "vitepress dev docs",
23
+ "docs:watch": "concurrently \"npm run vuese-watch\" \"npm run docs:dev\"",
24
+ "docs:build": "npm run vuese-gen; vitepress build docs",
25
+ "docs:preview": "vitepress preview docs"
20
26
  },
21
27
  "repository": {
22
28
  "type": "git",
@@ -42,32 +48,22 @@
42
48
  "*.js"
43
49
  ],
44
50
  "dependencies": {
45
- "@abi-software/flatmapvuer": "0.6.1-demo-0",
51
+ "@abi-software/flatmapvuer": "^0.6.1-vue3.9",
46
52
  "@abi-software/map-side-bar": "^1.7.0-vue3.4",
47
53
  "@abi-software/plotvuer": "^0.4.0-vue-3-alpha.10",
48
54
  "@abi-software/scaffoldvuer": "^0.4.0-vue3.6",
49
55
  "@abi-software/simulationvuer": "^0.7.0-vue-3-alpha.5",
50
- "@abi-software/svg-sprite": "0.4.0-vue3.3",
56
+ "@abi-software/svg-sprite": "^0.4.0-vue3.3",
51
57
  "@cypress/vite-dev-server": "^5.0.7",
52
58
  "@element-plus/icons-vue": "^2.3.1",
53
59
  "@pinia/testing": "^0.1.3",
54
- "@soda/get-current-script": "^1.0.2",
55
- "core-js": "^3.22.5",
56
60
  "css-element-queries": "^1.2.3",
57
- "d3-time-format": "^3.0.0",
58
61
  "element-plus": "^2.4.4",
59
- "es6-promise": "^4.2.8",
60
- "jsonschema": "^1.4.0",
61
- "lodash": "^4.17.21",
62
62
  "marked": "^4.3.0",
63
63
  "mitt": "^3.0.1",
64
64
  "pinia": "^2.1.7",
65
- "postcss-prefix-selector": "^1.7.2",
66
- "shepherd.js": "^7.1.5",
67
65
  "splitpanes": "^3.1.5",
68
- "svg-inline-loader": "^0.8.2",
69
66
  "vue": "^3.4.15",
70
- "vue-cli-plugin-webpack-bundle-analyzer": "^2.0.0",
71
67
  "vue-router": "^4.2.5",
72
68
  "vuex": "^4.1.0",
73
69
  "xss": "^1.0.14"
@@ -76,12 +72,14 @@
76
72
  "@cypress/webpack-dev-server": "^1.3.1",
77
73
  "@vitejs/plugin-vue": "^4.6.2",
78
74
  "@vue/test-utils": "^2.4.4",
75
+ "@vuese/markdown-render": "^2.11.3",
76
+ "@vuese/parser": "^2.10.3",
79
77
  "auto-changelog": "^2.4.0",
80
78
  "babel-eslint": "^10.0.3",
81
79
  "babel-plugin-component": "^1.1.1",
82
- "base64-inline-loader": "^2.0.1",
83
- "canvas": "^2.8.0",
84
80
  "chai": "^4.1.2",
81
+ "chokidar": "^3.6.0",
82
+ "concurrently": "^8.2.2",
85
83
  "cypress": "^13.6.4",
86
84
  "cypress-multi-reporters": "^1.6.4",
87
85
  "cypress-wait-until": "^1.7.1",
@@ -99,6 +97,7 @@
99
97
  "mochawesome-report-generator": "^6.2.0",
100
98
  "sass": "^1.69.5",
101
99
  "vite": "^5.0.10",
100
+ "vitepress": "^1.0.0-rc.45",
102
101
  "vitest": "^1.2.2"
103
102
  },
104
103
  "eslintConfig": {
package/src/App.vue CHANGED
@@ -240,6 +240,6 @@ body {
240
240
  }
241
241
 
242
242
  .map-icon {
243
- color: $app-primary-color;
243
+ color: $app-primary-color!important;
244
244
  }
245
245
  </style>
@@ -7,7 +7,7 @@
7
7
  element-loading-background="rgba(0, 0, 0, 0.3)"
8
8
  >
9
9
  <map-svg-sprite-color/>
10
- <SplitFlow
10
+ <SplitFlow
11
11
  v-if="isReady"
12
12
  @onFullscreen="onFullscreen"
13
13
  :state="stateToSet"
@@ -41,19 +41,31 @@ export default {
41
41
  SplitFlow,
42
42
  },
43
43
  props: {
44
+ /**
45
+ * A link (URL) to share.
46
+ */
44
47
  shareLink: {
45
48
  type: String,
46
49
  default: undefined
47
50
  },
51
+ /**
52
+ * State containing state of the scaffold.
53
+ */
48
54
  state: {
49
55
  type: Object,
50
56
  default: undefined
51
57
  },
58
+ /**
59
+ * The options include APIs and Keys.
60
+ */
52
61
  options: {
53
- type: Object,
54
- default: () => {}
62
+ type: Object,
63
+ default: () => {},
64
+ required: true
55
65
  },
56
- //New option to start the map in AC, FC or WholeBody
66
+ /**
67
+ * New option to start the map in AC, FC or WholeBody.
68
+ */
57
69
  startingMap: {
58
70
  type: String,
59
71
  default: "AC"
@@ -66,10 +78,20 @@ export default {
66
78
  }
67
79
  },
68
80
  methods: {
81
+ /**
82
+ * @vuese
83
+ * Function to check whether it is in fullscreen mode or not.
84
+ *
85
+ */
69
86
  isFullscreen: function(){
70
87
  return (document.fullscreenElement || document.webkitFullscreenElement ||
71
88
  document.mozFullScreenElement || document.msFullscreenElement )
72
89
  },
90
+ /**
91
+ * @vuese
92
+ * Function to toggle fullscreen.
93
+ * @arg fullscreenRequest
94
+ */
73
95
  onFullscreen: function(fullscreenReq) {
74
96
  //If a request is sent, try it
75
97
  if (fullscreenReq !== undefined){
@@ -89,6 +111,10 @@ export default {
89
111
  }
90
112
  }
91
113
  },
114
+ /**
115
+ * @vuese
116
+ * Function to leave fullscreen mode.
117
+ */
92
118
  leaveFullscreen: function(){
93
119
  if (this.isFullscreen()) {
94
120
  if (document.exitFullscreen) {
@@ -102,6 +128,10 @@ export default {
102
128
  }
103
129
  }
104
130
  },
131
+ /**
132
+ * @vuese
133
+ * Function to go to fullscreen mode.
134
+ */
105
135
  goFullscreen: function(){
106
136
  let mapApp = this.$refs.MapApp;
107
137
  if (mapApp.requestFullscreen) {
@@ -121,11 +151,12 @@ export default {
121
151
  return this.$refs.flow.getState();
122
152
  },
123
153
  /**
154
+ * @vuese
124
155
  * Provide a way to set the current view, this is currently limited
125
156
  * to setting view for flatmapm, multiflatmap or scaffold.
126
157
  * In the case of the multiflatmap, it will not create a new entry and
127
158
  * instead change the current entry by setting the state.
128
- *
159
+ * @arg state
129
160
  */
130
161
  setCurrentEntry: function(state) {
131
162
  if (state && state.type) {
@@ -135,7 +166,7 @@ export default {
135
166
  // region - Which region/group currently focusing on
136
167
  // resource - the url to metadata
137
168
  // state - state to restore (viewport)
138
- // viewUrl - relative path of the view file to metadata
169
+ // viewUrl - relative path of the view file to metadata
139
170
  const newView = {
140
171
  type: state.type,
141
172
  label: state.label,
@@ -150,7 +181,7 @@ export default {
150
181
  // label - Setting the name of the dialog
151
182
  // taxo - taxo of species to set
152
183
  // biologicalSex - biological sex to be displayed (PATO)
153
- // organ - Target organ, flatmap will conduct a local search
184
+ // organ - Target organ, flatmap will conduct a local search
154
185
  // using this
155
186
 
156
187
  //Look for the key in the available species array,
@@ -186,7 +217,7 @@ export default {
186
217
  // region - Which region/group currently focusing on
187
218
  // resource - the url to metadata
188
219
  // state - state to restore (viewport)
189
- // viewUrl - relative path of the view file to metadata
220
+ // viewUrl - relative path of the view file to metadata
190
221
  const newView = {
191
222
  type: state.type,
192
223
  resource: state.resource,
@@ -194,17 +225,26 @@ export default {
194
225
  label: state.label
195
226
  };
196
227
  this.$refs.flow.createNewEntry(newView);
197
- }
198
- }
228
+ }
229
+ }
199
230
  },
200
231
  /**
232
+ * @vuese
201
233
  * Open the sidebar with the specified facets and query.
234
+ * @arg facets, query
202
235
  */
203
236
  openSearch: function(facets, query) {
204
237
  return this.$refs.flow.openSearch(facets, query);
205
238
  },
239
+ /**
240
+ * @vuese
241
+ * Function to run when the component is mounted.
242
+ */
206
243
  flowMounted: function () {
207
244
  this._flowMounted = true;
245
+ /**
246
+ * This event emit when the component is mounted.
247
+ */
208
248
  this.$emit("isReady");
209
249
  },
210
250
  },
@@ -237,6 +277,9 @@ export default {
237
277
  },
238
278
  mounted: async function() {
239
279
  EventBus.on("updateShareLinkRequested", () => {
280
+ /**
281
+ * This event emits when the share link is requested.
282
+ */
240
283
  this.$emit("updateShareLinkRequested");
241
284
  });
242
285
  if (!this.state) {
@@ -43,7 +43,7 @@ const getOpenMapOptions = (species) => {
43
43
  key: "FC"
44
44
  },
45
45
  {
46
- display: "Open 3D Human Map",
46
+ display: "Open 3D Human Map",
47
47
  key: "3D"
48
48
  },
49
49
  ]
@@ -52,7 +52,7 @@ const getOpenMapOptions = (species) => {
52
52
  case "Human Female":
53
53
  case "Rat":
54
54
  options.push({
55
- display: "Open Sync Map",
55
+ display: "Open Sync Map",
56
56
  key: "SYNC"
57
57
  });
58
58
  break;
@@ -98,7 +98,7 @@ export default {
98
98
  } else if ((this.activeSpecies === "Human Male") || (this.activeSpecies === "Human Female")) {
99
99
  //Dynamically construct the whole body scaffold for human and store it
100
100
  if (!("human" in this.scaffoldResource)) {
101
- this.scaffoldResource["human"] = await getBodyScaffoldInfo(this.apiLocation, "human");
101
+ this.scaffoldResource["human"] = await getBodyScaffoldInfo(storeeSettings.sparcApi, "human");
102
102
  }
103
103
  action = {
104
104
  contextCardUrl: this.scaffoldResource["human"].datasetInfo.contextCardUrl,
@@ -256,7 +256,7 @@ export default {
256
256
  }
257
257
  },
258
258
  getFlatmapImp: function () {
259
- if (this.entry.type === "MultiFlatmap") {
259
+ if (this.entry.type === "MultiFlatmap" && this.flatmapReady) {
260
260
  return this.$refs.multiflatmap.getCurrentFlatmap()["mapImp"];
261
261
  } else {
262
262
  return undefined;
package/src/main.js CHANGED
@@ -3,9 +3,10 @@ import { createApp } from 'vue'
3
3
  import { createPinia } from 'pinia'
4
4
  import * as VueRouter from 'vue-router'
5
5
  import App from './App.vue'
6
+ import { useMainStore } from './stores/index'
6
7
 
7
8
  const routes = [
8
- { path: '/'},
9
+ { path: '/' },
9
10
  ]
10
11
 
11
12
  const router = VueRouter.createRouter({
@@ -19,4 +20,13 @@ const app = createApp(App)
19
20
 
20
21
  app.use(pinia)
21
22
  app.use(router)
22
- app.mount('#app')
23
+
24
+ const mainStore = useMainStore()
25
+ const token = document.cookie
26
+ .split("; ")
27
+ .find((row) => row.startsWith("user-token"))
28
+ if (mainStore && token) {
29
+ mainStore.setUserToken(token.split("=")[1])
30
+ }
31
+
32
+ app.mount('#app')
@@ -1,16 +1,24 @@
1
- import Vue from 'vue';
2
- import Vuex from 'vuex';
3
- import entries from './modules/entries';
4
- import settings from './modules/settings';
5
- import splitFlow from './modules/splitFlow';
6
- Vue.use(Vuex);
1
+ import { defineStore } from 'pinia'
7
2
 
8
- export const store = new Vuex.Store({
9
- modules: {
10
- entries,
11
- splitFlow,
12
- settings,
3
+ /**
4
+ * Activate the store when run the application individually.
5
+ * If the store exist in parent application,
6
+ * instead of creating a new store it will access the parent main store.
7
+ */
8
+ export const useMainStore = defineStore('main', {
9
+ state: () => ({
10
+ userProfile: {
11
+ token: ''
12
+ },
13
+ }),
14
+ getters: {
15
+ userToken(state) {
16
+ return state.userProfile.token
17
+ },
18
+ },
19
+ actions: {
20
+ setUserToken(value) {
21
+ this.userProfile.token = value
22
+ },
13
23
  }
14
- });
15
-
16
- export default store;
24
+ })
package/vite.config.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import path from "path";
2
- const pathSrc = path.resolve(__dirname, "./src");
3
2
  import { defineConfig } from 'vite'
4
3
  import vue from '@vitejs/plugin-vue'
5
4
  import Components from 'unplugin-vue-components/vite'
@@ -29,7 +28,7 @@ export default defineConfig(({ command, mode }) => {
29
28
  ],
30
29
  dts: 'src/components.d.ts',
31
30
  }),
32
-
31
+
33
32
  // https://github.com/antfu/unocss
34
33
  // see unocss.config.ts for config
35
34
  ],
@@ -49,6 +48,11 @@ export default defineConfig(({ command, mode }) => {
49
48
  },
50
49
  },
51
50
  },
51
+ // for cypress component test
52
+ // to prevent reloading after optimized dependencies changed
53
+ optimizeDeps: {
54
+ exclude: ['vue-router'],
55
+ },
52
56
  };
53
57
 
54
58
  if (command === 'serve') {
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Vuese Generator
3
+ *
4
+ * To generate markdown files from Vue components
5
+ * To watch components changes for Vitepress on Dev Mode
6
+ */
7
+
8
+ import fs from 'fs'
9
+ import path from 'path'
10
+ import chokidar from 'chokidar'
11
+ import { parser } from '@vuese/parser'
12
+ import { Render } from '@vuese/markdown-render'
13
+
14
+ const watchMode = process.argv.find((argv) => argv === 'watch')
15
+
16
+ const componentsDir = 'src/components'
17
+ const components = ['MapContent.vue']
18
+ const outputDir = 'docs/components'
19
+
20
+ function generateMarkdown(file) {
21
+ const fileWithPath = `${componentsDir}/${file}`
22
+ const fileContent = fs.readFileSync(fileWithPath, 'utf-8')
23
+
24
+ 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
+ }
35
+
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!`)
41
+ }
42
+ })
43
+ } catch(e) {
44
+ console.error(e)
45
+ }
46
+ }
47
+
48
+ // To generate markdown files - one time
49
+ components.forEach((component) => {
50
+ console.log(`Write markdown file for ${component} on first load.`)
51
+ generateMarkdown(component)
52
+ })
53
+
54
+ // To watch component changes and generate markdown files
55
+ if (watchMode) {
56
+ const watcher = chokidar.watch(components, {
57
+ cwd: componentsDir,
58
+ ignoreInitial: true,
59
+ })
60
+
61
+ watcher.on('change', (file) => {
62
+ console.log(`The component ${file} has changed!`)
63
+ generateMarkdown(file)
64
+ })
65
+ }