@xyo-network/react-node-renderer 2.71.8 → 2.71.9
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/browser/Cytoscape/CytoscapeElements.d.cts +3 -4
- package/dist/browser/Cytoscape/CytoscapeElements.d.cts.map +1 -1
- package/dist/browser/Cytoscape/CytoscapeElements.d.mts +3 -4
- package/dist/browser/Cytoscape/CytoscapeElements.d.mts.map +1 -1
- package/dist/browser/Cytoscape/CytoscapeElements.d.ts +3 -4
- package/dist/browser/Cytoscape/CytoscapeElements.d.ts.map +1 -1
- package/dist/browser/index.cjs +6 -6
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +6 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/node/Cytoscape/CytoscapeElements.d.cts +3 -4
- package/dist/node/Cytoscape/CytoscapeElements.d.cts.map +1 -1
- package/dist/node/Cytoscape/CytoscapeElements.d.mts +3 -4
- package/dist/node/Cytoscape/CytoscapeElements.d.mts.map +1 -1
- package/dist/node/Cytoscape/CytoscapeElements.d.ts +3 -4
- package/dist/node/Cytoscape/CytoscapeElements.d.ts.map +1 -1
- package/dist/node/index.cjs +6 -6
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +6 -6
- package/dist/node/index.js.map +1 -1
- package/package.json +7 -7
- package/src/Cytoscape/CytoscapeElements.ts +7 -11
package/package.json
CHANGED
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"@xyo-network/module-events": "^2.94.9",
|
|
24
24
|
"@xyo-network/module-model": "^2.94.9",
|
|
25
25
|
"@xyo-network/node-model": "^2.94.9",
|
|
26
|
-
"@xyo-network/react-archivist": "~2.71.
|
|
27
|
-
"@xyo-network/react-module": "~2.71.
|
|
28
|
-
"@xyo-network/react-node": "~2.71.
|
|
29
|
-
"@xyo-network/react-shared": "~2.71.
|
|
26
|
+
"@xyo-network/react-archivist": "~2.71.9",
|
|
27
|
+
"@xyo-network/react-module": "~2.71.9",
|
|
28
|
+
"@xyo-network/react-node": "~2.71.9",
|
|
29
|
+
"@xyo-network/react-shared": "~2.71.9",
|
|
30
30
|
"@xyo-network/sentinel-model": "^2.94.9",
|
|
31
31
|
"@xyo-network/witness-model": "^2.94.9",
|
|
32
32
|
"cytoscape": "^3.28.1",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"@xyo-network/http-bridge": "^2.94.9",
|
|
53
53
|
"@xyo-network/id-plugin": "^2.91.4",
|
|
54
54
|
"@xyo-network/node-memory": "^2.94.9",
|
|
55
|
-
"@xyo-network/react-storybook": "~2.71.
|
|
56
|
-
"@xyo-network/react-wallet": "~2.71.
|
|
55
|
+
"@xyo-network/react-storybook": "~2.71.9",
|
|
56
|
+
"@xyo-network/react-wallet": "~2.71.9",
|
|
57
57
|
"@xyo-network/sentinel": "^2.94.9",
|
|
58
58
|
"typescript": "^5.4.3"
|
|
59
59
|
},
|
|
@@ -108,6 +108,6 @@
|
|
|
108
108
|
},
|
|
109
109
|
"sideEffects": false,
|
|
110
110
|
"types": "dist/browser/index.d.ts",
|
|
111
|
-
"version": "2.71.
|
|
111
|
+
"version": "2.71.9",
|
|
112
112
|
"type": "module"
|
|
113
113
|
}
|
|
@@ -6,6 +6,7 @@ import { parseModuleType } from './lib'
|
|
|
6
6
|
|
|
7
7
|
interface ModuleInfo {
|
|
8
8
|
children: ModuleInfo[]
|
|
9
|
+
depth: number
|
|
9
10
|
module: ModuleInstance
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -24,18 +25,13 @@ export const CytoscapeElements = {
|
|
|
24
25
|
|
|
25
26
|
async buildElements(module: ModuleInstance): Promise<ElementDefinition[]> {
|
|
26
27
|
const info = await CytoscapeElements.recurseNodes(module)
|
|
27
|
-
const newElements: ElementDefinition[] = await this.buildElementsFromInfo(info, undefined,
|
|
28
|
+
const newElements: ElementDefinition[] = await this.buildElementsFromInfo(info, undefined, ['activeNode'])
|
|
28
29
|
|
|
29
30
|
return newElements
|
|
30
31
|
},
|
|
31
32
|
|
|
32
|
-
async buildElementsFromInfo(
|
|
33
|
-
info:
|
|
34
|
-
root?: ElementDefinition,
|
|
35
|
-
properties: { [key: string]: unknown } = {},
|
|
36
|
-
classes: string[] = [],
|
|
37
|
-
): Promise<ElementDefinition[]> {
|
|
38
|
-
const newNode = CytoscapeElements.buildNode(info.module, properties, classes)
|
|
33
|
+
async buildElementsFromInfo(info: ModuleInfo, root?: ElementDefinition, classes: string[] = []): Promise<ElementDefinition[]> {
|
|
34
|
+
const newNode = CytoscapeElements.buildNode(info.module, { childCount: info.children.length, depth: info.depth }, classes)
|
|
39
35
|
const newEdge = root ? CytoscapeElements.buildEdge(root, newNode) : undefined
|
|
40
36
|
const newElements: ElementDefinition[] = [newNode]
|
|
41
37
|
if (newEdge) {
|
|
@@ -73,8 +69,8 @@ export const CytoscapeElements = {
|
|
|
73
69
|
return name
|
|
74
70
|
},
|
|
75
71
|
|
|
76
|
-
async recurseNodes(root: ModuleInstance, maxDepth = 10): Promise<ModuleInfo> {
|
|
77
|
-
const info: ModuleInfo = { children: [], module: root }
|
|
72
|
+
async recurseNodes(root: ModuleInstance, maxDepth = 10, depth = 1): Promise<ModuleInfo> {
|
|
73
|
+
const info: ModuleInfo = { children: [], depth, module: root }
|
|
78
74
|
|
|
79
75
|
if (maxDepth > 0) {
|
|
80
76
|
const children = await root.resolve('*', { direction: 'down', maxDepth: 1 })
|
|
@@ -82,7 +78,7 @@ export const CytoscapeElements = {
|
|
|
82
78
|
await Promise.all(
|
|
83
79
|
children.map(async (child) => {
|
|
84
80
|
if (child.address !== root.address) {
|
|
85
|
-
return await this.recurseNodes(child, maxDepth - 1)
|
|
81
|
+
return await this.recurseNodes(child, maxDepth - 1, depth + 1)
|
|
86
82
|
// don't re add the root module that was passed in
|
|
87
83
|
}
|
|
88
84
|
}),
|