@abi-software/scaffoldvuer 1.21.1-beta.2 → 2.0.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 (45) hide show
  1. package/README.md +31 -12
  2. package/dist/index.html +9 -6
  3. package/dist/scaffoldvuer.js +14095 -13154
  4. package/dist/scaffoldvuer.umd.cjs +48 -48
  5. package/dist/style.css +1 -1
  6. package/eslint.config.js +37 -9
  7. package/package.json +10 -3
  8. package/public/index.html +9 -6
  9. package/src/App.vue +312 -279
  10. package/src/ScaffoldVuer-wc.js +4 -4
  11. package/src/app/DropZone.vue +11 -27
  12. package/src/app/ModelsInformation.js +22 -19
  13. package/src/app/ModelsTable.vue +42 -65
  14. package/src/app/TextureDemos.js +38 -64
  15. package/src/assets/_variables.scss +12 -10
  16. package/src/components/GlyphsControls.vue +3 -23
  17. package/src/components/LinesControls.vue +27 -66
  18. package/src/components/OpacityControls.vue +22 -26
  19. package/src/components/PointsControls.vue +20 -71
  20. package/src/components/PrimitiveControls.vue +35 -49
  21. package/src/components/ScaffoldOverlay.vue +63 -63
  22. package/src/components/ScaffoldTooltip.vue +36 -49
  23. package/src/components/ScaffoldTreeControls.vue +81 -129
  24. package/src/components/ScaffoldVuer.vue +509 -498
  25. package/src/components/TextureSlidesControls.vue +22 -64
  26. package/src/components/TransformationControls.vue +15 -42
  27. package/src/components/index.js +2 -2
  28. package/src/main.js +16 -18
  29. package/src/scripts/Annotation.js +3 -3
  30. package/src/scripts/BaseModule.js +26 -30
  31. package/src/scripts/EventNotifier.js +30 -36
  32. package/src/scripts/GraphicsHighlight.js +43 -50
  33. package/src/scripts/LocalFilesHelper.js +27 -26
  34. package/src/scripts/MappedNerves.js +2139 -697
  35. package/src/scripts/MappedOrgans.js +24 -25
  36. package/src/scripts/OrgansRenderer.js +445 -425
  37. package/src/scripts/RendererModule.js +133 -122
  38. package/src/scripts/Search.js +135 -151
  39. package/src/scripts/Utilities.js +129 -127
  40. package/src/scripts/WebGL.js +57 -91
  41. package/src/scripts/niftiHelper.js +3 -3
  42. package/src/store/index.js +7 -7
  43. package/vite.config.js +51 -50
  44. package/vite.static-build.js +7 -7
  45. package/vuese-generator.js +48 -56
@@ -1,24 +1,24 @@
1
- import { defineStore } from 'pinia'
1
+ import { defineStore } from 'pinia';
2
2
 
3
3
  /**
4
4
  * Activate the store when run the application individually.
5
- * If the store exist in parent application,
5
+ * If the store exist in parent application,
6
6
  * instead of creating a new store it will access the parent main store.
7
7
  */
8
8
  export const useMainStore = defineStore('main', {
9
9
  state: () => ({
10
10
  userProfile: {
11
- token: ''
11
+ token: '',
12
12
  },
13
13
  }),
14
14
  getters: {
15
15
  userToken(state) {
16
- return state.userProfile.token
16
+ return state.userProfile.token;
17
17
  },
18
18
  },
19
19
  actions: {
20
20
  setUserToken(value) {
21
- this.userProfile.token = value
21
+ this.userProfile.token = value;
22
22
  },
23
- }
24
- })
23
+ },
24
+ });
package/vite.config.js CHANGED
@@ -1,79 +1,80 @@
1
- import path from "path";
2
- import { defineConfig } from 'vite'
3
- import vue from '@vitejs/plugin-vue'
4
- import Components from 'unplugin-vue-components/vite'
5
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
6
- import { nodePolyfills } from 'vite-plugin-node-polyfills'
1
+ import path from 'path';
2
+ import { defineConfig } from 'vite';
3
+ import vue from '@vitejs/plugin-vue';
4
+ import AutoImport from 'unplugin-auto-import/vite';
5
+ import Components from 'unplugin-vue-components/vite';
6
+ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
7
+ import { nodePolyfills } from 'vite-plugin-node-polyfills';
7
8
 
