@abi-software/map-utilities 1.4.0 → 1.4.1-beta.1
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/dist/map-utilities.js +33818 -16673
- package/dist/map-utilities.umd.cjs +246 -67
- package/dist/style.css +1 -1
- package/package.json +6 -1
- package/src/components/ConnectivityGraph/ConnectivityGraph.vue +46 -16
- package/src/components/ConnectivityList/ConnectivityList.vue +395 -0
- package/src/components/Tooltip/ExternalResourceCard.vue +69 -39
- package/src/components/Tooltip/ProvenancePopup.vue +10 -0
- package/src/components/index.js +2 -0
- package/src/components/utilities.js +40 -0
- package/src/components.d.ts +1 -0
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { Cite, plugins } from '@citation-js/core';
|
|
2
|
+
import '@citation-js/plugin-doi';
|
|
3
|
+
import '@citation-js/plugin-csl';
|
|
4
|
+
import '@citation-js/plugin-bibtex';
|
|
5
|
+
import '@citation-js/plugin-pubmed';
|
|
6
|
+
|
|
1
7
|
const capitalise = term => {
|
|
2
8
|
if (term)
|
|
3
9
|
return term.charAt(0).toUpperCase() + term.slice(1);
|
|
@@ -48,8 +54,42 @@ const delay = (ms) => {
|
|
|
48
54
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
49
55
|
};
|
|
50
56
|
|
|
57
|
+
/**
|
|
58
|
+
* @param {id} id - DOI or PMID
|
|
59
|
+
* @param {options:type} type - type of the ID, e.g., 'pmid'
|
|
60
|
+
* @param {options:format} format - 'apa' (default), 'chicago', 'ieee', 'bibtex', etc.
|
|
61
|
+
* @returns {citation} formatted citation text
|
|
62
|
+
*/
|
|
63
|
+
const getCitationById = async (id, { type, format }) => {
|
|
64
|
+
// because 'chicago' and 'ieee' are not in citation.js default styles
|
|
65
|
+
if ((format !== 'bibtex') && (format !== 'apa')) {
|
|
66
|
+
const xml = `https://raw.githubusercontent.com/citation-style-language/styles/refs/heads/master/${format}.csl`;
|
|
67
|
+
const response = await fetch(xml);
|
|
68
|
+
const template = await response.text();
|
|
69
|
+
let config = plugins.config.get('@csl');
|
|
70
|
+
config.templates.add(format, template);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const option = {};
|
|
74
|
+
|
|
75
|
+
if (type === 'pmid') {
|
|
76
|
+
option['forceType'] = '@pubmed/id';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const cite = await Cite.async(id, option);
|
|
80
|
+
const citation = (format === 'bibtex') ?
|
|
81
|
+
cite.format(format) :
|
|
82
|
+
cite.format('bibliography', {
|
|
83
|
+
format: 'html',
|
|
84
|
+
template: format || 'apa', // default as 'apa' style
|
|
85
|
+
lang: 'en-US'
|
|
86
|
+
})
|
|
87
|
+
return citation;
|
|
88
|
+
};
|
|
89
|
+
|
|
51
90
|
export {
|
|
52
91
|
capitalise,
|
|
53
92
|
xmlToJSON,
|
|
54
93
|
delay,
|
|
94
|
+
getCitationById,
|
|
55
95
|
};
|
package/src/components.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ declare module 'vue' {
|
|
|
10
10
|
AnnotationPopup: typeof import('./components/Tooltip/AnnotationPopup.vue')['default']
|
|
11
11
|
ConnectionDialog: typeof import('./components/DrawToolbar/ConnectionDialog.vue')['default']
|
|
12
12
|
ConnectivityGraph: typeof import('./components/ConnectivityGraph/ConnectivityGraph.vue')['default']
|
|
13
|
+
ConnectivityList: typeof import('./components/ConnectivityList/ConnectivityList.vue')['default']
|
|
13
14
|
CopyToClipboard: typeof import('./components/CopyToClipboard/CopyToClipboard.vue')['default']
|
|
14
15
|
CreateTooltipContent: typeof import('./components/Tooltip/CreateTooltipContent.vue')['default']
|
|
15
16
|
DrawToolbar: typeof import('./components/DrawToolbar/DrawToolbar.vue')['default']
|