@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/src/main.js CHANGED
@@ -1,10 +1,10 @@
1
- import { createApp } from 'vue'
2
- import App from './App.vue'
3
- import "./assets/fonts.scss"
4
- import MapSideBar from './components/SideBar.vue'
1
+ import { createApp } from 'vue';
2
+ import App from './App.vue';
3
+ import './assets/fonts.scss';
4
+ import MapSideBar from './components/SideBar.vue';
5
5
 
6
6
  const app = createApp(App);
7
7
 
8
- app.component('MapSideBar', MapSideBar)
8
+ app.component('MapSideBar', MapSideBar);
9
9
 
10
- app.mount("#app");
10
+ app.mount('#app');
@@ -1,37 +1,34 @@
1
1
  <script>
2
2
  export default {
3
- name: "S3Bucket",
3
+ name: 'S3Bucket',
4
4
  data() {
5
5
  return {
6
6
  s3Bucket: undefined,
7
- s3Prefix: "",
7
+ s3Prefix: '',
8
8
  };
9
9
  },
10
10
  methods: {
11
- updateS3Bucket: function(s3uri) {
11
+ updateS3Bucket: function (s3uri) {
12
12
  this.s3Bucket = undefined;
13
13
  if (s3uri) {
14
- const substring = s3uri.split("//")[1];
14
+ const substring = s3uri.split('//')[1];
15
15
  if (substring) {
16
- this.s3Bucket = substring.split("/")[0];
16
+ this.s3Bucket = substring.split('/')[0];
17
17
  const n = substring.indexOf('/');
18
18
  this.s3Prefix = substring.substring(n + 1);
19
19
  return;
20
20
  }
21
21
  }
22
22
  },
23
- getS3Args: function() {
23
+ getS3Args: function () {
24
24
  if (this.s3Bucket) {
25
- return `?s3BucketName=${this.s3Bucket}`
25
+ return `?s3BucketName=${this.s3Bucket}`;
26
26
  }
27
- return "";
27
+ return '';
28
28
  },
29
- getS3Prefix: function() {
29
+ getS3Prefix: function () {
30
30
  return this.s3Prefix;
31
- }
31
+ },
32
32
  },
33
-
34
33
  };
35
34
  </script>
36
-
37
-
@@ -0,0 +1,59 @@
1
+ export function generateUUID() {
2
+ const arr = new Uint8Array(16);
3
+ window.crypto.getRandomValues(arr);
4
+
5
+ arr[6] = (arr[6] & 0x0f) | 0x40;
6
+ arr[8] = (arr[8] & 0x3f) | 0x80;
7
+
8
+ const hex = Array.from(arr)
9
+ .map((byte) => byte.toString(16).padStart(2, '0'))
10
+ .join('');
11
+
12
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
13
+ }
14
+
15
+ export function capitalise(text) {
16
+ if (!text) return '';
17
+ const value = String(text);
18
+ return value.charAt(0).toUpperCase() + value.slice(1);
19
+ }
20
+
21
+ export function formatAlertText(text, { formatLines = false } = {}) {
22
+ if (!text) return '';
23
+
24
+ const escaped = String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
25
+
26
+ const linkified = escaped.replace(/(https?:\/\/[^\s"<>[]+)/g, (url) => {
27
+ const parts = url.match(/^(.*?)([\].,;:!?]*)$/);
28
+ const cleanUrl = parts ? parts[1] : url;
29
+ const suffix = parts ? parts[2] : '';
30
+ return `<a href="${cleanUrl}" target="_blank" rel="noopener noreferrer">${cleanUrl}</a>${suffix}`;
31
+ });
32
+
33
+ const normalised = linkified.replace(/\\n/g, '\n').replace(/\r\n/g, '\n').replace(/\r/g, '\n');
34
+
35
+ if (!formatLines) {
36
+ return normalised;
37
+ }
38
+
39
+ return normalised
40
+ .split('\n')
41
+ .map((line) => {
42
+ const withBoldLabel = line.replace(/^\s*([A-Za-z][^:<]{0,120}:)/, '<strong>$1</strong>');
43
+ return `<div class="alert-line">${withBoldLabel}</div>`;
44
+ })
45
+ .join('\n');
46
+ }
47
+
48
+ export function scrollToRef(vm, refName) {
49
+ vm?.$nextTick(() => {
50
+ const element = vm?.$refs?.[refName];
51
+ if (element) {
52
+ element.scrollIntoView({
53
+ behavior: 'smooth',
54
+ block: 'start',
55
+ inline: 'nearest',
56
+ });
57
+ }
58
+ });
59
+ }
package/vite.config.js CHANGED
@@ -1,69 +1,70 @@
1
- import { resolve } from "node:path"
1
+ import { resolve } from 'node:path';
2
2
 
3
- import { defineConfig } from 'vite'
4
- import vue from '@vitejs/plugin-vue'
5
-
6
- import Components from 'unplugin-vue-components/vite'
7
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
3
+ import { defineConfig } from 'vite';
4
+ import vue from '@vitejs/plugin-vue';
5
+ import AutoImport from 'unplugin-auto-import/vite';
6
+ import Components from 'unplugin-vue-components/vite';
7
+ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
8
8
 
9
9
  // https://vitejs.dev/config/
10
10
  export default defineConfig({
11
- server: {
12
- port: 8081,
13
- },
14
- plugins: [
15
- vue(),
16
- Components({
17
- // allow auto load markdown components under `./src/components/`
18
- extensions: ['vue', 'md'],
19
- // allow auto import and register components used in markdown
20
- include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
21
- resolvers: [
22
- ElementPlusResolver({
23
- importStyle: 'sass',
24
- }),
25
- ],
26
- dts: './src/components.d.ts',
11
+ server: {
12
+ port: 8081,
13
+ },
14
+ plugins: [
15
+ vue(),
16
+ AutoImport({
17
+ resolvers: [ElementPlusResolver()],
18
+ }),
19
+ Components({
20
+ // allow auto load markdown components under `./src/components/`
21
+ extensions: ['vue', 'md'],
22
+ // allow auto import and register components used in markdown
23
+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
24
+ resolvers: [
25
+ ElementPlusResolver({
26
+ importStyle: 'sass',
27
27
  }),
28
- ],
29
- resolve: {
30
- alias: {
31
- '@': resolve(import.meta.dirname, './src'),
32
- }
28
+ ],
29
+ dts: './src/components.d.ts',
30
+ }),
31
+ ],
32
+ resolve: {
33
+ alias: {
34
+ '@': resolve(import.meta.dirname, './src'),
33
35
  },
34
- build: {
35
- lib: {
36
- entry: resolve(import.meta.dirname, "./src/components/index.js"),
37
- name: "MapSideBar",
38
- fileName: 'map-side-bar',
39
- },
40
- rollupOptions: {
41
- external: [
42
- "vue",
43
- "@abi-software/map-utilities",
44
- "@element-plus/icons-vue",
45
- "@abi-software/map-utilities/dist/style.css"
46
- ],
47
- output: {
48
- globals: {
49
- vue: "Vue",
50
- "@abi-software/map-utilities": "@abi-software/map-utilities",
51
- "@element-plus/icons-vue": "@element-plus/icons-vue"
52
- },
53
- // keep css output name stable for the "./dist/style.css" export/import paths
54
- assetFileNames: (assetInfo) =>
55
- assetInfo.name?.endsWith(".css")
56
- ? "style.css"
57
- : "assets/[name][extname]",
58
- },
36
+ },
37
+ build: {
38
+ lib: {
39
+ entry: resolve(import.meta.dirname, './src/components/index.js'),
40
+ name: 'MapSideBar',
41
+ fileName: 'map-side-bar',
42
+ },
43
+ rollupOptions: {
44
+ external: [
45
+ 'vue',
46
+ '@abi-software/map-utilities',
47
+ '@element-plus/icons-vue',
48
+ '@abi-software/map-utilities/dist/style.css',
49
+ ],
50
+ output: {
51
+ globals: {
52
+ vue: 'Vue',
53
+ '@abi-software/map-utilities': '@abi-software/map-utilities',
54
+ '@element-plus/icons-vue': '@element-plus/icons-vue',
59
55
  },
56
+ // keep css output name stable for the "./dist/style.css" export/import paths
57
+ assetFileNames: (assetInfo) =>
58
+ assetInfo.name?.endsWith('.css') ? 'style.css' : 'assets/[name][extname]',
59
+ },
60
+ },
61
+ },
62
+ css: {
63
+ preprocessorOptions: {
64
+ scss: {
65
+ api: 'modern-compiler',
66
+ additionalData: `@use '@/assets/styles' as *;`,
67
+ },
60
68
  },
61
- css: {
62
- preprocessorOptions: {
63
- scss: {
64
- api: 'modern-compiler',
65
- additionalData: `@use '@/assets/styles' as *;`
66
- }
67
- }
68
- }
69
- })
69
+ },
70
+ });
@@ -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 = ['SideBar.vue']
19
- const outputDir = 'docs/components'
17
+ const componentsDir = 'src/components';
18
+ const components = ['SideBar.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.name || param.description
100
- prop.argumentsDesc.push(argName)
101
- })
91
+ const argName = param.name || param.description;
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
- })
113
+ console.log(`The component ${file} has changed!`);
114
+ generateMarkdown(file);
115
+ });
124
116
  }