8
9
  // https://vitejs.dev/config/
9
- export default defineConfig(({ command, mode }) => {
10
+ export default defineConfig(({ command }) => {
10
11
  const config = {
11
12
  css: {
12
- preprocessorOptions: {
13
- scss: {
14
- api: 'modern-compiler',
15
- additionalData: `@use '@/assets/styles' as *;`
16
- },
13
+ preprocessorOptions: {
14
+ scss: {
15
+ api: 'modern-compiler',
16
+ additionalData: `@use '@/assets/styles' as *;`,
17
17
  },
18
+ },
18
19
  },
19
20
  plugins: [
20
- vue(),
21
- Components({
22
- // allow auto load markdown components under `./src/components/`
23
- extensions: ['vue', 'md'],
24
- // allow auto import and register components used in markdown
25
- include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
26
- resolvers: [
27
- ElementPlusResolver({
28
- importStyle: 'sass',
29
- }),
30
- ],
31
- dts: 'src/components.d.ts',
32
- }),
33
-
34
- // https://github.com/antfu/unocss
35
- // see unocss.config.ts for config
21
+ vue(),
22
+ AutoImport({
23
+ resolvers: [ElementPlusResolver()],
24
+ }),
25
+ Components({
26
+ // allow auto load markdown components under `./src/components/`
27
+ extensions: ['vue', 'md'],
28
+ // allow auto import and register components used in markdown
29
+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
30
+ resolvers: [
31
+ ElementPlusResolver({
32
+ importStyle: 'sass',
33
+ }),
34
+ ],
35
+ dts: 'src/components.d.ts',
36
+ }),
36
37
  ],
37
38
  resolve: {
38
39
  alias: {
39
40
  '@': path.resolve(import.meta.dirname, './src'),
40
- }
41
+ },
41
42
  },
42
43
  build: {
43
44
  lib: {
44
- entry: path.resolve(import.meta.dirname, "./src/components/index.js"),
45
- name: "ScaffoldVuer",
45
+ entry: path.resolve(import.meta.dirname, './src/components/index.js'),
46
+ name: 'ScaffoldVuer',
46
47
  fileName: 'scaffoldvuer',
47
48
  },
48
49
  rollupOptions: {
49
50
  external: [
50
- "vue",
51
- "@abi-software/sparc-annotation",
52
- "@abi-software/svg-sprite",
53
- "@abi-software/map-utilities",
54
- "pinia",
55
- "@abi-software/map-utilities/dist/style.css"
51
+ 'vue',
52
+ '@abi-software/sparc-annotation',
53
+ '@abi-software/svg-sprite',
54
+ '@abi-software/map-utilities',
55
+ 'pinia',
56
+ '@abi-software/map-utilities/dist/style.css',
56
57
  ],
57
58
  output: {
58
59
  globals: {
59
- vue: "Vue",
60
- "@abi-software/sparc-annotation": "@abi-software/sparc-annotation",
61
- "@abi-software/svg-sprite": "@abi-software/svg-sprite",
62
- "@abi-software/map-utilities": "@abi-software/map-utilities",
63
- "pinia": "pinia"
60
+ vue: 'Vue',
61
+ '@abi-software/sparc-annotation': '@abi-software/sparc-annotation',
62
+ '@abi-software/svg-sprite': '@abi-software/svg-sprite',
63
+ '@abi-software/map-utilities': '@abi-software/map-utilities',
64
+ '@abi-software/map-utilities/dist/style.css':
65
+ '_abi_software_map_utilities_dist_style_css',
66
+ pinia: 'pinia',
64
67
  },
65
68
  // keep css output name stable for the "./dist/style.css" export/import paths
66
69
  assetFileNames: (assetInfo) =>
67
- assetInfo.name?.endsWith(".css")
68
- ? "style.css"
69
- : "assets/[name][extname]",
70
+ assetInfo.name?.endsWith('.css') ? 'style.css' : 'assets/[name][extname]',
70
71
  },
71
72
  },
72
73
  },
73
74
  };
74
75
 
75
76
  if (command === 'serve') {
76
- config.server = {
77
+ config.server = {
77
78
  port: 8081,
78
79
  };
79
80
  config.define = {
@@ -85,9 +86,9 @@ export default defineConfig(({ command, mode }) => {
85
86
  config.plugins.push(
86
87
  nodePolyfills({
87
88
  // To add only specific polyfills, add them here. If no option is passed, adds all polyfills
88
- include: ['path']
89
- })
89
+ include: ['path'],
90
+ }),
90
91
  );
91
- };
92
+ }
92
93
  return config;
93
- })
94
+ });
@@ -1,18 +1,18 @@
1
- import { defineConfig } from 'vite'
2
- import rootConfig from './vite.config.js'
3
- import { nodePolyfills } from 'vite-plugin-node-polyfills'
1
+ import { defineConfig } from 'vite';
2
+ import rootConfig from './vite.config.js';
3
+ import { nodePolyfills } from 'vite-plugin-node-polyfills';
4
4
 
5
5
  // defineWorkspace provides a nice type hinting DX
6
6
  export default defineConfig((configEnv) => {
7
7
  const config = rootConfig(configEnv);
8
8
  config.build = {
9
- outDir: "test-html"
9
+ outDir: 'test-html',
10
10
  };
11
11
  config.plugins.push(
12
12
  nodePolyfills({
13
13
  // To add only specific polyfills, add them here. If no option is passed, adds all polyfills
14
- include: ['path']
15
- })
14
+ include: ['path'],
15
+ }),
16
16
  );
17
17
  return config;
18
- })
18
+ });
@@ -5,120 +5,112 @@
5
5
  * To watch components changes for Vitepress on Dev Mode
