@abi-software/map-utilities 1.4.3-beta.1 → 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,7 +10,6 @@ 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']
@@ -1,408 +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
- <el-popover
50
- width="250"
51
- trigger="hover"
52
- :teleported="false"
53
- popper-class="popover-origin-help"
54
- >
55
- <template #reference>
56
- <el-icon class="info"><el-icon-warning /></el-icon>
57
- </template>
58
- <span style="word-break: keep-all">
59
- The list is not in any specific order.<br>
60
- Specific paths can be viewed using Graph View.
61
- </span>
62
- </el-popover>
63
- </div>
64
- <div
65
- v-for="(component, i) in components"
66
- class="attribute-content"
67
- :component-item-label="component"
68
- :key="component"
69
- @mouseenter="toggleConnectivityTooltip(component, {show: true})"
70
- @mouseleave="toggleConnectivityTooltip(component, {show: false})"
71
- >
72
- {{ capitalise(component) }}
73
- </div>
74
- </div>
75
- <div
76
- v-if="destinations && destinations.length > 0"
77
- class="block"
78
- >
79
- <div class="attribute-title-container">
80
- <span class="attribute-title">Destination</span>
81
- <el-popover
82
- width="250"
83
- trigger="hover"
84
- :teleported="false"
85
- popper-class="popover-origin-help"
86
- >
87
- <template #reference>
88
- <el-icon class="info"><el-icon-warning /></el-icon>
89
- </template>
90
- <span style="word-break: keep-all">
91
- <i>Destination</i> is where the axons terminate
92
- </span>
93
- </el-popover>
94
- </div>
95
- <div
96
- v-for="(destination, i) in destinations"
97
- class="attribute-content"
98
- :destination-item-label="destination"
99
- :key="destination"
100
- @mouseenter="toggleConnectivityTooltip(destination, {show: true})"
101
- @mouseleave="toggleConnectivityTooltip(destination, {show: false})"
102
- >
103
- {{ capitalise(destination) }}
104
- </div>
105
- <el-button
106
- v-show="
107
- destinationsWithDatasets &&
108
- destinationsWithDatasets.length > 0 &&
109
- shouldShowExploreButton(destinationsWithDatasets)
110
- "
111
- class="button"
112
- @click="openAxons"
113
- >
114
- Explore destination data
115
- </el-button>
116
- </div>
117
- <div
118
- v-show="
119
- componentsWithDatasets &&
120
- componentsWithDatasets.length > 0 &&
121
- shouldShowExploreButton(componentsWithDatasets)
122
- "
123
- class="block"
124
- >
125
- <el-button
126
- class="button"
127
- @click="openAll"
128
- >
129
- Search for data on components
130
- </el-button>
131
- </div>
132
-
133
- <div class="connectivity-error-container">
134
- <div class="connectivity-error" v-if="connectivityError">
135
- <strong v-if="connectivityError.errorConnectivities">
136
- {{ connectivityError.errorConnectivities }}
137
- </strong>
138
- {{ connectivityError.errorMessage }}
139
- </div>
140
- </div>
141
- </div>
142
- </template>
143
-
144
- <script>
145
- import {
146
- Warning as ElIconWarning,
147
- } from '@element-plus/icons-vue'
148
- import {
149
- ElButton as Button,
150
- ElContainer as Container,
151
- ElIcon as Icon,
152
- } from 'element-plus'
153
- import { capitalise } from '../utilities'
154
-
155
- export default {
156
- name: 'ConnectivityList',
157
- components: {
158
- Button,
159
- Container,
160
- Icon,
161
- ElIconWarning,
162
- },
163
- props: {
164
- entry: {
165
- type: Object,
166
- default: () => ({
167
- destinations: [],
168
- origins: [],
169
- components: [],
170
- destinationsWithDatasets: [],
171
- originsWithDatasets: [],
172
- componentsWithDatasets: [],
173
- resource: undefined,
174
- featuresAlert: undefined,
175
- }),
176
- },
177
- origins: {
178
- type: Array,
179
- default: () => []
180
- },
181
- components: {
182
- type: Array,
183
- default: () => []
184
- },
185
- destinations: {
186
- type: Array,
187
- default: () => []
188
- },
189
- originsWithDatasets: {
190
- type: Array,
191
- default: () => []
192
- },
193
- componentsWithDatasets: {
194
- type: Array,
195
- default: () => []
196
- },
197
- destinationsWithDatasets: {
198
- type: Array,
199
- default: () => []
200
- },
201
- availableAnatomyFacets: {
202
- type: Array,
203
- default: () => [],
204
- },
205
- connectivityError: {
206
- type: Object,
207
- default: () => null,
208
- }
209
- },
210
- data: function () {
211
- return {
212
- originDescriptions: {
213
- motor: 'is the location of the initial cell body of the circuit',
214
- sensory: 'is the location of the initial cell body in the PNS circuit',
215
- },
216
- facetList: [],
217
- sckanVersion: '',
218
- }
219
- },
220
- watch: {
221
- availableAnatomyFacets: {
222
- handler: function (val) {
223
- this.convertFacetsToList(val)
224
- },
225
- immediate: true,
226
- deep: true,
227
- },
228
- },
229
- computed: {
230
- originDescription: function () {
231
- if (
232
- this.entry &&
233
- this.entry.title &&
234
- this.entry.title.toLowerCase().includes('motor')
235
- ) {
236
- return this.originDescriptions.motor
237
- } else {
238
- return this.originDescriptions.sensory
239
- }
240
- },
241
- },
242
- methods: {
243
- capitalise: function (text) {
244
- return capitalise(text)
245
- },
246
- toggleConnectivityTooltip: function (name, option) {
247
- this.$emit('toggle-connectivity-tooltip', {
248
- name,
249
- option
250
- });
251
- },
252
- // shouldShowExploreButton: Checks if the feature is in the list of available anatomy facets
253
- shouldShowExploreButton: function (features) {
254
- for (let i = 0; i < features.length; i++) {
255
- if (this.facetList.includes(features[i].name.toLowerCase())) {
256
- return true
257
- }
258
- }
259
- return false
260
- },
261
- // convertFacetsToList: Converts the available anatomy facets to a list for easy searching
262
- convertFacetsToList: function (facets) {
263
- facets.forEach((facet) => {
264
- if(facet.children) {
265
- this.convertFacetsToList(facet.children)
266
- } else {
267
- this.facetList.push(facet.label.toLowerCase())
268
- }
269
- })
270
- },
271
- openAll: function () {
272
- this.$emit('connectivity-action-click', {
273
- type: 'Facets',
274
- labels: this.componentsWithDatasets.map((a) => a.name.toLowerCase()),
275
- })
276
- },
277
- openAxons: function () {
278
- this.$emit('connectivity-action-click', {
279
- type: 'Facets',
280
- labels: this.destinationsWithDatasets.map((a) => a.name.toLowerCase()),
281
- })
282
- },
283
- openDendrites: function () {
284
- this.$emit('connectivity-action-click', {
285
- type: 'Facets',
286
- labels: this.originsWithDatasets.map((a) => a.name.toLowerCase()),
287
- })
288
- },
289
- }
290
- }
291
- </script>
292
-
293
- <style lang="scss" scoped>
294
- .connectivity-list {
295
- display: flex;
296
- flex-direction: column;
297
- gap: 1rem;
298
- position: relative;
299
- }
300
-
301
- .button {
302
- margin-left: 0px !important;
303
- margin-top: 0px !important;
304
- font-size: 14px !important;
305
- background-color: $app-primary-color;
306
- color: #fff;
307
-
308
- &:hover {
309
- color: #fff !important;
310
- background-color: #ac76c5 !important;
311
- border: 1px solid #ac76c5 !important;
312
- }
313
-
314
- & + .button {
315
- margin-top: 10px !important;
316
- }
317
- }
318
-
319
- .icon {
320
- right: 0px;
321
- position: absolute;
322
- top: 10px;
323
- }
324
-
325
- .icon:hover {
326
- cursor: pointer;
327
- }
328
-
329
- :deep(.popover-origin-help.el-popover) {
330
- text-transform: none !important; // need to overide the tooltip text transform
331
- border: 1px solid $app-primary-color;
332
- font-weight: 400;
333
- font-family: Asap, sans-serif, Helvetica;
334
-
335
- .el-popper__arrow {
336
- &:before {
337
- border-color: $app-primary-color;
338
- background-color: #ffffff;
339
- }
340
- }
341
- }
342
-
343
- .info {
344
- color: #8300bf;
345
- transform: rotate(180deg);
346
- margin-left: 8px;
347
- }
348
-
349
- .attribute-title-container {
350
- margin-bottom: 0.5em;
351
- }
352
-
353
- .attribute-title {
354
- font-size: 16px;
355
- font-weight: 600;
356
- /* font-weight: bold; */
357
- text-transform: uppercase;
358
- }
359
-
360
- .attribute-content {
361
- font-size: 14px;
362
- font-weight: 500;
363
- transition: color 0.25s ease;
364
- position: relative;
365
- cursor: default;
366
-
367
- &:hover {
368
- color: $app-primary-color;
369
- }
370
-
371
- + .attribute-content {
372
- &::before {
373
- content: "";
374
- width: 90%;
375
- height: 1px;
376
- background-color: var(--el-border-color);
377
- position: absolute;
378
- top: 0;
379
- left: 0;
380
- }
381
- }
382
-
383
- &:last-of-type {
384
- margin-bottom: 0.5em;
385
- }
386
- }
387
-
388
- .connectivity-error-container {
389
- position: sticky;
390
- bottom: 0.5rem;
391
- width: 100%;
392
- min-height: 31px; // placeholder
393
- margin-top: -10px !important;
394
- display: flex;
395
- flex-direction: row;
396
- align-items: center;
397
- justify-content: center;
398
- }
399
-
400
- .connectivity-error {
401
- width: fit-content;
402
- font-size: 12px;
403
- padding: 0.25rem 0.5rem;
404
- background-color: var(--el-color-error-light-9);
405
- border-radius: var(--el-border-radius-small);
406
- border: 1px solid var(--el-color-error);
407
- }
408
- </style>