@abi-software/flatmapvuer 0.5.9 → 0.6.0-vue3-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/babel.config.js +0 -14
  2. package/dist/favicon.ico +0 -0
  3. package/dist/flatmapvuer.js +69542 -0
  4. package/dist/flatmapvuer.umd.cjs +1021 -0
  5. package/dist/index.html +17 -0
  6. package/dist/style.css +1 -0
  7. package/package.json +29 -21
  8. package/src/App.vue +180 -105
  9. package/src/assets/styles.scss +2 -3
  10. package/src/components/AnnotationTool.vue +193 -153
  11. package/src/components/EventBus.js +3 -3
  12. package/src/components/ExternalResourceCard.vue +39 -30
  13. package/src/components/FlatmapVuer.vue +734 -676
  14. package/src/components/MultiFlatmapVuer.vue +313 -246
  15. package/src/components/ProvenancePopup.vue +195 -121
  16. package/src/components/SelectionsGroup.vue +93 -84
  17. package/src/components/Tooltip.vue +11 -13
  18. package/src/components/TreeControls.vue +67 -64
  19. package/src/components/index.js +4 -7
  20. package/src/components/legends/DynamicLegends.vue +13 -19
  21. package/src/components/legends/SvgLegends.vue +72 -27
  22. package/src/components.d.ts +46 -0
  23. package/src/icons/flatmap-marker.js +1 -1
  24. package/src/icons/fonts/mapicon-species.eot +0 -0
  25. package/src/icons/fonts/mapicon-species.svg +0 -0
  26. package/src/icons/yellowstar.js +2 -2
  27. package/src/legends/legend.svg +0 -0
  28. package/src/main.js +2 -6
  29. package/src/services/flatmapQueries.js +175 -139
  30. package/vite.config.js +76 -0
  31. package/vue.config.js +14 -0
  32. package/CHANGELOG.md +0 -402
  33. package/dist/demo.html +0 -10
  34. package/dist/flatmapvuer.common.js +0 -22741
  35. package/dist/flatmapvuer.common.js.map +0 -1
  36. package/dist/flatmapvuer.css +0 -1
  37. package/dist/flatmapvuer.umd.js +0 -22751
  38. package/dist/flatmapvuer.umd.js.map +0 -1
  39. package/dist/flatmapvuer.umd.min.js +0 -4
  40. package/dist/flatmapvuer.umd.min.js.map +0 -1
  41. package/package-lock.json +0 -18473
@@ -1,46 +1,47 @@
1
1
  /* eslint-disable no-alert, no-console */
2
2
  // remove duplicates by stringifying the objects
