@xyo-network/react-node-renderer 2.71.7 → 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/components/relational/graph/Graph.d.cts.map +1 -1
- package/dist/browser/components/relational/graph/Graph.d.mts.map +1 -1
- package/dist/browser/components/relational/graph/Graph.d.ts.map +1 -1
- package/dist/browser/index.cjs +9 -8
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +9 -8
- 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/components/relational/graph/Graph.d.cts.map +1 -1
- package/dist/node/components/relational/graph/Graph.d.mts.map +1 -1
- package/dist/node/components/relational/graph/Graph.d.ts.map +1 -1
- package/dist/node/index.cjs +9 -8
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +9 -8
- package/dist/node/index.js.map +1 -1
- package/package.json +8 -7
- package/src/Cytoscape/CytoscapeElements.ts +7 -11
- package/src/components/relational/graph/Graph.tsx +3 -2
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@xylabs/exists": "^3.0.25",
|
|
13
14
|
"@xylabs/react-async-effect": "^3.1.6",
|
|
14
15
|
"@xylabs/react-flexbox": "^3.1.6",
|
|
15
16
|
"@xylabs/react-identicon": "^3.1.6",
|
|
@@ -22,10 +23,10 @@
|
|
|
22
23
|
"@xyo-network/module-events": "^2.94.9",
|
|
23
24
|
"@xyo-network/module-model": "^2.94.9",
|
|
24
25
|
"@xyo-network/node-model": "^2.94.9",
|
|
25
|
-
"@xyo-network/react-archivist": "~2.71.
|
|
26
|
-
"@xyo-network/react-module": "~2.71.
|
|
27
|
-
"@xyo-network/react-node": "~2.71.
|
|
28
|
-
"@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",
|
|
29
30
|
"@xyo-network/sentinel-model": "^2.94.9",
|
|
30
31
|
"@xyo-network/witness-model": "^2.94.9",
|
|
31
32
|
"cytoscape": "^3.28.1",
|
|
@@ -51,8 +52,8 @@
|
|
|
51
52
|
"@xyo-network/http-bridge": "^2.94.9",
|
|
52
53
|
"@xyo-network/id-plugin": "^2.91.4",
|
|
53
54
|
"@xyo-network/node-memory": "^2.94.9",
|
|
54
|
-
"@xyo-network/react-storybook": "~2.71.
|
|
55
|
-
"@xyo-network/react-wallet": "~2.71.
|
|
55
|
+
"@xyo-network/react-storybook": "~2.71.9",
|
|
56
|
+
"@xyo-network/react-wallet": "~2.71.9",
|
|
56
57
|
"@xyo-network/sentinel": "^2.94.9",
|
|
57
58
|
"typescript": "^5.4.3"
|
|
58
59
|
},
|
|
@@ -107,6 +108,6 @@
|
|
|
107
108
|
},
|
|
108
109
|
"sideEffects": false,
|
|
109
110
|
"types": "dist/browser/index.d.ts",
|
|
110
|
-
"version": "2.71.
|
|
111
|
+
"version": "2.71.9",
|
|
111
112
|
"type": "module"
|
|
112
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
|
}),
|
|
@@ -40,11 +40,12 @@ export const NodeRelationalGraphFlexBox = forwardRef<HTMLDivElement, NodeRelatio
|
|
|
40
40
|
...options,
|
|
41
41
|
})
|
|
42
42
|
if (directed) {
|
|
43
|
-
newCy.layout({ name: 'dagre' }).run()
|
|
43
|
+
newCy.layout({ name: 'dagre', ...(typeof directed === 'object' ? directed : {}) }).run()
|
|
44
44
|
}
|
|
45
45
|
if (spread) {
|
|
46
|
-
newCy.layout({ name: 'fcose' }).run()
|
|
46
|
+
newCy.layout({ name: 'fcose', ...(typeof spread === 'object' ? spread : {}) }).run()
|
|
47
47
|
}
|
|
48
|
+
newCy.fit(undefined, 20)
|
|
48
49
|
setCy(newCy)
|
|
49
50
|
}
|
|
50
51
|
}, [options, sharedRef, spread, directed])
|