6
6
  */
7
7
 
8
- import fs from 'fs'
9
- import path from 'path'
10
- import chokidar from 'chokidar'
8
+ import fs from 'fs';
9
+ import path from 'path';
10
+ import chokidar from 'chokidar';
11
11
  // import { parser } from '@vuese/parser'
12
- import { parseSource } from 'vue-docgen-api'
13
- import { Render } from '@vuese/markdown-render'
12
+ import { parseSource } from 'vue-docgen-api';
13
+ import { Render } from '@vuese/markdown-render';
14
14
 
15
- const watchMode = process.argv.find((argv) => argv === 'watch')
15
+ const watchMode = process.argv.find((argv) => argv === 'watch');
16
16
 
17
- const componentsDir = 'src/components'
18
- const components = ['ScaffoldVuer.vue']
19
- const outputDir = 'docs/components'
17
+ const componentsDir = 'src/components';
18
+ const components = ['ScaffoldVuer.vue'];
19
+ const outputDir = 'docs/components';
20
20
 
21
21
  function generateMarkdown(file) {
22
- const fileWithPath = `${componentsDir}/${file}`
23
- const fileContent = fs.readFileSync(fileWithPath, 'utf-8')
22
+ const fileWithPath = `${componentsDir}/${file}`;
23
+ const fileContent = fs.readFileSync(fileWithPath, 'utf-8');
24
24
 
25
25
  try {
26
26
  // const parserResult = parser(fileContent)
27
- const parserResult = parseSource(fileContent, fileWithPath)
27
+ const parserResult = parseSource(fileContent, fileWithPath);
28
28
  parserResult.then((result) => {
29
- const {
30
- displayName: name,
31
- description: desc,
32
- props,
33
- events,
34
- methods
35
- } = result
29
+ const { displayName: name, description: desc, props, events, methods } = result;
36
30
 
37
31
  // transform props to vuese styles
38
32
  const parseResult = {
39
33
  name: name,
40
34
  componentDesc: {
41
- default: [desc]
35
+ default: [desc],
42
36
  },
43
37
  props: transformData(props),
44
38
  events: transformData(events),
45
39
  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')
40
+ };
41
+ const r = new Render(parseResult);
42
+ // const renderResult = r.render();
43
+ const markdownResult = r.renderMarkdown();
44
+ const markdownContent = markdownResult.content;
45
+ const componentName = path.basename(fileWithPath, '.vue');
52
46
 
53
47
  if (!fs.existsSync(outputDir)) {
54
- fs.mkdirSync(outputDir)
48
+ fs.mkdirSync(outputDir);
55
49
  }
56
50
 
57
51
  fs.writeFile(`${outputDir}/${componentName}.md`, markdownContent, (err) => {
58
52
  if (err) {
59
- console.error(`Error writing markdown file for ${componentName}`, err)
53
+ console.error(`Error writing markdown file for ${componentName}`, err);
60
54
  } else {
61
- console.log(`Markdown file for ${componentName} is generated!`)
55
+ console.log(`Markdown file for ${componentName} is generated!`);
62
56
  }
63
- })
64
- })
65
- } catch(e) {
66
- console.error(e)
57
+ });
58
+ });
59
+ } catch (e) {
60
+ console.error(e);
67
61
  }
