react-msaview 3.2.0 → 3.2.2
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/bundle/index.js +13 -13
- package/dist/colorSchemes.js +2 -2
- package/dist/colorSchemes.js.map +1 -1
- package/dist/components/Loading.js +3 -1
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/ResizeHandles.js +6 -2
- package/dist/components/ResizeHandles.js.map +1 -1
- package/dist/components/SequenceTextArea.js +9 -3
- package/dist/components/SequenceTextArea.js.map +1 -1
- package/dist/components/TextTrack.js +1 -1
- package/dist/components/TextTrack.js.map +1 -1
- package/dist/components/Track.js +6 -2
- package/dist/components/Track.js.map +1 -1
- package/dist/components/VerticalScrollbar.js +5 -1
- package/dist/components/VerticalScrollbar.js.map +1 -1
- package/dist/components/dialogs/AboutDialog.js +3 -1
- package/dist/components/dialogs/AboutDialog.js.map +1 -1
- package/dist/components/dialogs/AddTrackDialog.d.ts +2 -2
- package/dist/components/dialogs/AddTrackDialog.js +8 -3
- package/dist/components/dialogs/AddTrackDialog.js.map +1 -1
- package/dist/components/dialogs/DomainDialog.js +6 -2
- package/dist/components/dialogs/DomainDialog.js.map +1 -1
- package/dist/components/dialogs/ExportSVGDialog.js +29 -17
- package/dist/components/dialogs/ExportSVGDialog.js.map +1 -1
- package/dist/components/dialogs/FeatureDialog.js +8 -4
- package/dist/components/dialogs/FeatureDialog.js.map +1 -1
- package/dist/components/dialogs/InterProScanDialog.js +23 -9
- package/dist/components/dialogs/InterProScanDialog.js.map +1 -1
- package/dist/components/dialogs/MetadataDialog.js +3 -1
- package/dist/components/dialogs/MetadataDialog.js.map +1 -1
- package/dist/components/dialogs/SettingsDialog.js +61 -23
- package/dist/components/dialogs/SettingsDialog.js.map +1 -1
- package/dist/components/dialogs/TracklistDialog.d.ts +2 -2
- package/dist/components/dialogs/TracklistDialog.js +8 -3
- package/dist/components/dialogs/TracklistDialog.js.map +1 -1
- package/dist/components/dialogs/UserProvidedDomainsDialog.js +10 -4
- package/dist/components/dialogs/UserProvidedDomainsDialog.js.map +1 -1
- package/dist/components/header/Header.js +3 -1
- package/dist/components/header/Header.js.map +1 -1
- package/dist/components/header/HeaderInfoArea.js +5 -2
- package/dist/components/header/HeaderInfoArea.js.map +1 -1
- package/dist/components/header/HeaderMenu.js +12 -4
- package/dist/components/header/HeaderMenu.js.map +1 -1
- package/dist/components/header/HeaderMenuExtra.js +34 -16
- package/dist/components/header/HeaderMenuExtra.js.map +1 -1
- package/dist/components/header/ZoomControls.js +18 -6
- package/dist/components/header/ZoomControls.js.map +1 -1
- package/dist/components/import/ImportForm.d.ts +2 -2
- package/dist/components/import/ImportForm.js +15 -2
- package/dist/components/import/ImportForm.js.map +1 -1
- package/dist/components/import/ImportFormExamples.js +44 -31
- package/dist/components/import/ImportFormExamples.js.map +1 -1
- package/dist/components/minimap/Minimap.js +12 -4
- package/dist/components/minimap/Minimap.js.map +1 -1
- package/dist/components/msa/MSACanvasBlock.js +5 -3
- package/dist/components/msa/MSACanvasBlock.js.map +1 -1
- package/dist/components/msa/MSAMouseoverCanvas.d.ts +1 -1
- package/dist/components/msa/MSAMouseoverCanvas.js +1 -1
- package/dist/components/msa/MSAMouseoverCanvas.js.map +1 -1
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js +2 -2
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js.map +1 -1
- package/dist/components/msa/renderMSABlock.js +28 -24
- package/dist/components/msa/renderMSABlock.js.map +1 -1
- package/dist/components/msa/renderMSAMouseover.js +3 -3
- package/dist/components/msa/renderMSAMouseover.js.map +1 -1
- package/dist/components/tree/TreeBranchMenu.js +6 -3
- package/dist/components/tree/TreeBranchMenu.js.map +1 -1
- package/dist/components/tree/TreeCanvasBlock.js +11 -4
- package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
- package/dist/components/tree/TreeNodeMenu.js +1 -1
- package/dist/components/tree/TreeNodeMenu.js.map +1 -1
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.d.ts +2 -2
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js +7 -5
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -1
- package/dist/components/tree/renderTreeCanvas.js +5 -5
- package/dist/components/tree/renderTreeCanvas.js.map +1 -1
- package/dist/components/util.js +0 -3
- package/dist/components/util.js.map +1 -1
- package/dist/ggplotPalettes.js.map +1 -1
- package/dist/launchInterProScan.js +4 -4
- package/dist/launchInterProScan.js.map +1 -1
- package/dist/model/DialogQueue.d.ts +1 -1
- package/dist/model/DialogQueue.js +0 -1
- package/dist/model/DialogQueue.js.map +1 -1
- package/dist/model.d.ts +59 -25
- package/dist/model.js +123 -62
- package/dist/model.js.map +1 -1
- package/dist/parseGFF.js +8 -6
- package/dist/parseGFF.js.map +1 -1
- package/dist/parseNewick.d.ts +4 -4
- package/dist/parseNewick.js +7 -8
- package/dist/parseNewick.js.map +1 -1
- package/dist/parsers/ClustalMSA.d.ts +5 -5
- package/dist/parsers/ClustalMSA.js +2 -2
- package/dist/parsers/ClustalMSA.js.map +1 -1
- package/dist/parsers/EmfMSA.d.ts +27 -0
- package/dist/parsers/EmfMSA.js +53 -0
- package/dist/parsers/EmfMSA.js.map +1 -0
- package/dist/parsers/EmfTree.d.ts +5 -0
- package/dist/parsers/EmfTree.js +8 -0
- package/dist/parsers/EmfTree.js.map +1 -0
- package/dist/parsers/FastaMSA.js +5 -5
- package/dist/parsers/FastaMSA.js.map +1 -1
- package/dist/parsers/StockholmMSA.d.ts +6 -6
- package/dist/parsers/StockholmMSA.js +6 -6
- package/dist/parsers/StockholmMSA.js.map +1 -1
- package/dist/renderToSvg.js +3 -6
- package/dist/renderToSvg.js.map +1 -1
- package/dist/reparseTree.js +2 -2
- package/dist/reparseTree.js.map +1 -1
- package/dist/rowCoordinateCalculations.d.ts +2 -0
- package/dist/rowCoordinateCalculations.js +26 -0
- package/dist/rowCoordinateCalculations.js.map +1 -0
- package/dist/rowCoordinateCalculations.test.d.ts +1 -0
- package/dist/rowCoordinateCalculations.test.js +18 -0
- package/dist/rowCoordinateCalculations.test.js.map +1 -0
- package/dist/util.d.ts +3 -3
- package/dist/util.js +1 -1
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -3
- package/src/colorSchemes.ts +4 -4
- package/src/components/Loading.tsx +7 -1
- package/src/components/ResizeHandles.tsx +6 -2
- package/src/components/SequenceTextArea.tsx +10 -4
- package/src/components/TextTrack.tsx +2 -2
- package/src/components/Track.tsx +8 -4
- package/src/components/VerticalScrollbar.tsx +6 -2
- package/src/components/dialogs/AboutDialog.tsx +7 -1
- package/src/components/dialogs/AddTrackDialog.tsx +13 -3
- package/src/components/dialogs/DomainDialog.tsx +9 -2
- package/src/components/dialogs/ExportSVGDialog.tsx +36 -17
- package/src/components/dialogs/FeatureDialog.tsx +7 -5
- package/src/components/dialogs/InterProScanDialog.tsx +20 -10
- package/src/components/dialogs/MetadataDialog.tsx +8 -1
- package/src/components/dialogs/SettingsDialog.tsx +76 -32
- package/src/components/dialogs/TracklistDialog.tsx +17 -3
- package/src/components/dialogs/UserProvidedDomainsDialog.tsx +11 -5
- package/src/components/header/Header.tsx +3 -1
- package/src/components/header/HeaderInfoArea.tsx +3 -2
- package/src/components/header/HeaderMenu.tsx +12 -7
- package/src/components/header/HeaderMenuExtra.tsx +28 -16
- package/src/components/header/ZoomControls.tsx +22 -6
- package/src/components/import/ImportForm.tsx +14 -2
- package/src/components/import/ImportFormExamples.tsx +59 -48
- package/src/components/minimap/Minimap.tsx +21 -9
- package/src/components/msa/MSACanvasBlock.tsx +5 -3
- package/src/components/msa/MSAMouseoverCanvas.tsx +5 -1
- package/src/components/msa/renderBoxFeatureCanvasBlock.ts +4 -4
- package/src/components/msa/renderMSABlock.ts +42 -38
- package/src/components/msa/renderMSAMouseover.ts +3 -3
- package/src/components/tree/TreeBranchMenu.tsx +5 -3
- package/src/components/tree/TreeCanvasBlock.tsx +11 -4
- package/src/components/tree/TreeNodeMenu.tsx +1 -1
- package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +17 -4
- package/src/components/tree/renderTreeCanvas.ts +2 -2
- package/src/components/util.ts +1 -4
- package/src/ggplotPalettes.ts +1 -1
- package/src/launchInterProScan.ts +5 -5
- package/src/model/DialogQueue.ts +0 -1
- package/src/model.ts +136 -74
- package/src/parseGFF.ts +13 -11
- package/src/parseNewick.ts +10 -10
- package/src/parsers/ClustalMSA.ts +4 -4
- package/src/parsers/EmfMSA.ts +66 -0
- package/src/parsers/EmfTree.ts +9 -0
- package/src/parsers/FastaMSA.ts +6 -6
- package/src/parsers/StockholmMSA.ts +12 -12
- package/src/renderToSvg.tsx +1 -2
- package/src/reparseTree.ts +3 -3
- package/src/rowCoordinateCalculations.test.ts +19 -0
- package/src/rowCoordinateCalculations.ts +26 -0
- package/src/util.ts +5 -5
- package/src/version.ts +1 -1
|
@@ -11,12 +11,12 @@ export default class ClustalMSA {
|
|
|
11
11
|
return this.MSA
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
getRow(name: string) {
|
|
14
|
+
getRow(name: string): string {
|
|
15
15
|
return this.MSA.alns.find(aln => aln.id === name)?.seq || ''
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
getWidth() {
|
|
19
|
-
return this.MSA.alns[0]
|
|
19
|
+
return this.MSA.alns[0]!.seq.length
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
getRowData() {
|
|
@@ -44,10 +44,10 @@ export default class ClustalMSA {
|
|
|
44
44
|
id: 'root',
|
|
45
45
|
name: 'root',
|
|
46
46
|
noTree: true,
|
|
47
|
-
|
|
47
|
+
children: this.getNames().map(name => ({
|
|
48
48
|
id: name,
|
|
49
49
|
name,
|
|
50
|
-
|
|
50
|
+
children: [],
|
|
51
51
|
})),
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { parseEmfAln } from 'emf-js'
|
|
2
|
+
import type { NodeWithIds } from '../util'
|
|
3
|
+
|
|
4
|
+
export default class EmfMSA {
|
|
5
|
+
private MSA: ReturnType<typeof parseEmfAln>
|
|
6
|
+
|
|
7
|
+
constructor(text: string) {
|
|
8
|
+
this.MSA = parseEmfAln(text)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getMSA() {
|
|
12
|
+
return this.MSA
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getRow(name: string): string {
|
|
16
|
+
return this.MSA.find(aln => aln.protein === name)?.seq || ''
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getWidth() {
|
|
20
|
+
return this.MSA[0]!.seq.length
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getRowData() {
|
|
24
|
+
return undefined
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getHeader() {
|
|
28
|
+
return ''
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getNames() {
|
|
32
|
+
return this.MSA.map(aln => aln.protein)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getStructures() {
|
|
36
|
+
return {}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get alignmentNames() {
|
|
40
|
+
return []
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getTree(): NodeWithIds {
|
|
44
|
+
return {
|
|
45
|
+
id: 'root',
|
|
46
|
+
name: 'root',
|
|
47
|
+
noTree: true,
|
|
48
|
+
children: this.getNames().map(name => ({
|
|
49
|
+
id: name,
|
|
50
|
+
name,
|
|
51
|
+
children: [],
|
|
52
|
+
})),
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get seqConsensus() {
|
|
57
|
+
return undefined
|
|
58
|
+
}
|
|
59
|
+
get secondaryStructureConsensus() {
|
|
60
|
+
return undefined
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get tracks() {
|
|
64
|
+
return []
|
|
65
|
+
}
|
|
66
|
+
}
|
package/src/parsers/FastaMSA.ts
CHANGED
|
@@ -6,7 +6,7 @@ function parseSmallFasta(text: string) {
|
|
|
6
6
|
.filter(t => /\S/.test(t))
|
|
7
7
|
.map(entryText => {
|
|
8
8
|
const [defLine, ...seqLines] = entryText.split('\n')
|
|
9
|
-
const [id, ...description] = defLine
|
|
9
|
+
const [id, ...description] = defLine!.split(' ')
|
|
10
10
|
const descriptionStr = description.join(' ')
|
|
11
11
|
const seqLinesStr = seqLines.join('')
|
|
12
12
|
const sequence = seqLinesStr.replaceAll(/\s/g, '')
|
|
@@ -18,7 +18,7 @@ export default class FastaMSA {
|
|
|
18
18
|
constructor(text: string) {
|
|
19
19
|
this.MSA = {
|
|
20
20
|
seqdata: Object.fromEntries(
|
|
21
|
-
parseSmallFasta(text).map(m => [
|
|
21
|
+
parseSmallFasta(text).map(m => [m.id, m.sequence]),
|
|
22
22
|
),
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -36,11 +36,11 @@ export default class FastaMSA {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
getRow(name: string) {
|
|
39
|
-
return this.MSA
|
|
39
|
+
return this.MSA.seqdata[name] || ''
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
getWidth() {
|
|
43
|
-
const name = Object.keys(this.MSA
|
|
43
|
+
const name = Object.keys(this.MSA.seqdata)[0]!
|
|
44
44
|
return this.getRow(name).length
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -61,9 +61,9 @@ export default class FastaMSA {
|
|
|
61
61
|
id: 'root',
|
|
62
62
|
name: 'root',
|
|
63
63
|
noTree: true,
|
|
64
|
-
|
|
64
|
+
children: this.getNames().map(name => ({
|
|
65
65
|
id: name,
|
|
66
|
-
|
|
66
|
+
children: [],
|
|
67
67
|
name,
|
|
68
68
|
})),
|
|
69
69
|
}
|
|
@@ -7,9 +7,9 @@ interface StockholmEntry {
|
|
|
7
7
|
DE?: string[]
|
|
8
8
|
NH?: string[]
|
|
9
9
|
}
|
|
10
|
-
gs
|
|
10
|
+
gs?: {
|
|
11
11
|
AC: Record<string, string>
|
|
12
|
-
DR
|
|
12
|
+
DR?: Record<string, string>
|
|
13
13
|
}
|
|
14
14
|
gc?: {
|
|
15
15
|
SS_cons?: string
|
|
@@ -33,11 +33,11 @@ export default class StockholmMSA {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
getRow(name: string) {
|
|
36
|
-
return this.MSA
|
|
36
|
+
return this.MSA.seqdata[name] || ''
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
getWidth() {
|
|
40
|
-
const name = Object.keys(this.MSA
|
|
40
|
+
const name = Object.keys(this.MSA.seqdata)[0]!
|
|
41
41
|
return this.getRow(name).length
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -56,7 +56,7 @@ export default class StockholmMSA {
|
|
|
56
56
|
getRowData(rowName: string) {
|
|
57
57
|
return {
|
|
58
58
|
name: rowName,
|
|
59
|
-
accession: this.MSA.gs?.AC
|
|
59
|
+
accession: this.MSA.gs?.AC[rowName],
|
|
60
60
|
dbxref: this.MSA.gs?.DR?.[rowName],
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -74,10 +74,10 @@ export default class StockholmMSA {
|
|
|
74
74
|
.map(([id, dr]) => [id, pdbRegex.exec(dr)] as const)
|
|
75
75
|
.filter((item): item is [string, RegExpExecArray] => !!item[1])
|
|
76
76
|
.map(([id, match]) => {
|
|
77
|
-
const pdb = match[1]
|
|
78
|
-
const chain = match[2]
|
|
79
|
-
const startPos = +match[3]
|
|
80
|
-
const endPos = +match[4]
|
|
77
|
+
const pdb = match[1]!.toLowerCase()
|
|
78
|
+
const chain = match[2]!
|
|
79
|
+
const startPos = +match[3]!
|
|
80
|
+
const endPos = +match[4]!
|
|
81
81
|
return { id, pdb, chain, startPos, endPos }
|
|
82
82
|
})
|
|
83
83
|
|
|
@@ -93,16 +93,16 @@ export default class StockholmMSA {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
getTree(): NodeWithIds {
|
|
96
|
-
const tree = this.MSA
|
|
96
|
+
const tree = this.MSA.gf.NH?.[0]
|
|
97
97
|
return tree
|
|
98
98
|
? generateNodeIds(parseNewick(tree))
|
|
99
99
|
: {
|
|
100
100
|
id: 'root',
|
|
101
101
|
name: 'root',
|
|
102
102
|
noTree: true,
|
|
103
|
-
|
|
103
|
+
children: this.getNames().map(name => ({
|
|
104
104
|
id: name,
|
|
105
|
-
|
|
105
|
+
children: [],
|
|
106
106
|
name,
|
|
107
107
|
})),
|
|
108
108
|
}
|
package/src/renderToSvg.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react-refresh/only-export-components */
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { createRoot } from 'react-dom/client'
|
|
3
4
|
import { when } from 'mobx'
|
|
@@ -153,13 +154,11 @@ function CoreRendering({
|
|
|
153
154
|
|
|
154
155
|
<g
|
|
155
156
|
clipPath={`url(#${clipId1})`}
|
|
156
|
-
/* eslint-disable-next-line react/no-danger */
|
|
157
157
|
dangerouslySetInnerHTML={{ __html: ctx1.getSvg().innerHTML }}
|
|
158
158
|
/>
|
|
159
159
|
<g
|
|
160
160
|
clipPath={`url(#${clipId2})`}
|
|
161
161
|
transform={`translate(${treeAreaWidth} 0)`}
|
|
162
|
-
/* eslint-disable-next-line react/no-danger */
|
|
163
162
|
dangerouslySetInnerHTML={{ __html: ctx2.getSvg().innerHTML }}
|
|
164
163
|
/>
|
|
165
164
|
</>
|
package/src/reparseTree.ts
CHANGED
|
@@ -3,11 +3,11 @@ import type { NodeWithIds } from './util'
|
|
|
3
3
|
export function reparseTree(tree: NodeWithIds): NodeWithIds {
|
|
4
4
|
return {
|
|
5
5
|
...tree,
|
|
6
|
-
|
|
7
|
-
r.
|
|
6
|
+
children: tree.children.map(r =>
|
|
7
|
+
r.children.length
|
|
8
8
|
? reparseTree(r)
|
|
9
9
|
: {
|
|
10
|
-
|
|
10
|
+
children: [r],
|
|
11
11
|
id: `${r.id}-leafnode`,
|
|
12
12
|
name: `${r.name}-hidden`,
|
|
13
13
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { expect, test } from 'vitest'
|
|
2
|
+
import { mouseOverCoordToGlobalCoord } from './rowCoordinateCalculations'
|
|
3
|
+
test('blanks3', () => {
|
|
4
|
+
const blanks = [2, 5, 8]
|
|
5
|
+
;(
|
|
6
|
+
[
|
|
7
|
+
[0, 0],
|
|
8
|
+
[1, 1],
|
|
9
|
+
[2, 3],
|
|
10
|
+
[3, 4],
|
|
11
|
+
[4, 6],
|
|
12
|
+
[5, 7],
|
|
13
|
+
[6, 9],
|
|
14
|
+
[7, 10],
|
|
15
|
+
] as const
|
|
16
|
+
).forEach(r => {
|
|
17
|
+
expect(mouseOverCoordToGlobalCoord(blanks, r[0])).toBe(r[1])
|
|
18
|
+
})
|
|
19
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function mouseOverCoordToGlobalCoord(blanks: number[], pos: number) {
|
|
2
|
+
let i = 0 // 'mouse over coord'
|
|
3
|
+
let j = 0 // 'position in blanks array'
|
|
4
|
+
let k = 0 // 'global coord'/return value
|
|
5
|
+
|
|
6
|
+
for (; i < pos; i++, k++) {
|
|
7
|
+
// skip multiple gaps in a row
|
|
8
|
+
while (j < blanks.length && blanks[j]! - 1 === k) {
|
|
9
|
+
j++
|
|
10
|
+
k++
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return k
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function globalCoordToRowSpecificCoord(seq: string, pos: number) {
|
|
17
|
+
let k = 0
|
|
18
|
+
for (let i = 0; i < pos; i++) {
|
|
19
|
+
if (seq[i] !== '-') {
|
|
20
|
+
k++
|
|
21
|
+
} else if (k >= pos) {
|
|
22
|
+
break
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return k
|
|
26
|
+
}
|
package/src/util.ts
CHANGED
|
@@ -14,7 +14,7 @@ export function transform<T>(
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface Node {
|
|
17
|
-
|
|
17
|
+
children?: Node[]
|
|
18
18
|
name?: string
|
|
19
19
|
[key: string]: unknown
|
|
20
20
|
}
|
|
@@ -22,7 +22,7 @@ interface Node {
|
|
|
22
22
|
export interface NodeWithIds {
|
|
23
23
|
id: string
|
|
24
24
|
name: string
|
|
25
|
-
|
|
25
|
+
children: NodeWithIds[]
|
|
26
26
|
length?: number
|
|
27
27
|
noTree?: boolean
|
|
28
28
|
}
|
|
@@ -30,7 +30,7 @@ export interface NodeWithIds {
|
|
|
30
30
|
export interface NodeWithIdsAndLength {
|
|
31
31
|
id: string
|
|
32
32
|
name: string
|
|
33
|
-
|
|
33
|
+
children: NodeWithIdsAndLength[]
|
|
34
34
|
noTree?: boolean
|
|
35
35
|
length: number
|
|
36
36
|
}
|
|
@@ -46,8 +46,8 @@ export function generateNodeIds(
|
|
|
46
46
|
...tree,
|
|
47
47
|
id,
|
|
48
48
|
name: tree.name || id,
|
|
49
|
-
|
|
50
|
-
tree.
|
|
49
|
+
children:
|
|
50
|
+
tree.children?.map((b, i) =>
|
|
51
51
|
generateNodeIds(b, `${id}-${i}`, depth + 1),
|
|
52
52
|
) || [],
|
|
53
53
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.2.
|
|
1
|
+
export const version = '3.2.2'
|