@abi-software/map-utilities 1.4.3-beta.2 → 1.4.3-beta.3

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.
@@ -1,21 +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
-
7
1
  const capitalise = term => {
8
2
  if (term)
9
3
  return term.charAt(0).toUpperCase() + term.slice(1);
10
4
  return term;
11
5
  };
12
6
 
13
- const titleCase = (str) => {
14
- return str.replace(/\w\S*/g, (t) => {
15
- return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase();
16
- });
17
- };
18
-
19
7
  const convertNodeToObject = (node) => {
20
8
  const obj = {};
21
9
 
@@ -60,43 +48,8 @@ const delay = (ms) => {
60
48
  return new Promise(resolve => setTimeout(resolve, ms));
61
49
  };
62
50
 
63
- /**
64
- * @param {id} id - DOI or PMID
65
- * @param {options:type} type - type of the ID, e.g., 'pmid'
66
- * @param {options:format} format - 'apa' (default), 'chicago', 'ieee', 'bibtex', etc.
67
- * @returns {citation} formatted citation text
68
- */
69
- const getCitationById = async (id, { type, format }) => {
70
- // because 'chicago' and 'ieee' are not in citation.js default styles
71
- if ((format !== 'bibtex') && (format !== 'apa')) {
72
- const xml = `https://raw.githubusercontent.com/citation-style-language/styles/refs/heads/master/${format}.csl`;
73
- const response = await fetch(xml);
74
- const template = await response.text();
75
- let config = plugins.config.get('@csl');
76
- config.templates.add(format, template);
77
- }
78
-
79
- const option = {};
80
-
81
- if (type === 'pmid') {
82
- option['forceType'] = '@pubmed/id';
83
- }
84
-
85
- const cite = await Cite.async(id, option);
86
- const citation = (format === 'bibtex') ?
87
- cite.format(format) :
88
- cite.format('bibliography', {
89
- format: 'html',
90
- template: format || 'apa', // default as 'apa' style
91
- lang: 'en-US'
92
- })
93
- return citation;
94
- };
95
-
96
51
  export {
97
52
  capitalise,
98
- titleCase,
99
53
  xmlToJSON,
100
54
  delay,
101
- getCitationById,
102
55
  };
@@ -10,12 +10,13 @@ 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']
14
13
  CopyToClipboard: typeof import('./components/CopyToClipboard/CopyToClipboard.vue')['default']
15
14
  CreateTooltipContent: typeof import('./components/Tooltip/CreateTooltipContent.vue')['default']
16
15
  DrawToolbar: typeof import('./components/DrawToolbar/DrawToolbar.vue')['default']
17
16
  ElButton: typeof import('element-plus/es')['ElButton']
17
+ ElCard: typeof import('element-plus/es')['ElCard']
18
18
  ElCol: typeof import('element-plus/es')['ElCol']
19
+ ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
19
20
  ElContainer: typeof import('element-plus/es')['ElContainer']
20
21
  ElHeader: typeof import('element-plus/es')['ElHeader']
21
22
  ElIcon: typeof import('element-plus/es')['ElIcon']
@@ -23,6 +24,7 @@ declare module 'vue' {
23
24
  ElIconArrowDown: typeof import('@element-plus/icons-vue')['ArrowDown']
24
25
  ElIconArrowUp: typeof import('@element-plus/icons-vue')['ArrowUp']
25
26
  ElIconClose: typeof import('@element-plus/icons-vue')['Close']
27
+ ElIconCopyDocument: typeof import('@element-plus/icons-vue')['CopyDocument']
26
28
  ElIconDelete: typeof import('@element-plus/icons-vue')['Delete']
27
29
  ElIconEdit: typeof import('@element-plus/icons-vue')['Edit']
28
30
  ElIconFinished: typeof import('@element-plus/icons-vue')['Finished']
@@ -38,6 +40,7 @@ declare module 'vue' {
38
40
  ElRow: typeof import('element-plus/es')['ElRow']
39
41
  ElSelect: typeof import('element-plus/es')['ElSelect']
40
42
  ElTooltip: typeof import('element-plus/es')['ElTooltip']
43
+ ElTree: typeof import('element-plus/es')['ElTree']
41
44
  ExternalResourceCard: typeof import('./components/Tooltip/ExternalResourceCard.vue')['default']
42
45
  HelpModeDialog: typeof import('./components/HelpModeDialog/HelpModeDialog.vue')['default']
43
46
  ProvenancePopup: typeof import('./components/Tooltip/ProvenancePopup.vue')['default']
@@ -1,394 +0,0 @@
1
- <template>
2
- <div class="connectivity-list">
3
- {{ entry.paths }}
4
- <div v-if="origins && origins.length > 0" class="block">
5
- <div class="attribute-title-container">
6
- <span class="attribute-title">Origin</span>
7
- <el-popover
8
- width="250"
9
- trigger="hover"
10
- :teleported="false"
11
- popper-class="popover-origin-help"
12
- >
13
- <template #reference>
14
- <el-icon class="info"><el-icon-warning /></el-icon>
15
- </template>
16
- <span style="word-break: keep-all">
17
- <i>Origin</i> {{ originDescription }}
18
- </span>
19
- </el-popover>
20
- </div>
21
- <div
22
- v-for="(origin, i) in origins"
23
- class="attribute-content"
24
- :origin-item-label="origin"
25
- :key="origin"
26
- @mouseenter="toggleConnectivityTooltip(origin, {show: true})"
27
- @mouseleave="toggleConnectivityTooltip(origin, {show: false})"
28
- >
29
- {{ capitalise(origin) }}
30
- </div>
31
- <el-button
32
- v-show="
33
- originsWithDatasets && originsWithDatasets.length > 0 &&
34
- shouldShowExploreButton(originsWithDatasets)
35
- "
36
- class="button"
37
- id="open-dendrites-button"
38
- @click="openDendrites"
39
- >
40
- Explore origin data
41
- </el-button>
42
- </div>
43
- <div
44
- v-if="components && components.length > 0"
45
- class="block"
46
- >
47
- <div class="attribute-title-container">
48
- <span class="attribute-title">Components</span>
49
- </div>
50
- <div
51
- v-for="(component, i) in components"
52
- class="attribute-content"
53
- :component-item-label="component"
54
- :key="component"
55
- @mouseenter="toggleConnectivityTooltip(component, {show: true})"
56
- @mouseleave="toggleConnectivityTooltip(component, {show: false})"
57
- >
58
- {{ capitalise(component) }}
59
- </div>
60
- </div>
61
- <div
62
- v-if="destinations && destinations.length > 0"
63
- class="block"
64
- >
65
- <div class="attribute-title-container">
66
- <span class="attribute-title">Destination</span>
67
- <el-popover
68
- width="250"
69
- trigger="hover"
70
- :teleported="false"
71
- popper-class="popover-origin-help"
72
- >
73
- <template #reference>
74
- <el-icon class="info"><el-icon-warning /></el-icon>
75
- </template>
76
- <span style="word-break: keep-all">
77
- <i>Destination</i> is where the axons terminate
78
- </span>
79
- </el-popover>
80
- </div>
81
- <div
82
- v-for="(destination, i) in destinations"
83
- class="attribute-content"
84
- :destination-item-label="destination"
85
- :key="destination"
86
- @mouseenter="toggleConnectivityTooltip(destination, {show: true})"
87
- @mouseleave="toggleConnectivityTooltip(destination, {show: false})"
88
- >
89
- {{ capitalise(destination) }}
90
- </div>
91
- <el-button
92
- v-show="
93
- destinationsWithDatasets &&
94
- destinationsWithDatasets.length > 0 &&
95
- shouldShowExploreButton(destinationsWithDatasets)
96
- "
97
- class="button"
98
- @click="openAxons"
99
- >
100
- Explore destination data
101
- </el-button>
102
- </div>
103
- <div
104
- v-show="
105
- componentsWithDatasets &&
106
- componentsWithDatasets.length > 0 &&
107
- shouldShowExploreButton(componentsWithDatasets)
108
- "
109
- class="block"
110
- >
111
- <el-button
112
- class="button"
113
- @click="openAll"
114
- >
115
- Search for data on components
116
- </el-button>
117
- </div>
118
-
119
- <div class="connectivity-error-container">
120
- <div class="connectivity-error" v-if="connectivityError">
121
- <strong v-if="connectivityError.errorConnectivities">
122
- {{ connectivityError.errorConnectivities }}
123
- </strong>
124
- {{ connectivityError.errorMessage }}
125
- </div>
126
- </div>
127
- </div>
128
- </template>
129
-
130
- <script>
131
- import {
132
- Warning as ElIconWarning,
133
- } from '@element-plus/icons-vue'
134
- import {
135
- ElButton as Button,
136
- ElContainer as Container,
137
- ElIcon as Icon,
138
- } from 'element-plus'
139
- import { capitalise } from '../utilities'
140
-
141
- export default {
142
- name: 'ConnectivityList',
143
- components: {
144
- Button,
145
- Container,
146
- Icon,
147
- ElIconWarning,
148
- },
149
- props: {
150
- entry: {
151
- type: Object,
152
- default: () => ({
153
- destinations: [],
154
- origins: [],
155
- components: [],
156
- destinationsWithDatasets: [],
157
- originsWithDatasets: [],
158
- componentsWithDatasets: [],
159
- resource: undefined,
160
- featuresAlert: undefined,
161
- }),
162
- },
163
- origins: {
164
- type: Array,
165
- default: () => []
166
- },
167
- components: {
168
- type: Array,
169
- default: () => []
170
- },
171
- destinations: {
172
- type: Array,
173
- default: () => []
174
- },
175
- originsWithDatasets: {
176
- type: Array,
177
- default: () => []
178
- },
179
- componentsWithDatasets: {
180
- type: Array,
181
- default: () => []
182
- },
183
- destinationsWithDatasets: {
184
- type: Array,
185
- default: () => []
186
- },
187
- availableAnatomyFacets: {
188
- type: Array,
189
- default: () => [],
190
- },
191
- connectivityError: {
192
- type: Object,
193
- default: () => null,
194
- }
195
- },
196
- data: function () {
197
- return {
198
- originDescriptions: {
199
- motor: 'is the location of the initial cell body of the circuit',
200
- sensory: 'is the location of the initial cell body in the PNS circuit',
201
- },
202
- facetList: [],
203
- sckanVersion: '',
204
- }
205
- },
206
- watch: {
207
- availableAnatomyFacets: {
208
- handler: function (val) {
209
- this.convertFacetsToList(val)
210
- },
211
- immediate: true,
212
- deep: true,
213
- },
214
- },
215
- computed: {
216
- originDescription: function () {
217
- if (
218
- this.entry &&
219
- this.entry.title &&
220
- this.entry.title.toLowerCase().includes('motor')
221
- ) {
222
- return this.originDescriptions.motor
223
- } else {
224
- return this.originDescriptions.sensory
225
- }
226
- },
227
- },
228
- methods: {
229
- capitalise: function (text) {
230
- return capitalise(text)
231
- },
232
- toggleConnectivityTooltip: function (name, option) {
233
- this.$emit('toggle-connectivity-tooltip', {
234
- name,
235
- option
236
- });
237
- },
238
- // shouldShowExploreButton: Checks if the feature is in the list of available anatomy facets
239
- shouldShowExploreButton: function (features) {
240
- for (let i = 0; i < features.length; i++) {
241
- if (this.facetList.includes(features[i].name.toLowerCase())) {
242
- return true
243
- }
244
- }
245
- return false
246
- },
247
- // convertFacetsToList: Converts the available anatomy facets to a list for easy searching
248
- convertFacetsToList: function (facets) {
249
- facets.forEach((facet) => {
250
- if(facet.children) {
251
- this.convertFacetsToList(facet.children)
252
- } else {
253
- this.facetList.push(facet.label.toLowerCase())
254
- }
255
- })
256
- },
257
- openAll: function () {
258
- this.$emit('connectivity-action-click', {
259
- type: 'Facets',
260
- labels: this.componentsWithDatasets.map((a) => a.name.toLowerCase()),
261
- })
262
- },
263
- openAxons: function () {
264
- this.$emit('connectivity-action-click', {
265
- type: 'Facets',
266
- labels: this.destinationsWithDatasets.map((a) => a.name.toLowerCase()),
267
- })
268
- },
269
- openDendrites: function () {
270
- this.$emit('connectivity-action-click', {
271
- type: 'Facets',
272
- labels: this.originsWithDatasets.map((a) => a.name.toLowerCase()),
273
- })
274
- },
275
- }
276
- }
277
- </script>
278
-
279
- <style lang="scss" scoped>
280
- .connectivity-list {
281
- display: flex;
282
- flex-direction: column;
283
- gap: 1rem;
284
- position: relative;
285
- }
286
-
287
- .button {
288
- margin-left: 0px !important;
289
- margin-top: 0px !important;
290
- font-size: 14px !important;
291
- background-color: $app-primary-color;
292
- color: #fff;
293
-
294
- &:hover {
295
- color: #fff !important;
296
- background-color: #ac76c5 !important;
297
- border: 1px solid #ac76c5 !important;
298
- }
299
-
300
- & + .button {
301
- margin-top: 10px !important;
302
- }
303
- }
304
-
305
- .icon {
306
- right: 0px;
307
- position: absolute;
308
- top: 10px;
309
- }
310
-
311
- .icon:hover {
312
- cursor: pointer;
313
- }
314
-
315
- :deep(.popover-origin-help.el-popover) {
316
- text-transform: none !important; // need to overide the tooltip text transform
317
- border: 1px solid $app-primary-color;
318
- font-weight: 400;
319
- font-family: Asap, sans-serif, Helvetica;
320
-
321
- .el-popper__arrow {
322
- &:before {
323
- border-color: $app-primary-color;
324
- background-color: #ffffff;
325
- }
326
- }
327
- }
328
-
329
- .info {
330
- color: #8300bf;
331
- transform: rotate(180deg);
332
- margin-left: 8px;
333
- }
334
-
335
- .attribute-title-container {
336
- margin-bottom: 0.5em;
337
- }
338
-
339
- .attribute-title {
340
- font-size: 16px;
341
- font-weight: 600;
342
- /* font-weight: bold; */
343
- text-transform: uppercase;
344
- }
345
-
346
- .attribute-content {
347
- font-size: 14px;
348
- font-weight: 500;
349
- transition: color 0.25s ease;
350
- position: relative;
351
- cursor: default;
352
-
353
- &:hover {
354
- color: $app-primary-color;
355
- }
356
-
357
- + .attribute-content {
358
- &::before {
359
- content: "";
360
- width: 90%;
361
- height: 1px;
362
- background-color: var(--el-border-color);
363
- position: absolute;
364
- top: 0;
365
- left: 0;
366
- }
367
- }
368
-
369
- &:last-of-type {
370
- margin-bottom: 0.5em;
371
- }
372
- }
373
-
374
- .connectivity-error-container {
375
- position: sticky;
376
- bottom: 0.5rem;
377
- width: 100%;
378
- min-height: 31px; // placeholder
379
- margin-top: -10px !important;
380
- display: flex;
381
- flex-direction: row;
382
- align-items: center;
383
- justify-content: center;
384
- }
385
-
386
- .connectivity-error {
387
- width: fit-content;
388
- font-size: 12px;
389
- padding: 0.25rem 0.5rem;
390
- background-color: var(--el-color-error-light-9);
391
- border-radius: var(--el-border-radius-small);
392
- border: 1px solid var(--el-color-error);
393
- }
394
- </style>