68
62
  }
69
63
 
70
64
  function transformData(data = []) {
71
65
  data.forEach((prop) => {
72
- prop.name = prop.name
73
-
74
66
  if (prop.description) {
75
- prop.describe = [prop.description.replaceAll('\n', ' ')]
67
+ prop.describe = [prop.description.replaceAll('\n', ' ')];
76
68
  }
77
69
 
78
70
  if (prop.type) {
79
- prop.type = prop.type.name
71
+ prop.type = prop.type.name;
80
72
  }
81
73
 
82
74
  if (prop.defaultValue) {
83
- prop.default = prop.defaultValue.value.replaceAll('\n', ' ')
75
+ prop.default = prop.defaultValue.value.replaceAll('\n', ' ');
84
76
  }
85
77
 
86
78
  // events
87
79
  if (prop.properties) {
88
- prop.argumentsDesc = []
80
+ prop.argumentsDesc = [];
89
81
  prop.properties.forEach((param) => {
90
- const argName = param.name || param.description
91
- prop.argumentsDesc.push(argName)
92
- })
82
+ const argName = param.name || param.description;
83
+ prop.argumentsDesc.push(argName);
84
+ });
93
85
  }
94
86
 
95
87
  // methods
96
88
  if (prop.params) {
97
- prop.argumentsDesc = []
89
+ prop.argumentsDesc = [];
98
90
  prop.params.forEach((param) => {
99
- const argName = param.description || param.name
100
- prop.argumentsDesc.push(argName)
101
- })
91
+ const argName = param.description || param.name;
92
+ prop.argumentsDesc.push(argName);
93
+ });
102
94
  }
103
- })
104
- return data
95
+ });
96
+ return data;
105
97
  }
106
98
 
107
99
  // To generate markdown files - one time
108
100
  components.forEach((component) => {
109
- console.log(`Write markdown file for ${component} on first load.`)
110
- generateMarkdown(component)
111
- })
101
+ console.log(`Write markdown file for ${component} on first load.`);
102
+ generateMarkdown(component);
103
+ });
112
104
 
113
105
  // To watch component changes and generate markdown files
114
106
  if (watchMode) {
115
107
  const watcher = chokidar.watch(components, {
116
108
  cwd: componentsDir,
117
109
  ignoreInitial: true,
118
- })
110
+ });
119
111
 
120
112
  watcher.on('change', (file) => {
121
- console.log(`The component ${file} has changed!`)
122
- generateMarkdown(file)
123
- })
124
- }
113
+ console.log(`The component ${file} has changed!`);
114
+ generateMarkdown(file);
115
+ });
116
+ }