3
- const removeDuplicates = function(arrayOfAnything){
4
- return [...new Set(arrayOfAnything.map(e => JSON.stringify(e)))].map(e => JSON.parse(e))
3
+ const removeDuplicates = function (arrayOfAnything) {
4
+ return [...new Set(arrayOfAnything.map((e) => JSON.stringify(e)))].map((e) =>
5
+ JSON.parse(e)
6
+ )
5
7
  }
6
8
 
7
- const cachedLabels = {};
9
+ const cachedLabels = {}
8
10
 
9
- const findTaxonomyLabel = async function(flatmapAPI, taxonomy){
11
+ const findTaxonomyLabel = async function (flatmapAPI, taxonomy) {
10
12
  if (cachedLabels && cachedLabels.hasOwnProperty(taxonomy)) {
11
- return cachedLabels[taxonomy];
13
+ return cachedLabels[taxonomy]
12
14
  }
13
15
 
14
- return new Promise(resolve=>{
16
+ return new Promise((resolve) => {
15
17
  fetch(`${flatmapAPI}knowledge/label/${taxonomy}`, {
16
18
  method: 'GET',
17
19
  })
18
- .then(response => response.json())
19
- .then(data => {
20
- let label = data.label;
21
- if (label === "Mammalia") {
22
- label = "Mammalia not otherwise specified";
23
- }
24
- cachedLabels[taxonomy] = label;
25
- resolve(label);
26
- })
27
- .catch((error) => {
28
- console.error('Error:', error);
29
- cachedLabels[taxonomy] = taxonomy;
30
- resolve(taxonomy);
31
- })
32
- });
20
+ .then((response) => response.json())
21
+ .then((data) => {
22
+ let label = data.label
23
+ if (label === 'Mammalia') {
24
+ label = 'Mammalia not otherwise specified'
25
+ }
26
+ cachedLabels[taxonomy] = label
27
+ resolve(label)
28
+ })
29
+ .catch((error) => {
30
+ console.error('Error:', error)
31
+ cachedLabels[taxonomy] = taxonomy
32
+ resolve(taxonomy)
33
+ })
34
+ })
33
35
  }
34
36
 
35
- const inArray = function(ar1, ar2){
37
+ const inArray = function (ar1, ar2) {
36
38
  let as1 = JSON.stringify(ar1)
37
39
  let as2 = JSON.stringify(ar2)
38
40
  return as1.indexOf(as2) !== -1
39
41
  }
40
42
 
41
- let FlatmapQueries = function(){
42
-
43
- this.initialise = function(flatmapApi){
43
+ let FlatmapQueries = function () {
44
+ this.initialise = function (flatmapApi) {
44
45
  this.flatmapApi = flatmapApi
45
46
  this.destinations = []
46
47
  this.origins = []
@@ -53,21 +54,29 @@ let FlatmapQueries = function(){
53
54
 
54
55
  this.createTooltipData = async function (eventData) {
55
56
  let hyperlinks = []
56
- if (eventData.feature.hyperlinks && eventData.feature.hyperlinks.length > 0) {
57
+ if (
58
+ eventData.feature.hyperlinks &&
59
+ eventData.feature.hyperlinks.length > 0
60
+ ) {
57
61
  hyperlinks = eventData.feature.hyperlinks
58
62
  } else {
59
- hyperlinks = this.urls.map(url=>({url: url, id: "pubmed"}))
63
+ hyperlinks = this.urls.map((url) => ({ url: url, id: 'pubmed' }))
60
64
  }
61
- let taxonomyLabel = undefined;
65
+ let taxonomyLabel = undefined
62
66
  if (eventData.provenanceTaxonomy) {
63
- taxonomyLabel = [];
67
+ taxonomyLabel = []
64
68
  for (let i = 0; eventData.provenanceTaxonomy.length > i; i++) {
65
- taxonomyLabel.push(await findTaxonomyLabel(this.flatmapAPI, eventData.provenanceTaxonomy[i]))
69
+ taxonomyLabel.push(
70
+ await findTaxonomyLabel(
71
+ this.flatmapAPI,
72
+ eventData.provenanceTaxonomy[i]
73
+ )
74
+ )
66
75
  }
67
76
  }
68
77
 
69
78
  let tooltipData = {
70
- destinations: this.destinations,
79
+ destinations: this.destinations,
71
80
  origins: this.origins,
72
81
  components: this.components,
73
82
  destinationsWithDatasets: this.destinationsWithDatasets,
@@ -77,48 +86,48 @@ let FlatmapQueries = function(){
77
86
  featureId: eventData.resource,
78
87
  hyperlinks: hyperlinks,
79
88
  provenanceTaxonomy: eventData.provenanceTaxonomy,
80
- provenanceTaxonomyLabel: taxonomyLabel
89
+ provenanceTaxonomyLabel: taxonomyLabel,
81
90
  }
82
91
  return tooltipData
83
92
  }
84
93
 
85
- this.createComponentsLabelList = function(components, lookUp){
94
+ this.createComponentsLabelList = function (components, lookUp) {
86
95
  let labelList = []
87
- components.forEach(n=>{
96
+ components.forEach((n) => {
88
97
  labelList.push(this.createLabelFromNeuralNode(n[0]), lookUp)
89
- if (n.length === 2){
98
+ if (n.length === 2) {
90
99
  labelList.push(this.createLabelFromNeuralNode(n[1]), lookUp)
91
100
  }
92
101
  })
93
102
  return labelList
94
103
  }
95
104
 
96
- this.createLabelLookup = function(uberons) {
97
- return new Promise(resolve=> {
105
+ this.createLabelLookup = function (uberons) {
106
+ return new Promise((resolve) => {
98
107
  let uberonMap = {}
99
108
  this.uberons = []
100
- const data = { sql: this.buildLabelSqlStatement(uberons)}
109
+ const data = { sql: this.buildLabelSqlStatement(uberons) }
101
110
  fetch(`${this.flatmapApi}knowledge/query/`, {
102
- method: 'POST',
103
- headers: {
104
- 'Content-Type': 'application/json',
105
- },
106
- body: JSON.stringify(data),
107
- })
108
- .then(response => response.json())
109
- .then(payload => {
110
- const entity = payload.keys.indexOf("entity");
111
- const label = payload.keys.indexOf("label");
111
+ method: 'POST',
112
+ headers: {
113
+ 'Content-Type': 'application/json',
114
+ },
115
+ body: JSON.stringify(data),
116
+ })
117
+ .then((response) => response.json())
118
+ .then((payload) => {
119
+ const entity = payload.keys.indexOf('entity')
120
+ const label = payload.keys.indexOf('label')
112
121
  if (entity > -1 && label > -1) {
113
- payload.values.forEach(pair => {
114
- uberonMap[pair[entity]] = pair[label];
122
+ payload.values.forEach((pair) => {
123
+ uberonMap[pair[entity]] = pair[label]
115
124
  this.uberons.push({
116
125
  id: pair[entity],
117
- name: pair[label]
126
+ name: pair[label],
118
127
  })
119
- });
128
+ })
120
129
  }
121
- resolve(uberonMap)
130
+ resolve(uberonMap)
122
131
  })
123
132
  })
124
133
  }
@@ -151,21 +160,21 @@ let FlatmapQueries = function(){
151
160
  let dnodes = connectivity.connectivity.flat() // get nodes from edgelist
152
161
  let nodes = [...new Set(dnodes)] // remove duplicates
153
162
  let found = []
154
- nodes.forEach(n => {
163
+ nodes.forEach((n) => {
155
164
  if (Array.isArray(n)) {
156
165
  found.push(n.flat())
157
166
  } else {
158
167
  found.push(n)
159
168
  }
160
169
  })
161
- return [... new Set(found.flat())]
170
+ return [...new Set(found.flat())]
162
171
  }
163
172
 
164
173
  this.flattenConntectivity = function (connectivity) {
165
174
  let dnodes = connectivity.flat() // get nodes from edgelist
166
175
  let nodes = [...new Set(dnodes)] // remove duplicates
167
176
  let found = []
168
- nodes.forEach(n => {
177
+ nodes.forEach((n) => {
169
178
  if (Array.isArray(n)) {
170
179
  found.push(n.flat())
171
180
  } else {
@@ -181,7 +190,7 @@ let FlatmapQueries = function(){
181
190
 
182
191
  let found = []
183
192
  let terminal = false
184
- nodes.forEach(node => {
193
+ nodes.forEach((node) => {
185
194
  terminal = false
186
195
  // Check if the node is an destination or origin (note that they are labelled dendrite and axon as opposed to origin and destination)
187
196
  if (inArray(connectivity.axons, node)) {
@@ -198,34 +207,34 @@ let FlatmapQueries = function(){
198
207
  return found
199
208
  }
200
209
 
201
- this.retrieveFlatmapKnowledgeForEvent = async function(eventData){
202
- // check if there is an existing query
203
- if (this.controller) this.controller.abort();
210
+ this.retrieveFlatmapKnowledgeForEvent = async function (eventData) {
211
+ // check if there is an existing query
212
+ if (this.controller) this.controller.abort()
204
213
 
205
- // set up the abort controller
206
- this.controller = new AbortController();
207
- const signal = this.controller.signal;
214
+ // set up the abort controller
215
+ this.controller = new AbortController()
216
+ const signal = this.controller.signal
208
217
 
209
- const keastIds = eventData.resource
210
- this.destinations = []
211
- this.origins = []
212
- this.components = []
213
- if (!keastIds || keastIds.length == 0) return
214
- const data = { sql: this.buildConnectivitySqlStatement(keastIds)};
215
- let prom1 = new Promise(resolve=>{
216
- fetch(`${this.flatmapApi}knowledge/query/`, {
217
- method: 'POST',
218
- headers: {
219
- 'Content-Type': 'application/json',
220
- },
221
- body: JSON.stringify(data),
222
- signal: signal
223
- })
224
- .then(response => response.json())
225
- .then(data => {
226
- if(this.connectivityExists(data)){
218
+ const keastIds = eventData.resource
219
+ this.destinations = []
220
+ this.origins = []
221
+ this.components = []
222
+ if (!keastIds || keastIds.length == 0) return
223
+ const data = { sql: this.buildConnectivitySqlStatement(keastIds) }
224
+ let prom1 = new Promise((resolve) => {
225
+ fetch(`${this.flatmapApi}knowledge/query/`, {
226
+ method: 'POST',
227
+ headers: {
228
+ 'Content-Type': 'application/json',
229
+ },
230
+ body: JSON.stringify(data),
231
+ signal: signal,
232
+ })
233
+ .then((response) => response.json())
234
+ .then((data) => {
235
+ if (this.connectivityExists(data)) {
227
236
  let connectivity = JSON.parse(data.values[0][0])
228
- this.processConnectivity(connectivity).then(()=>{
237
+ this.processConnectivity(connectivity).then(() => {
229
238
  resolve(true)
230
239
  })
231
240
  } else {
@@ -233,29 +242,34 @@ let FlatmapQueries = function(){
233
242
  }
234
243
  })
235
244
  .catch((error) => {
236
- console.error('Error:', error);
245
+ console.error('Error:', error)
237
246
  resolve(false)
238
247
  })
239
- })
240
- let prom2 = await this.pubmedQueryOnIds(eventData)
241
- let results = await Promise.all([prom1, prom2])
242
- return results
248
+ })
249
+ let prom2 = await this.pubmedQueryOnIds(eventData)
250
+ let results = await Promise.all([prom1, prom2])
251
+ return results
243
252
  }
244
253
 
245
- this.connectivityExists = function(data){
246
- if (data.values && data.values.length > 0 && JSON.parse(data.values[0][0]).connectivity && JSON.parse(data.values[0][0]).connectivity.length > 0) {
254
+ this.connectivityExists = function (data) {
255
+ if (
256
+ data.values &&
257
+ data.values.length > 0 &&
258
+ JSON.parse(data.values[0][0]).connectivity &&
259
+ JSON.parse(data.values[0][0]).connectivity.length > 0
260
+ ) {
247
261
  return true
248
262
  } else {
249
263
  return false
250
264
  }
251
265
  }
252
266
 
253
- this.createLabelFromNeuralNode = function(node, lookUp){
267
+ this.createLabelFromNeuralNode = function (node, lookUp) {
254
268
  let label = lookUp[node[0]]
255
- if (node.length === 2 && node[1].length > 0){
256
- node[1].forEach(n=>{
257
- if (lookUp[n] == undefined){
258
- label += `, ${n}`
269
+ if (node.length === 2 && node[1].length > 0) {
270
+ node[1].forEach((n) => {
271
+ if (lookUp[n] == undefined) {
272
+ label += `, ${n}`
259
273
  } else {
260
274
  label += `, ${lookUp[n]}`
261
275
  }
@@ -264,21 +278,26 @@ let FlatmapQueries = function(){
264
278
  return label
265
279
  }
266
280
 
267
- this.flattenAndFindDatasets = function(components, axons, dendrites){
268
-
281
+ this.flattenAndFindDatasets = function (components, axons, dendrites) {
269
282
  // process the nodes for finding datasets (Note this is not critical to the tooltip, only for the 'search on components' button)
270
283
  let componentsFlat = this.flattenConntectivity(components)
271
284
  let axonsFlat = this.flattenConntectivity(axons)
272
285
  let dendritesFlat = this.flattenConntectivity(dendrites)
273
286
 
274
287
  // Filter for the anatomy which is annotated on datasets
275
- this.destinationsWithDatasets = this.uberons.filter(ub => axonsFlat.indexOf(ub.id) !== -1)
276
- this.originsWithDatasets = this.uberons.filter(ub => dendritesFlat.indexOf(ub.id) !== -1)
277
- this.componentsWithDatasets = this.uberons.filter(ub => componentsFlat.indexOf(ub.id) !== -1)
288
+ this.destinationsWithDatasets = this.uberons.filter(
289
+ (ub) => axonsFlat.indexOf(ub.id) !== -1
290
+ )
291
+ this.originsWithDatasets = this.uberons.filter(
292
+ (ub) => dendritesFlat.indexOf(ub.id) !== -1
293
+ )
294
+ this.componentsWithDatasets = this.uberons.filter(
295
+ (ub) => componentsFlat.indexOf(ub.id) !== -1
296
+ )
278
297
  }
279
298
 
280
- this.processConnectivity = function(connectivity){
281
- return new Promise (resolve=>{
299
+ this.processConnectivity = function (connectivity) {
300
+ return new Promise((resolve) => {
282
301
  // Filter the origin and destinations from components
283
302
  let components = this.findComponents(connectivity)
284
303
 
@@ -287,25 +306,31 @@ let FlatmapQueries = function(){
287
306
  let dendrites = removeDuplicates(connectivity.dendrites)
288
307
 
289
308
  // Create list of ids to get labels for
290
- let conIds = this.findAllIdsFromConnectivity(connectivity)
309
+ let conIds = this.findAllIdsFromConnectivity(connectivity)
291
310
 
292
311
  // Create readable labels from the nodes. Setting this to 'this.origins' updates the display
293
- this.createLabelLookup(conIds).then(lookUp=>{
294
- this.destinations = axons.map(a=>this.createLabelFromNeuralNode(a,lookUp))
295
- this.origins = dendrites.map(d=>this.createLabelFromNeuralNode(d,lookUp))
296
- this.components = components.map(c=>this.createLabelFromNeuralNode(c, lookUp))
312
+ this.createLabelLookup(conIds).then((lookUp) => {
313
+ this.destinations = axons.map((a) =>
314
+ this.createLabelFromNeuralNode(a, lookUp)
315
+ )
316
+ this.origins = dendrites.map((d) =>
317
+ this.createLabelFromNeuralNode(d, lookUp)
318
+ )
319
+ this.components = components.map((c) =>
320
+ this.createLabelFromNeuralNode(c, lookUp)
321
+ )
297
322
  this.flattenAndFindDatasets(components, axons, dendrites)
298
323
  resolve(true)
299
324
  })
300
325
  })
301
326
  }
302
327
 
303
- this.flattenConntectivity = function(connectivity){
328
+ this.flattenConntectivity = function (connectivity) {
304
329
  let dnodes = connectivity.flat() // get nodes from edgelist
305
330
  let nodes = [...new Set(dnodes)] // remove duplicates
306
331
  let found = []
307
- nodes.forEach(n=>{
308
- if (Array.isArray(n)){
332
+ nodes.forEach((n) => {
333
+ if (Array.isArray(n)) {
309
334
  found.push(n.flat())
310
335
  } else {
311
336
  found.push(n)
@@ -314,22 +339,22 @@ let FlatmapQueries = function(){
314
339
  return found.flat()
315
340
  }
316
341
 
317
- this.findComponents = function(connectivity){
342
+ this.findComponents = function (connectivity) {
318
343
  let dnodes = connectivity.connectivity.flat() // get nodes from edgelist
319
344
  let nodes = removeDuplicates(dnodes)
320
345
 
321
346
  let found = []
322
347
  let terminal = false
323
- nodes.forEach(node=>{
348
+ nodes.forEach((node) => {
324
349
  terminal = false
325
350
  // Check if the node is an destination or origin (note that they are labelled dendrite and axon as opposed to origin and destination)
326
- if(inArray(connectivity.axons,node)){
351
+ if (inArray(connectivity.axons, node)) {
327
352
  terminal = true
328
353
  }
329
- if(inArray(connectivity.dendrites, node)){
354
+ if (inArray(connectivity.dendrites, node)) {
330
355
  terminal = true
331
356
  }
332
- if (!terminal){
357
+ if (!terminal) {
333
358
  found.push(node)
334
359
  }
335
360
  })
@@ -337,11 +362,11 @@ let FlatmapQueries = function(){
337
362
  return found
338
363
  }
339
364
 
340
- this.stripPMIDPrefix = function (pubmedId){
365
+ this.stripPMIDPrefix = function (pubmedId) {
341
366
  return pubmedId.split(':')[1]
342
367
  }
343
368
 
344
- this.buildPubmedSqlStatement = function(keastIds) {
369
+ this.buildPubmedSqlStatement = function (keastIds) {
345
370
  let sql = 'select distinct publication from publications where entity in ('
346
371
  if (keastIds.length === 1) {
347
372
  sql += `'${keastIds[0]}')`
@@ -353,12 +378,12 @@ let FlatmapQueries = function(){
353
378
  return sql
354
379
  }
355
380
 
356
- this.buildPubmedSqlStatementForModels = function(model) {
381
+ this.buildPubmedSqlStatementForModels = function (model) {
357
382
  return `select distinct publication from publications where entity = '${model}'`
358
383
  }
359
384
 
360
- this.flatmapQuery = function(sql){
361
- const data = { sql: sql}
385
+ this.flatmapQuery = function (sql) {
386
+ const data = { sql: sql }
362
387
  return fetch(`${this.flatmapApi}knowledge/query/`, {
363
388
  method: 'POST',
364
389
  headers: {
@@ -366,25 +391,30 @@ let FlatmapQueries = function(){
366
391
  },
367
392
  body: JSON.stringify(data),
368
393
  })
369
- .then(response => response.json())
370
- .catch((error) => {
371
- console.error('Error:', error)
372
- })
394
+ .then((response) => response.json())
395
+ .catch((error) => {
396
+ console.error('Error:', error)
397
+ })
373
398
  }
374
399
  // Note that this functin WILL run to the end, as it doesn not catch the second level of promises
375
- this.pubmedQueryOnIds = function(eventData){
376
- return new Promise(resolve=>{
400
+ this.pubmedQueryOnIds = function (eventData) {
401
+ return new Promise((resolve) => {
377
402
  const keastIds = eventData.resource
378
403
  const source = eventData.feature.source
379
- if(!keastIds || keastIds.length === 0) return
404
+ if (!keastIds || keastIds.length === 0) return
380
405
  const sql = this.buildPubmedSqlStatement(keastIds)
381
- this.flatmapQuery(sql).then(data=>{
406
+ this.flatmapQuery(sql).then((data) => {
382
407
  // Create pubmed url on paths if we have them
383
- if (data.values.length > 0){
384
- this.urls = [this.pubmedSearchUrl(data.values.map(id=>this.stripPMIDPrefix(id[0])))]
408
+ if (data.values.length > 0) {
409
+ this.urls = [
410
+ this.pubmedSearchUrl(
411
+ data.values.map((id) => this.stripPMIDPrefix(id[0]))
412
+ ),
413
+ ]
385
414
  resolve(true)
386
- } else { // Create pubmed url on models
387
- this.pubmedQueryOnModels(source).then(result=>{
415
+ } else {
416
+ // Create pubmed url on models
417
+ this.pubmedQueryOnModels(source).then((result) => {
388
418
  resolve(result)
389
419
  })
390
420
  }
@@ -392,19 +422,25 @@ let FlatmapQueries = function(){
392
422
  })
393
423
  }
394
424
 
395
- this.pubmedQueryOnModels = function(source){
396
- return this.flatmapQuery(this.buildPubmedSqlStatementForModels(source)).then(data=>{
397
- if (Array.isArray(data.values) && data.values.length > 0){
398
- this.urls = [this.pubmedSearchUrl(data.values.map(id=>this.stripPMIDPrefix(id[0])))]
425
+ this.pubmedQueryOnModels = function (source) {
426
+ return this.flatmapQuery(
427
+ this.buildPubmedSqlStatementForModels(source)
428
+ ).then((data) => {
429
+ if (Array.isArray(data.values) && data.values.length > 0) {
430
+ this.urls = [
431
+ this.pubmedSearchUrl(
432
+ data.values.map((id) => this.stripPMIDPrefix(id[0]))
433
+ ),
434
+ ]
399
435
  return true
400
436
  } else {
401
- this.urls = [] // Clears the pubmed search button
402
- }
437
+ this.urls = [] // Clears the pubmed search button
438
+ }
403
439
  return false
404
440
  })
405
441
  }
406
442
 
407
- this.pubmedSearchUrl = function(ids) {
443
+ this.pubmedSearchUrl = function (ids) {
408
444
  let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
409
445
  let params = new URLSearchParams()
410
446
  params.append('term', ids)
@@ -412,4 +448,4 @@ let FlatmapQueries = function(){
412
448
  }
413
449
  }
414
450
 
415
- export {FlatmapQueries, findTaxonomyLabel}
451
+ export { FlatmapQueries, findTaxonomyLabel }
package/vite.config.js ADDED
@@ -0,0 +1,76 @@
1
+ import path from "path";
2
+ const pathSrc = path.resolve(__dirname, "./src");
3
+ import { defineConfig } from 'vite'
4
+ import vue from '@vitejs/plugin-vue'
5
+ import Components from 'unplugin-vue-components/vite'
6
+ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
7
+ import Unocss from 'unocss/vite'
8
+ import {
9
+ presetAttributify,
10
+ presetIcons,
11
+ presetUno,
12
+ transformerDirectives,
13
+ transformerVariantGroup,
14
+ } from 'unocss'
15
+
16
+ // https://vitejs.dev/config/
17
+ export default defineConfig(({ command, mode }) => {
18
+ const config = {
19
+ css: {
20
+ preprocessorOptions: {
21
+ scss: {
22
+ additionalData: `@use '${pathSrc}/assets/styles' as *;`
23
+ },
24
+ },
25
+ },
26
+ plugins: [
27
+ vue({
28
+ template: {
29
+ compilerOptions: {
30
+ isCustomElement: (tag) => ['bx:grid'].includes(tag),
31
+ }
32
+ }
33
+ }),
34
+ Components({
35
+ // allow auto load markdown components under `./src/components/`
36
+ extensions: ['vue', 'md'],
37
+ // allow auto import and register components used in markdown
38
+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
39
+ resolvers: [
40
+ ElementPlusResolver({
41
+ importStyle: 'sass',
42
+ }),
43
+ ],
44
+ dts: 'src/components.d.ts',
45
+ }),
46
+
47
+ // https://github.com/antfu/unocss
48
+ // see unocss.config.ts for config
49
+ ],
50
+ build: {
51
+ lib: {
52
+ entry: path.resolve(__dirname, "./src/components/index.js"),
53
+ name: "FlatmapVuer",
54
+ fileName: 'flatmapvuer',
55
+ },
56
+ rollupOptions: {
57
+ external: ["vue"],
58
+ output: {
59
+ globals: {
60
+ vue: "Vue",
61
+ },
62
+ },
63
+ },
64
+ },
65
+ };
66
+
67
+ if (command === 'serve') {
68
+ config.server = {
69
+ port: 8082,
70
+ };
71
+ } else if (command === "build-bundle") {
72
+
73
+
74
+ }
75
+ return config;
76
+ })
package/vue.config.js CHANGED
@@ -7,6 +7,7 @@ module.exports = {
7
7
  }
8
8
  },
9
9
  chainWebpack: config => {
10
+ config.resolve.alias.set('vue', '@vue/compat')
10
11
  const fontsRule = config.module.rule('fonts')
11
12
  fontsRule.uses.clear()
12
13
  config.module
@@ -19,6 +20,19 @@ module.exports = {
19
20
  return options
20
21
  })
21
22
  .end()
23
+ config.module
24
+ .rule('vue')
25
+ .use('vue-loader')
26
+ .tap((options) => {
27
+ return {
28
+ ...options,
29
+ compilerOptions: {
30
+ compatConfig: {
31
+ MODE: 3
32
+ }
33
+ }
34
+ }
35
+ })
22
36
  },
23
37
  css: {
24
38
  //Import variables into all stylesheets.