@xyo-network/react-node-renderer 2.64.0 → 2.64.1
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.js +40 -9
- package/dist/browser/Cytoscape/CytoscapeElements.js.map +1 -1
- package/dist/browser/Cytoscape/CytoscapeIcons.js +2 -1
- package/dist/browser/Cytoscape/CytoscapeIcons.js.map +1 -1
- package/dist/browser/Cytoscape/CytoscapeStyles.js +4 -3
- package/dist/browser/Cytoscape/CytoscapeStyles.js.map +1 -1
- package/dist/browser/Cytoscape/index.js +220 -4
- package/dist/browser/Cytoscape/index.js.map +1 -1
- package/dist/browser/Cytoscape/lib/encodeSvg.js +3 -2
- package/dist/browser/Cytoscape/lib/encodeSvg.js.map +1 -1
- package/dist/browser/Cytoscape/lib/iconMap.js +2 -1
- package/dist/browser/Cytoscape/lib/iconMap.js.map +1 -1
- package/dist/browser/Cytoscape/lib/index.js +80 -5
- package/dist/browser/Cytoscape/lib/index.js.map +1 -1
- package/dist/browser/Cytoscape/lib/layout/ColaLayout.js +2 -1
- package/dist/browser/Cytoscape/lib/layout/ColaLayout.js.map +1 -1
- package/dist/browser/Cytoscape/lib/layout/ConcentricLayout.js +2 -1
- package/dist/browser/Cytoscape/lib/layout/ConcentricLayout.js.map +1 -1
- package/dist/browser/Cytoscape/lib/layout/index.js +22 -2
- package/dist/browser/Cytoscape/lib/layout/index.js.map +1 -1
- package/dist/browser/Cytoscape/lib/parseModuleType.js +2 -1
- package/dist/browser/Cytoscape/lib/parseModuleType.js.map +1 -1
- package/dist/browser/components/ModuleCardParser.js +3 -2
- package/dist/browser/components/ModuleCardParser.js.map +1 -1
- package/dist/browser/components/ModuleGraphFlexBox.js +459 -11
- package/dist/browser/components/ModuleGraphFlexBox.js.map +1 -1
- package/dist/browser/components/ProvidedNodeRenderer.js +352 -5
- package/dist/browser/components/ProvidedNodeRenderer.js.map +1 -1
- package/dist/browser/components/RelationalGraph.js +15 -5
- package/dist/browser/components/RelationalGraph.js.map +1 -1
- package/dist/browser/components/WithCola.js +3 -2
- package/dist/browser/components/WithCola.js.map +1 -1
- package/dist/browser/components/cytoscape-extensions/WithExtensions.js +3 -2
- package/dist/browser/components/cytoscape-extensions/WithExtensions.js.map +1 -1
- package/dist/browser/components/cytoscape-extensions/index.js +18 -1
- package/dist/browser/components/cytoscape-extensions/index.js.map +1 -1
- package/dist/browser/components/index.js +381 -4
- package/dist/browser/components/index.js.map +1 -1
- package/dist/browser/components/lib/index.js +0 -1
- package/dist/browser/components/lib/index.js.map +1 -1
- package/dist/browser/components/story/TestData.js +4 -3
- package/dist/browser/components/story/TestData.js.map +1 -1
- package/dist/browser/components/story/index.js +48 -1
- package/dist/browser/components/story/index.js.map +1 -1
- package/dist/browser/contexts/CytoscapeInstance/Context.js +2 -1
- package/dist/browser/contexts/CytoscapeInstance/Context.js.map +1 -1
- package/dist/browser/contexts/CytoscapeInstance/Provider.js +9 -3
- package/dist/browser/contexts/CytoscapeInstance/Provider.js.map +1 -1
- package/dist/browser/contexts/CytoscapeInstance/index.js +23 -4
- package/dist/browser/contexts/CytoscapeInstance/index.js.map +1 -1
- package/dist/browser/contexts/CytoscapeInstance/use.js +8 -2
- package/dist/browser/contexts/CytoscapeInstance/use.js.map +1 -1
- package/dist/browser/contexts/index.js +23 -1
- package/dist/browser/contexts/index.js.map +1 -1
- package/dist/browser/hooks/cytoscape/index.js +395 -6
- package/dist/browser/hooks/cytoscape/index.js.map +1 -1
- package/dist/browser/hooks/cytoscape/useAddNewElements.js +51 -4
- package/dist/browser/hooks/cytoscape/useAddNewElements.js.map +1 -1
- package/dist/browser/hooks/cytoscape/useCytoscapeElements.js +113 -4
- package/dist/browser/hooks/cytoscape/useCytoscapeElements.js.map +1 -1
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.js +136 -4
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.js.map +1 -1
- package/dist/browser/hooks/cytoscape/useCytoscapeStyle.js +105 -4
- package/dist/browser/hooks/cytoscape/useCytoscapeStyle.js.map +1 -1
- package/dist/browser/hooks/cytoscape/useIcons.js +51 -3
- package/dist/browser/hooks/cytoscape/useIcons.js.map +1 -1
- package/dist/browser/hooks/cytoscape/useNewElements.js +160 -5
- package/dist/browser/hooks/cytoscape/useNewElements.js.map +1 -1
- package/dist/browser/hooks/cytoscape/usePopperListener.js +2 -1
- package/dist/browser/hooks/cytoscape/usePopperListener.js.map +1 -1
- package/dist/browser/hooks/cytoscape/useRelationalGraphOptions.js +306 -7
- package/dist/browser/hooks/cytoscape/useRelationalGraphOptions.js.map +1 -1
- package/dist/browser/hooks/index.js +395 -1
- package/dist/browser/hooks/index.js.map +1 -1
- package/dist/browser/index.js +484 -3
- package/dist/browser/index.js.map +1 -1
- package/dist/docs.json +88 -88
- package/package.json +25 -25
|
@@ -1,6 +1,37 @@
|
|
|
1
|
+
// src/Cytoscape/CytoscapeElements.ts
|
|
2
|
+
import { isNodeInstance as isNodeInstance2 } from "@xyo-network/node-model";
|
|
3
|
+
|
|
4
|
+
// src/Cytoscape/lib/parseModuleType.ts
|
|
5
|
+
import { isArchivistInstance } from "@xyo-network/archivist-model";
|
|
6
|
+
import { isBridgeInstance } from "@xyo-network/bridge-model";
|
|
7
|
+
import { isDivinerInstance } from "@xyo-network/diviner-model";
|
|
1
8
|
import { isNodeInstance } from "@xyo-network/node-model";
|
|
2
|
-
import {
|
|
3
|
-
|
|
9
|
+
import { isSentinelInstance } from "@xyo-network/sentinel";
|
|
10
|
+
import { isWitnessModule } from "@xyo-network/witness";
|
|
11
|
+
var parseModuleType = (module) => {
|
|
12
|
+
let type = "module";
|
|
13
|
+
if (module) {
|
|
14
|
+
if (isArchivistInstance(module)) {
|
|
15
|
+
type = "archivist";
|
|
16
|
+
} else if (isBridgeInstance(module)) {
|
|
17
|
+
type = "bridge";
|
|
18
|
+
} else if (isDivinerInstance(module)) {
|
|
19
|
+
type = "diviner";
|
|
20
|
+
} else if (isNodeInstance(module)) {
|
|
21
|
+
type = "node";
|
|
22
|
+
} else if (isSentinelInstance(module)) {
|
|
23
|
+
type = "sentinel";
|
|
24
|
+
} else if (isWitnessModule(module)) {
|
|
25
|
+
type = "witness";
|
|
26
|
+
} else {
|
|
27
|
+
type = "module";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return type;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/Cytoscape/CytoscapeElements.ts
|
|
34
|
+
var CytoscapeElements = class _CytoscapeElements {
|
|
4
35
|
static MaxNameLength = 20;
|
|
5
36
|
static buildEdge(rootNode, newNode) {
|
|
6
37
|
return {
|
|
@@ -12,14 +43,14 @@ class CytoscapeElements {
|
|
|
12
43
|
};
|
|
13
44
|
}
|
|
14
45
|
static async buildElements(module) {
|
|
15
|
-
const newRootNode =
|
|
46
|
+
const newRootNode = _CytoscapeElements.buildRootNode(module);
|
|
16
47
|
const newElements = [newRootNode];
|
|
17
48
|
try {
|
|
18
|
-
const childElements = await
|
|
49
|
+
const childElements = await _CytoscapeElements.recurseNodes(module);
|
|
19
50
|
childElements?.forEach((module2) => {
|
|
20
|
-
const newNode =
|
|
51
|
+
const newNode = _CytoscapeElements.buildNode(module2, newRootNode.data.id);
|
|
21
52
|
newElements.push(newNode);
|
|
22
|
-
const newEdge =
|
|
53
|
+
const newEdge = _CytoscapeElements.buildEdge(newRootNode, newNode);
|
|
23
54
|
newElements.push(newEdge);
|
|
24
55
|
});
|
|
25
56
|
return newElements;
|
|
@@ -42,7 +73,7 @@ class CytoscapeElements {
|
|
|
42
73
|
};
|
|
43
74
|
}
|
|
44
75
|
static buildRootNode = (module) => {
|
|
45
|
-
return
|
|
76
|
+
return _CytoscapeElements.buildNode(module);
|
|
46
77
|
};
|
|
47
78
|
static normalizeName(name) {
|
|
48
79
|
if (!name)
|
|
@@ -59,7 +90,7 @@ class CytoscapeElements {
|
|
|
59
90
|
const modules = await nestedNode.resolve(void 0, { direction: "down", maxDepth: 2 });
|
|
60
91
|
await Promise.all(
|
|
61
92
|
modules.map(async (child) => {
|
|
62
|
-
if (child !== nestedNode &&
|
|
93
|
+
if (child !== nestedNode && isNodeInstance2(child)) {
|
|
63
94
|
localDepth++;
|
|
64
95
|
await traverse(child);
|
|
65
96
|
} else if (child !== module) {
|
|
@@ -72,7 +103,7 @@ class CytoscapeElements {
|
|
|
72
103
|
await traverse(module);
|
|
73
104
|
return childModules;
|
|
74
105
|
}
|
|
75
|
-
}
|
|
106
|
+
};
|
|
76
107
|
export {
|
|
77
108
|
CytoscapeElements
|
|
78
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Cytoscape/CytoscapeElements.ts"],"sourcesContent":["import { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { ElementDefinition } from 'cytoscape'\n\nimport { parseModuleType } from './lib'\n\nexport class CytoscapeElements {\n static MaxNameLength = 20\n\n static buildEdge(rootNode: ElementDefinition, newNode: ElementDefinition) {\n return {\n data: {\n id: `${rootNode.data.id}/${newNode.data.id}`,\n source: rootNode.data.id,\n target: newNode.data.id,\n },\n }\n }\n\n static async buildElements(module: ModuleInstance): Promise<ElementDefinition[]> {\n const newRootNode = CytoscapeElements.buildRootNode(module)\n const newElements: ElementDefinition[] = [newRootNode]\n\n try {\n const childElements = await CytoscapeElements.recurseNodes(module)\n childElements?.forEach((module) => {\n const newNode = CytoscapeElements.buildNode(module, newRootNode.data.id)\n newElements.push(newNode)\n\n const newEdge = CytoscapeElements.buildEdge(newRootNode, newNode)\n newElements.push(newEdge)\n })\n\n return newElements\n } catch (e) {\n console.error('error resolving modules', e)\n return []\n }\n }\n\n static buildNode(module: ModuleInstance, rootNodeId?: string): ElementDefinition {\n const { address, config } = module\n const normalizedName = config.name ?? address.substring(0, 8)\n return {\n data: {\n address,\n id: address,\n name: normalizedName,\n rootNodeId,\n type: parseModuleType(module),\n },\n }\n }\n\n static buildRootNode = (module: ModuleInstance): ElementDefinition => {\n return CytoscapeElements.buildNode(module)\n }\n\n static normalizeName(name?: string) {\n if (!name) return\n if (name.length > this.MaxNameLength) return `${name.substring(0, 20)}...`\n return name\n }\n\n static async recurseNodes(module: ModuleInstance, maxTraversals = 1): Promise<ModuleInstance[]> {\n let localDepth = 0\n const childModules: ModuleInstance[] = []\n\n const traverse = async (nestedNode: ModuleInstance) => {\n if (localDepth < maxTraversals) {\n const modules = await nestedNode.resolve(undefined, { direction: 'down', maxDepth: 2 })\n await Promise.all(\n modules.map(async (child) => {\n if (child !== nestedNode && isNodeInstance(child)) {\n localDepth++\n await traverse(child)\n // don't re add the root module that was passed in\n } else if (child !== module) {\n childModules.push(child)\n }\n }),\n )\n }\n }\n\n await traverse(module)\n\n return childModules\n }\n}\n"],"mappings":"AACA,SAAS,sBAAsB;
|
|
1
|
+
{"version":3,"sources":["../../../src/Cytoscape/CytoscapeElements.ts","../../../src/Cytoscape/lib/parseModuleType.ts"],"sourcesContent":["import { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { ElementDefinition } from 'cytoscape'\n\nimport { parseModuleType } from './lib'\n\nexport class CytoscapeElements {\n static MaxNameLength = 20\n\n static buildEdge(rootNode: ElementDefinition, newNode: ElementDefinition) {\n return {\n data: {\n id: `${rootNode.data.id}/${newNode.data.id}`,\n source: rootNode.data.id,\n target: newNode.data.id,\n },\n }\n }\n\n static async buildElements(module: ModuleInstance): Promise<ElementDefinition[]> {\n const newRootNode = CytoscapeElements.buildRootNode(module)\n const newElements: ElementDefinition[] = [newRootNode]\n\n try {\n const childElements = await CytoscapeElements.recurseNodes(module)\n childElements?.forEach((module) => {\n const newNode = CytoscapeElements.buildNode(module, newRootNode.data.id)\n newElements.push(newNode)\n\n const newEdge = CytoscapeElements.buildEdge(newRootNode, newNode)\n newElements.push(newEdge)\n })\n\n return newElements\n } catch (e) {\n console.error('error resolving modules', e)\n return []\n }\n }\n\n static buildNode(module: ModuleInstance, rootNodeId?: string): ElementDefinition {\n const { address, config } = module\n const normalizedName = config.name ?? address.substring(0, 8)\n return {\n data: {\n address,\n id: address,\n name: normalizedName,\n rootNodeId,\n type: parseModuleType(module),\n },\n }\n }\n\n static buildRootNode = (module: ModuleInstance): ElementDefinition => {\n return CytoscapeElements.buildNode(module)\n }\n\n static normalizeName(name?: string) {\n if (!name) return\n if (name.length > this.MaxNameLength) return `${name.substring(0, 20)}...`\n return name\n }\n\n static async recurseNodes(module: ModuleInstance, maxTraversals = 1): Promise<ModuleInstance[]> {\n let localDepth = 0\n const childModules: ModuleInstance[] = []\n\n const traverse = async (nestedNode: ModuleInstance) => {\n if (localDepth < maxTraversals) {\n const modules = await nestedNode.resolve(undefined, { direction: 'down', maxDepth: 2 })\n await Promise.all(\n modules.map(async (child) => {\n if (child !== nestedNode && isNodeInstance(child)) {\n localDepth++\n await traverse(child)\n // don't re add the root module that was passed in\n } else if (child !== module) {\n childModules.push(child)\n }\n }),\n )\n }\n }\n\n await traverse(module)\n\n return childModules\n }\n}\n","import { isArchivistInstance } from '@xyo-network/archivist-model'\nimport { isBridgeInstance } from '@xyo-network/bridge-model'\nimport { isDivinerInstance } from '@xyo-network/diviner-model'\nimport { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel'\nimport { isWitnessModule } from '@xyo-network/witness'\n\nimport { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const parseModuleType = (module?: ModuleInstance): CyNodeModuleTypes => {\n let type: CyNodeModuleTypes = 'module'\n if (module) {\n if (isArchivistInstance(module)) {\n type = 'archivist'\n } else if (isBridgeInstance(module)) {\n type = 'bridge'\n } else if (isDivinerInstance(module)) {\n type = 'diviner'\n } else if (isNodeInstance(module)) {\n type = 'node'\n } else if (isSentinelInstance(module)) {\n type = 'sentinel'\n } else if (isWitnessModule(module)) {\n type = 'witness'\n } else {\n type = 'module'\n }\n }\n return type\n}\n"],"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@ -1,3 +1,4 @@
|
|
|
1
|
+
// src/Cytoscape/CytoscapeIcons.tsx
|
|
1
2
|
import {
|
|
2
3
|
BubbleChartRounded as BubbleChartRoundedIcon,
|
|
3
4
|
Hub as HubIcon,
|
|
@@ -7,7 +8,7 @@ import {
|
|
|
7
8
|
TimerRounded as TimerRoundedIcon,
|
|
8
9
|
VisibilityRounded as VisibilityRoundedIcon
|
|
9
10
|
} from "@mui/icons-material";
|
|
10
|
-
|
|
11
|
+
var CyIconSet = {
|
|
11
12
|
archivist: Inventory2RoundedIcon,
|
|
12
13
|
bridge: InsertLinkRoundedIcon,
|
|
13
14
|
diviner: BubbleChartRoundedIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Cytoscape/CytoscapeIcons.tsx"],"sourcesContent":["import {\n BubbleChartRounded as BubbleChartRoundedIcon,\n Hub as HubIcon,\n InsertLinkRounded as InsertLinkRoundedIcon,\n Inventory2Rounded as Inventory2RoundedIcon,\n QuestionMarkRounded as QuestionMarkRoundedIcon,\n TimerRounded as TimerRoundedIcon,\n VisibilityRounded as VisibilityRoundedIcon,\n} from '@mui/icons-material'\nimport { SvgIconTypeMap } from '@mui/material'\nimport { OverridableComponent } from '@mui/material/OverridableComponent'\n\nimport { CyNodeModuleTypes } from './lib'\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport const CyIconSet: Record<CyNodeModuleTypes, OverridableComponent<SvgIconTypeMap<{}, 'svg'>>> = {\n archivist: Inventory2RoundedIcon,\n bridge: InsertLinkRoundedIcon,\n diviner: BubbleChartRoundedIcon,\n module: QuestionMarkRoundedIcon,\n node: HubIcon,\n sentinel: TimerRoundedIcon,\n witness: VisibilityRoundedIcon,\n}\n"],"mappings":"AAAA;AAAA,EACE,sBAAsB;AAAA,EACtB,OAAO;AAAA,EACP,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,OAChB;AAOA,
|
|
1
|
+
{"version":3,"sources":["../../../src/Cytoscape/CytoscapeIcons.tsx"],"sourcesContent":["import {\n BubbleChartRounded as BubbleChartRoundedIcon,\n Hub as HubIcon,\n InsertLinkRounded as InsertLinkRoundedIcon,\n Inventory2Rounded as Inventory2RoundedIcon,\n QuestionMarkRounded as QuestionMarkRoundedIcon,\n TimerRounded as TimerRoundedIcon,\n VisibilityRounded as VisibilityRoundedIcon,\n} from '@mui/icons-material'\nimport { SvgIconTypeMap } from '@mui/material'\nimport { OverridableComponent } from '@mui/material/OverridableComponent'\n\nimport { CyNodeModuleTypes } from './lib'\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport const CyIconSet: Record<CyNodeModuleTypes, OverridableComponent<SvgIconTypeMap<{}, 'svg'>>> = {\n archivist: Inventory2RoundedIcon,\n bridge: InsertLinkRoundedIcon,\n diviner: BubbleChartRoundedIcon,\n module: QuestionMarkRoundedIcon,\n node: HubIcon,\n sentinel: TimerRoundedIcon,\n witness: VisibilityRoundedIcon,\n}\n"],"mappings":";AAAA;AAAA,EACE,sBAAsB;AAAA,EACtB,OAAO;AAAA,EACP,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,OAChB;AAOA,IAAM,YAAwF;AAAA,EACnG,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AACX;","names":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// src/Cytoscape/CytoscapeStyles.ts
|
|
2
|
+
var NodeIdStyles = (color, outlineColor) => ({
|
|
2
3
|
selector: "node[name]",
|
|
3
4
|
style: {
|
|
4
5
|
color,
|
|
@@ -11,7 +12,7 @@ const NodeIdStyles = (color, outlineColor) => ({
|
|
|
11
12
|
"text-valign": "top"
|
|
12
13
|
}
|
|
13
14
|
});
|
|
14
|
-
|
|
15
|
+
var NodeStyled = (icons, bgColor, hideLabels = false) => ({
|
|
15
16
|
selector: "node",
|
|
16
17
|
style: {
|
|
17
18
|
"background-color": bgColor,
|
|
@@ -22,7 +23,7 @@ const NodeStyled = (icons, bgColor, hideLabels = false) => ({
|
|
|
22
23
|
shape: "round-rectangle"
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
|
-
|
|
26
|
+
var EdgeStyled = (lineColor, targetArrowColor) => ({
|
|
26
27
|
selector: "edge",
|
|
27
28
|
style: {
|
|
28
29
|
"curve-style": "bezier",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Cytoscape/CytoscapeStyles.ts"],"sourcesContent":["import { Stylesheet } from 'cytoscape'\n\nimport { CyNodeModuleTypes } from './lib'\n\nexport const NodeIdStyles = (color?: string, outlineColor?: string): Stylesheet => ({\n selector: 'node[name]',\n style: {\n color,\n 'font-family': 'Lexend Deca, Helvetica, sans-serif',\n 'font-size': 12,\n 'overlay-padding': '6px',\n 'text-halign': 'center',\n 'text-outline-color': outlineColor,\n 'text-outline-width': '1px',\n 'text-valign': 'top',\n },\n})\n\nexport const NodeStyled = (icons: Record<CyNodeModuleTypes, string>, bgColor?: string, hideLabels = false): Stylesheet => ({\n selector: 'node',\n style: {\n 'background-color': bgColor,\n 'background-height': '75%',\n 'background-image': (elem) => icons[elem.data('type') as CyNodeModuleTypes],\n 'background-width': '24',\n label: hideLabels ? undefined : 'data(name)',\n shape: 'round-rectangle',\n },\n})\n\nexport const EdgeStyled = (lineColor?: string, targetArrowColor?: string) => ({\n selector: 'edge',\n style: {\n 'curve-style': 'bezier',\n 'line-color': lineColor,\n 'line-opacity': 0.1,\n 'target-arrow-color': targetArrowColor,\n 'target-arrow-shape': 'triangle',\n width: 3,\n },\n})\n"],"mappings":"AAIO,
|
|
1
|
+
{"version":3,"sources":["../../../src/Cytoscape/CytoscapeStyles.ts"],"sourcesContent":["import { Stylesheet } from 'cytoscape'\n\nimport { CyNodeModuleTypes } from './lib'\n\nexport const NodeIdStyles = (color?: string, outlineColor?: string): Stylesheet => ({\n selector: 'node[name]',\n style: {\n color,\n 'font-family': 'Lexend Deca, Helvetica, sans-serif',\n 'font-size': 12,\n 'overlay-padding': '6px',\n 'text-halign': 'center',\n 'text-outline-color': outlineColor,\n 'text-outline-width': '1px',\n 'text-valign': 'top',\n },\n})\n\nexport const NodeStyled = (icons: Record<CyNodeModuleTypes, string>, bgColor?: string, hideLabels = false): Stylesheet => ({\n selector: 'node',\n style: {\n 'background-color': bgColor,\n 'background-height': '75%',\n 'background-image': (elem) => icons[elem.data('type') as CyNodeModuleTypes],\n 'background-width': '24',\n label: hideLabels ? undefined : 'data(name)',\n shape: 'round-rectangle',\n },\n})\n\nexport const EdgeStyled = (lineColor?: string, targetArrowColor?: string) => ({\n selector: 'edge',\n style: {\n 'curve-style': 'bezier',\n 'line-color': lineColor,\n 'line-opacity': 0.1,\n 'target-arrow-color': targetArrowColor,\n 'target-arrow-shape': 'triangle',\n width: 3,\n },\n})\n"],"mappings":";AAIO,IAAM,eAAe,CAAC,OAAgB,kBAAuC;AAAA,EAClF,UAAU;AAAA,EACV,OAAO;AAAA,IACL;AAAA,IACA,eAAe;AAAA,IACf,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,sBAAsB;AAAA,IACtB,sBAAsB;AAAA,IACtB,eAAe;AAAA,EACjB;AACF;AAEO,IAAM,aAAa,CAAC,OAA0C,SAAkB,aAAa,WAAuB;AAAA,EACzH,UAAU;AAAA,EACV,OAAO;AAAA,IACL,oBAAoB;AAAA,IACpB,qBAAqB;AAAA,IACrB,oBAAoB,CAAC,SAAS,MAAM,KAAK,KAAK,MAAM,CAAsB;AAAA,IAC1E,oBAAoB;AAAA,IACpB,OAAO,aAAa,SAAY;AAAA,IAChC,OAAO;AAAA,EACT;AACF;AAEO,IAAM,aAAa,CAAC,WAAoB,sBAA+B;AAAA,EAC5E,UAAU;AAAA,EACV,OAAO;AAAA,IACL,eAAe;AAAA,IACf,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,sBAAsB;AAAA,IACtB,sBAAsB;AAAA,IACtB,OAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,5 +1,221 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// src/Cytoscape/CytoscapeElements.ts
|
|
2
|
+
import { isNodeInstance as isNodeInstance2 } from "@xyo-network/node-model";
|
|
3
|
+
|
|
4
|
+
// src/Cytoscape/lib/encodeSvg.ts
|
|
5
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
6
|
+
var dataUri = "data:image/svg+xml,";
|
|
7
|
+
var encodeSvg = (reactElement, color) => {
|
|
8
|
+
const svgString = renderToStaticMarkup(reactElement);
|
|
9
|
+
const doc = new DOMParser().parseFromString(svgString, "text/html");
|
|
10
|
+
const svgElement = doc.getElementsByTagName("svg")[0];
|
|
11
|
+
if (svgElement) {
|
|
12
|
+
svgElement.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
13
|
+
svgElement.setAttribute("height", "100");
|
|
14
|
+
svgElement.style.fill = color ?? "black";
|
|
15
|
+
}
|
|
16
|
+
return `${dataUri}${window.encodeURIComponent(svgElement.outerHTML)}`;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// src/Cytoscape/lib/iconMap.ts
|
|
20
|
+
var generateIconMap = () => ({
|
|
21
|
+
archivist: "",
|
|
22
|
+
bridge: "",
|
|
23
|
+
diviner: "",
|
|
24
|
+
module: "",
|
|
25
|
+
node: "",
|
|
26
|
+
sentinel: "",
|
|
27
|
+
witness: ""
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// src/Cytoscape/lib/layout/ColaLayout.ts
|
|
31
|
+
var ColaLayout = {
|
|
32
|
+
centerGraph: false,
|
|
33
|
+
convergenceThreshold: 0.01,
|
|
34
|
+
name: "cola"
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/Cytoscape/lib/layout/ConcentricLayout.ts
|
|
38
|
+
var ConcentricLayout = {
|
|
39
|
+
concentric: function(node) {
|
|
40
|
+
return node.degree();
|
|
41
|
+
},
|
|
42
|
+
levelWidth: function() {
|
|
43
|
+
return 2;
|
|
44
|
+
},
|
|
45
|
+
minNodeSpacing: 75,
|
|
46
|
+
name: "concentric"
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/Cytoscape/lib/parseModuleType.ts
|
|
50
|
+
import { isArchivistInstance } from "@xyo-network/archivist-model";
|
|
51
|
+
import { isBridgeInstance } from "@xyo-network/bridge-model";
|
|
52
|
+
import { isDivinerInstance } from "@xyo-network/diviner-model";
|
|
53
|
+
import { isNodeInstance } from "@xyo-network/node-model";
|
|
54
|
+
import { isSentinelInstance } from "@xyo-network/sentinel";
|
|
55
|
+
import { isWitnessModule } from "@xyo-network/witness";
|
|
56
|
+
var parseModuleType = (module) => {
|
|
57
|
+
let type = "module";
|
|
58
|
+
if (module) {
|
|
59
|
+
if (isArchivistInstance(module)) {
|
|
60
|
+
type = "archivist";
|
|
61
|
+
} else if (isBridgeInstance(module)) {
|
|
62
|
+
type = "bridge";
|
|
63
|
+
} else if (isDivinerInstance(module)) {
|
|
64
|
+
type = "diviner";
|
|
65
|
+
} else if (isNodeInstance(module)) {
|
|
66
|
+
type = "node";
|
|
67
|
+
} else if (isSentinelInstance(module)) {
|
|
68
|
+
type = "sentinel";
|
|
69
|
+
} else if (isWitnessModule(module)) {
|
|
70
|
+
type = "witness";
|
|
71
|
+
} else {
|
|
72
|
+
type = "module";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return type;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/Cytoscape/CytoscapeElements.ts
|
|
79
|
+
var CytoscapeElements = class _CytoscapeElements {
|
|
80
|
+
static MaxNameLength = 20;
|
|
81
|
+
static buildEdge(rootNode, newNode) {
|
|
82
|
+
return {
|
|
83
|
+
data: {
|
|
84
|
+
id: `${rootNode.data.id}/${newNode.data.id}`,
|
|
85
|
+
source: rootNode.data.id,
|
|
86
|
+
target: newNode.data.id
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
static async buildElements(module) {
|
|
91
|
+
const newRootNode = _CytoscapeElements.buildRootNode(module);
|
|
92
|
+
const newElements = [newRootNode];
|
|
93
|
+
try {
|
|
94
|
+
const childElements = await _CytoscapeElements.recurseNodes(module);
|
|
95
|
+
childElements?.forEach((module2) => {
|
|
96
|
+
const newNode = _CytoscapeElements.buildNode(module2, newRootNode.data.id);
|
|
97
|
+
newElements.push(newNode);
|
|
98
|
+
const newEdge = _CytoscapeElements.buildEdge(newRootNode, newNode);
|
|
99
|
+
newElements.push(newEdge);
|
|
100
|
+
});
|
|
101
|
+
return newElements;
|
|
102
|
+
} catch (e) {
|
|
103
|
+
console.error("error resolving modules", e);
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
static buildNode(module, rootNodeId) {
|
|
108
|
+
const { address, config } = module;
|
|
109
|
+
const normalizedName = config.name ?? address.substring(0, 8);
|
|
110
|
+
return {
|
|
111
|
+
data: {
|
|
112
|
+
address,
|
|
113
|
+
id: address,
|
|
114
|
+
name: normalizedName,
|
|
115
|
+
rootNodeId,
|
|
116
|
+
type: parseModuleType(module)
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
static buildRootNode = (module) => {
|
|
121
|
+
return _CytoscapeElements.buildNode(module);
|
|
122
|
+
};
|
|
123
|
+
static normalizeName(name) {
|
|
124
|
+
if (!name)
|
|
125
|
+
return;
|
|
126
|
+
if (name.length > this.MaxNameLength)
|
|
127
|
+
return `${name.substring(0, 20)}...`;
|
|
128
|
+
return name;
|
|
129
|
+
}
|
|
130
|
+
static async recurseNodes(module, maxTraversals = 1) {
|
|
131
|
+
let localDepth = 0;
|
|
132
|
+
const childModules = [];
|
|
133
|
+
const traverse = async (nestedNode) => {
|
|
134
|
+
if (localDepth < maxTraversals) {
|
|
135
|
+
const modules = await nestedNode.resolve(void 0, { direction: "down", maxDepth: 2 });
|
|
136
|
+
await Promise.all(
|
|
137
|
+
modules.map(async (child) => {
|
|
138
|
+
if (child !== nestedNode && isNodeInstance2(child)) {
|
|
139
|
+
localDepth++;
|
|
140
|
+
await traverse(child);
|
|
141
|
+
} else if (child !== module) {
|
|
142
|
+
childModules.push(child);
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
await traverse(module);
|
|
149
|
+
return childModules;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// src/Cytoscape/CytoscapeIcons.tsx
|
|
154
|
+
import {
|
|
155
|
+
BubbleChartRounded as BubbleChartRoundedIcon,
|
|
156
|
+
Hub as HubIcon,
|
|
157
|
+
InsertLinkRounded as InsertLinkRoundedIcon,
|
|
158
|
+
Inventory2Rounded as Inventory2RoundedIcon,
|
|
159
|
+
QuestionMarkRounded as QuestionMarkRoundedIcon,
|
|
160
|
+
TimerRounded as TimerRoundedIcon,
|
|
161
|
+
VisibilityRounded as VisibilityRoundedIcon
|
|
162
|
+
} from "@mui/icons-material";
|
|
163
|
+
var CyIconSet = {
|
|
164
|
+
archivist: Inventory2RoundedIcon,
|
|
165
|
+
bridge: InsertLinkRoundedIcon,
|
|
166
|
+
diviner: BubbleChartRoundedIcon,
|
|
167
|
+
module: QuestionMarkRoundedIcon,
|
|
168
|
+
node: HubIcon,
|
|
169
|
+
sentinel: TimerRoundedIcon,
|
|
170
|
+
witness: VisibilityRoundedIcon
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// src/Cytoscape/CytoscapeStyles.ts
|
|
174
|
+
var NodeIdStyles = (color, outlineColor) => ({
|
|
175
|
+
selector: "node[name]",
|
|
176
|
+
style: {
|
|
177
|
+
color,
|
|
178
|
+
"font-family": "Lexend Deca, Helvetica, sans-serif",
|
|
179
|
+
"font-size": 12,
|
|
180
|
+
"overlay-padding": "6px",
|
|
181
|
+
"text-halign": "center",
|
|
182
|
+
"text-outline-color": outlineColor,
|
|
183
|
+
"text-outline-width": "1px",
|
|
184
|
+
"text-valign": "top"
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
var NodeStyled = (icons, bgColor, hideLabels = false) => ({
|
|
188
|
+
selector: "node",
|
|
189
|
+
style: {
|
|
190
|
+
"background-color": bgColor,
|
|
191
|
+
"background-height": "75%",
|
|
192
|
+
"background-image": (elem) => icons[elem.data("type")],
|
|
193
|
+
"background-width": "24",
|
|
194
|
+
label: hideLabels ? void 0 : "data(name)",
|
|
195
|
+
shape: "round-rectangle"
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
var EdgeStyled = (lineColor, targetArrowColor) => ({
|
|
199
|
+
selector: "edge",
|
|
200
|
+
style: {
|
|
201
|
+
"curve-style": "bezier",
|
|
202
|
+
"line-color": lineColor,
|
|
203
|
+
"line-opacity": 0.1,
|
|
204
|
+
"target-arrow-color": targetArrowColor,
|
|
205
|
+
"target-arrow-shape": "triangle",
|
|
206
|
+
width: 3
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
export {
|
|
210
|
+
ColaLayout,
|
|
211
|
+
ConcentricLayout,
|
|
212
|
+
CyIconSet,
|
|
213
|
+
CytoscapeElements,
|
|
214
|
+
EdgeStyled,
|
|
215
|
+
NodeIdStyles,
|
|
216
|
+
NodeStyled,
|
|
217
|
+
encodeSvg,
|
|
218
|
+
generateIconMap,
|
|
219
|
+
parseModuleType
|
|
220
|
+
};
|
|
5
221
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Cytoscape/index.ts"],"sourcesContent":["export * from './CytoscapeElements'\nexport * from './CytoscapeIcons'\nexport * from './CytoscapeStyles'\nexport * from './lib'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/Cytoscape/CytoscapeElements.ts","../../../src/Cytoscape/lib/encodeSvg.ts","../../../src/Cytoscape/lib/iconMap.ts","../../../src/Cytoscape/lib/layout/ColaLayout.ts","../../../src/Cytoscape/lib/layout/ConcentricLayout.ts","../../../src/Cytoscape/lib/parseModuleType.ts","../../../src/Cytoscape/CytoscapeIcons.tsx","../../../src/Cytoscape/CytoscapeStyles.ts"],"sourcesContent":["import { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { ElementDefinition } from 'cytoscape'\n\nimport { parseModuleType } from './lib'\n\nexport class CytoscapeElements {\n static MaxNameLength = 20\n\n static buildEdge(rootNode: ElementDefinition, newNode: ElementDefinition) {\n return {\n data: {\n id: `${rootNode.data.id}/${newNode.data.id}`,\n source: rootNode.data.id,\n target: newNode.data.id,\n },\n }\n }\n\n static async buildElements(module: ModuleInstance): Promise<ElementDefinition[]> {\n const newRootNode = CytoscapeElements.buildRootNode(module)\n const newElements: ElementDefinition[] = [newRootNode]\n\n try {\n const childElements = await CytoscapeElements.recurseNodes(module)\n childElements?.forEach((module) => {\n const newNode = CytoscapeElements.buildNode(module, newRootNode.data.id)\n newElements.push(newNode)\n\n const newEdge = CytoscapeElements.buildEdge(newRootNode, newNode)\n newElements.push(newEdge)\n })\n\n return newElements\n } catch (e) {\n console.error('error resolving modules', e)\n return []\n }\n }\n\n static buildNode(module: ModuleInstance, rootNodeId?: string): ElementDefinition {\n const { address, config } = module\n const normalizedName = config.name ?? address.substring(0, 8)\n return {\n data: {\n address,\n id: address,\n name: normalizedName,\n rootNodeId,\n type: parseModuleType(module),\n },\n }\n }\n\n static buildRootNode = (module: ModuleInstance): ElementDefinition => {\n return CytoscapeElements.buildNode(module)\n }\n\n static normalizeName(name?: string) {\n if (!name) return\n if (name.length > this.MaxNameLength) return `${name.substring(0, 20)}...`\n return name\n }\n\n static async recurseNodes(module: ModuleInstance, maxTraversals = 1): Promise<ModuleInstance[]> {\n let localDepth = 0\n const childModules: ModuleInstance[] = []\n\n const traverse = async (nestedNode: ModuleInstance) => {\n if (localDepth < maxTraversals) {\n const modules = await nestedNode.resolve(undefined, { direction: 'down', maxDepth: 2 })\n await Promise.all(\n modules.map(async (child) => {\n if (child !== nestedNode && isNodeInstance(child)) {\n localDepth++\n await traverse(child)\n // don't re add the root module that was passed in\n } else if (child !== module) {\n childModules.push(child)\n }\n }),\n )\n }\n }\n\n await traverse(module)\n\n return childModules\n }\n}\n","import { ReactElement } from 'react'\n// eslint-disable-next-line import/no-internal-modules\nimport { renderToStaticMarkup } from 'react-dom/server'\n\nconst dataUri = 'data:image/svg+xml,'\n\nexport const encodeSvg = (reactElement: ReactElement, color?: string) => {\n const svgString = renderToStaticMarkup(reactElement)\n\n const doc = new DOMParser().parseFromString(svgString, 'text/html')\n const svgElement = doc.getElementsByTagName('svg')[0]\n if (svgElement) {\n svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')\n svgElement.setAttribute('height', '100')\n svgElement.style.fill = color ?? 'black'\n }\n\n return `${dataUri}${window.encodeURIComponent(svgElement.outerHTML)}`\n}\n","import { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const generateIconMap: () => Record<CyNodeModuleTypes, string> = () => ({\n archivist: '',\n bridge: '',\n diviner: '',\n module: '',\n node: '',\n sentinel: '',\n witness: '',\n})\n","export const ColaLayout = {\n centerGraph: false,\n convergenceThreshold: 0.01,\n name: 'cola',\n}\n","import { CytoscapeOptions } from 'cytoscape'\n\nexport const ConcentricLayout: CytoscapeOptions['layout'] = {\n concentric: function (node) {\n return node.degree()\n },\n levelWidth: function () {\n return 2\n },\n minNodeSpacing: 75,\n name: 'concentric',\n}\n","import { isArchivistInstance } from '@xyo-network/archivist-model'\nimport { isBridgeInstance } from '@xyo-network/bridge-model'\nimport { isDivinerInstance } from '@xyo-network/diviner-model'\nimport { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel'\nimport { isWitnessModule } from '@xyo-network/witness'\n\nimport { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const parseModuleType = (module?: ModuleInstance): CyNodeModuleTypes => {\n let type: CyNodeModuleTypes = 'module'\n if (module) {\n if (isArchivistInstance(module)) {\n type = 'archivist'\n } else if (isBridgeInstance(module)) {\n type = 'bridge'\n } else if (isDivinerInstance(module)) {\n type = 'diviner'\n } else if (isNodeInstance(module)) {\n type = 'node'\n } else if (isSentinelInstance(module)) {\n type = 'sentinel'\n } else if (isWitnessModule(module)) {\n type = 'witness'\n } else {\n type = 'module'\n }\n }\n return type\n}\n","import {\n BubbleChartRounded as BubbleChartRoundedIcon,\n Hub as HubIcon,\n InsertLinkRounded as InsertLinkRoundedIcon,\n Inventory2Rounded as Inventory2RoundedIcon,\n QuestionMarkRounded as QuestionMarkRoundedIcon,\n TimerRounded as TimerRoundedIcon,\n VisibilityRounded as VisibilityRoundedIcon,\n} from '@mui/icons-material'\nimport { SvgIconTypeMap } from '@mui/material'\nimport { OverridableComponent } from '@mui/material/OverridableComponent'\n\nimport { CyNodeModuleTypes } from './lib'\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport const CyIconSet: Record<CyNodeModuleTypes, OverridableComponent<SvgIconTypeMap<{}, 'svg'>>> = {\n archivist: Inventory2RoundedIcon,\n bridge: InsertLinkRoundedIcon,\n diviner: BubbleChartRoundedIcon,\n module: QuestionMarkRoundedIcon,\n node: HubIcon,\n sentinel: TimerRoundedIcon,\n witness: VisibilityRoundedIcon,\n}\n","import { Stylesheet } from 'cytoscape'\n\nimport { CyNodeModuleTypes } from './lib'\n\nexport const NodeIdStyles = (color?: string, outlineColor?: string): Stylesheet => ({\n selector: 'node[name]',\n style: {\n color,\n 'font-family': 'Lexend Deca, Helvetica, sans-serif',\n 'font-size': 12,\n 'overlay-padding': '6px',\n 'text-halign': 'center',\n 'text-outline-color': outlineColor,\n 'text-outline-width': '1px',\n 'text-valign': 'top',\n },\n})\n\nexport const NodeStyled = (icons: Record<CyNodeModuleTypes, string>, bgColor?: string, hideLabels = false): Stylesheet => ({\n selector: 'node',\n style: {\n 'background-color': bgColor,\n 'background-height': '75%',\n 'background-image': (elem) => icons[elem.data('type') as CyNodeModuleTypes],\n 'background-width': '24',\n label: hideLabels ? undefined : 'data(name)',\n shape: 'round-rectangle',\n },\n})\n\nexport const EdgeStyled = (lineColor?: string, targetArrowColor?: string) => ({\n selector: 'edge',\n style: {\n 'curve-style': 'bezier',\n 'line-color': lineColor,\n 'line-opacity': 0.1,\n 'target-arrow-color': targetArrowColor,\n 'target-arrow-shape': 'triangle',\n width: 3,\n },\n})\n"],"mappings":";AACA,SAAS,kBAAAA,uBAAsB;;;ACC/B,SAAS,4BAA4B;AAErC,IAAM,UAAU;AAET,IAAM,YAAY,CAAC,cAA4B,UAAmB;AACvE,QAAM,YAAY,qBAAqB,YAAY;AAEnD,QAAM,MAAM,IAAI,UAAU,EAAE,gBAAgB,WAAW,WAAW;AAClE,QAAM,aAAa,IAAI,qBAAqB,KAAK,EAAE,CAAC;AACpD,MAAI,YAAY;AACd,eAAW,aAAa,SAAS,4BAA4B;AAC7D,eAAW,aAAa,UAAU,KAAK;AACvC,eAAW,MAAM,OAAO,SAAS;AAAA,EACnC;AAEA,SAAO,GAAG,OAAO,GAAG,OAAO,mBAAmB,WAAW,SAAS,CAAC;AACrE;;;AChBO,IAAM,kBAA2D,OAAO;AAAA,EAC7E,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AACX;;;ACVO,IAAM,aAAa;AAAA,EACxB,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,MAAM;AACR;;;ACFO,IAAM,mBAA+C;AAAA,EAC1D,YAAY,SAAU,MAAM;AAC1B,WAAO,KAAK,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,MAAM;AAErB,WAAO;AAAA,EACT;AACF;;;AMzFA;AAAA,EACE,sBAAsB;AAAA,EACtB,OAAO;AAAA,EACP,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,OAChB;AAOA,IAAM,YAAwF;AAAA,EACnG,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AACX;;;ACnBO,IAAM,eAAe,CAAC,OAAgB,kBAAuC;AAAA,EAClF,UAAU;AAAA,EACV,OAAO;AAAA,IACL;AAAA,IACA,eAAe;AAAA,IACf,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,sBAAsB;AAAA,IACtB,sBAAsB;AAAA,IACtB,eAAe;AAAA,EACjB;AACF;AAEO,IAAM,aAAa,CAAC,OAA0C,SAAkB,aAAa,WAAuB;AAAA,EACzH,UAAU;AAAA,EACV,OAAO;AAAA,IACL,oBAAoB;AAAA,IACpB,qBAAqB;AAAA,IACrB,oBAAoB,CAAC,SAAS,MAAM,KAAK,KAAK,MAAM,CAAsB;AAAA,IAC1E,oBAAoB;AAAA,IACpB,OAAO,aAAa,SAAY;AAAA,IAChC,OAAO;AAAA,EACT;AACF;AAEO,IAAM,aAAa,CAAC,WAAoB,sBAA+B;AAAA,EAC5E,UAAU;AAAA,EACV,OAAO;AAAA,IACL,eAAe;AAAA,IACf,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,sBAAsB;AAAA,IACtB,sBAAsB;AAAA,IACtB,OAAO;AAAA,EACT;AACF;","names":["isNodeInstance","module","isNodeInstance"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
// src/Cytoscape/lib/encodeSvg.ts
|
|
1
2
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
var dataUri = "data:image/svg+xml,";
|
|
4
|
+
var encodeSvg = (reactElement, color) => {
|
|
4
5
|
const svgString = renderToStaticMarkup(reactElement);
|
|
5
6
|
const doc = new DOMParser().parseFromString(svgString, "text/html");
|
|
6
7
|
const svgElement = doc.getElementsByTagName("svg")[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/Cytoscape/lib/encodeSvg.ts"],"sourcesContent":["import { ReactElement } from 'react'\n// eslint-disable-next-line import/no-internal-modules\nimport { renderToStaticMarkup } from 'react-dom/server'\n\nconst dataUri = 'data:image/svg+xml,'\n\nexport const encodeSvg = (reactElement: ReactElement, color?: string) => {\n const svgString = renderToStaticMarkup(reactElement)\n\n const doc = new DOMParser().parseFromString(svgString, 'text/html')\n const svgElement = doc.getElementsByTagName('svg')[0]\n if (svgElement) {\n svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')\n svgElement.setAttribute('height', '100')\n svgElement.style.fill = color ?? 'black'\n }\n\n return `${dataUri}${window.encodeURIComponent(svgElement.outerHTML)}`\n}\n"],"mappings":"AAEA,SAAS,4BAA4B;AAErC,
|
|
1
|
+
{"version":3,"sources":["../../../../src/Cytoscape/lib/encodeSvg.ts"],"sourcesContent":["import { ReactElement } from 'react'\n// eslint-disable-next-line import/no-internal-modules\nimport { renderToStaticMarkup } from 'react-dom/server'\n\nconst dataUri = 'data:image/svg+xml,'\n\nexport const encodeSvg = (reactElement: ReactElement, color?: string) => {\n const svgString = renderToStaticMarkup(reactElement)\n\n const doc = new DOMParser().parseFromString(svgString, 'text/html')\n const svgElement = doc.getElementsByTagName('svg')[0]\n if (svgElement) {\n svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')\n svgElement.setAttribute('height', '100')\n svgElement.style.fill = color ?? 'black'\n }\n\n return `${dataUri}${window.encodeURIComponent(svgElement.outerHTML)}`\n}\n"],"mappings":";AAEA,SAAS,4BAA4B;AAErC,IAAM,UAAU;AAET,IAAM,YAAY,CAAC,cAA4B,UAAmB;AACvE,QAAM,YAAY,qBAAqB,YAAY;AAEnD,QAAM,MAAM,IAAI,UAAU,EAAE,gBAAgB,WAAW,WAAW;AAClE,QAAM,aAAa,IAAI,qBAAqB,KAAK,EAAE,CAAC;AACpD,MAAI,YAAY;AACd,eAAW,aAAa,SAAS,4BAA4B;AAC7D,eAAW,aAAa,UAAU,KAAK;AACvC,eAAW,MAAM,OAAO,SAAS;AAAA,EACnC;AAEA,SAAO,GAAG,OAAO,GAAG,OAAO,mBAAmB,WAAW,SAAS,CAAC;AACrE;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/Cytoscape/lib/iconMap.ts"],"sourcesContent":["import { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const generateIconMap: () => Record<CyNodeModuleTypes, string> = () => ({\n archivist: '',\n bridge: '',\n diviner: '',\n module: '',\n node: '',\n sentinel: '',\n witness: '',\n})\n"],"mappings":"AAEO,
|
|
1
|
+
{"version":3,"sources":["../../../../src/Cytoscape/lib/iconMap.ts"],"sourcesContent":["import { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const generateIconMap: () => Record<CyNodeModuleTypes, string> = () => ({\n archivist: '',\n bridge: '',\n diviner: '',\n module: '',\n node: '',\n sentinel: '',\n witness: '',\n})\n"],"mappings":";AAEO,IAAM,kBAA2D,OAAO;AAAA,EAC7E,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AACX;","names":[]}
|
|
@@ -1,6 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// src/Cytoscape/lib/encodeSvg.ts
|
|
2
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
3
|
+
var dataUri = "data:image/svg+xml,";
|
|
4
|
+
var encodeSvg = (reactElement, color) => {
|
|
5
|
+
const svgString = renderToStaticMarkup(reactElement);
|
|
6
|
+
const doc = new DOMParser().parseFromString(svgString, "text/html");
|
|
7
|
+
const svgElement = doc.getElementsByTagName("svg")[0];
|
|
8
|
+
if (svgElement) {
|
|
9
|
+
svgElement.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
10
|
+
svgElement.setAttribute("height", "100");
|
|
11
|
+
svgElement.style.fill = color ?? "black";
|
|
12
|
+
}
|
|
13
|
+
return `${dataUri}${window.encodeURIComponent(svgElement.outerHTML)}`;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// src/Cytoscape/lib/iconMap.ts
|
|
17
|
+
var generateIconMap = () => ({
|
|
18
|
+
archivist: "",
|
|
19
|
+
bridge: "",
|
|
20
|
+
diviner: "",
|
|
21
|
+
module: "",
|
|
22
|
+
node: "",
|
|
23
|
+
sentinel: "",
|
|
24
|
+
witness: ""
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// src/Cytoscape/lib/layout/ColaLayout.ts
|
|
28
|
+
var ColaLayout = {
|
|
29
|
+
centerGraph: false,
|
|
30
|
+
convergenceThreshold: 0.01,
|
|
31
|
+
name: "cola"
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/Cytoscape/lib/layout/ConcentricLayout.ts
|
|
35
|
+
var ConcentricLayout = {
|
|
36
|
+
concentric: function(node) {
|
|
37
|
+
return node.degree();
|
|
38
|
+
},
|
|
39
|
+
levelWidth: function() {
|
|
40
|
+
return 2;
|
|
41
|
+
},
|
|
42
|
+
minNodeSpacing: 75,
|
|
43
|
+
name: "concentric"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// src/Cytoscape/lib/parseModuleType.ts
|
|
47
|
+
import { isArchivistInstance } from "@xyo-network/archivist-model";
|
|
48
|
+
import { isBridgeInstance } from "@xyo-network/bridge-model";
|
|
49
|
+
import { isDivinerInstance } from "@xyo-network/diviner-model";
|
|
50
|
+
import { isNodeInstance } from "@xyo-network/node-model";
|
|
51
|
+
import { isSentinelInstance } from "@xyo-network/sentinel";
|
|
52
|
+
import { isWitnessModule } from "@xyo-network/witness";
|
|
53
|
+
var parseModuleType = (module) => {
|
|
54
|
+
let type = "module";
|
|
55
|
+
if (module) {
|
|
56
|
+
if (isArchivistInstance(module)) {
|
|
57
|
+
type = "archivist";
|
|
58
|
+
} else if (isBridgeInstance(module)) {
|
|
59
|
+
type = "bridge";
|
|
60
|
+
} else if (isDivinerInstance(module)) {
|
|
61
|
+
type = "diviner";
|
|
62
|
+
} else if (isNodeInstance(module)) {
|
|
63
|
+
type = "node";
|
|
64
|
+
} else if (isSentinelInstance(module)) {
|
|
65
|
+
type = "sentinel";
|
|
66
|
+
} else if (isWitnessModule(module)) {
|
|
67
|
+
type = "witness";
|
|
68
|
+
} else {
|
|
69
|
+
type = "module";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return type;
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
ColaLayout,
|
|
76
|
+
ConcentricLayout,
|
|
77
|
+
encodeSvg,
|
|
78
|
+
generateIconMap,
|
|
79
|
+
parseModuleType
|
|
80
|
+
};
|
|
6
81
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/Cytoscape/lib/
|
|
1
|
+
{"version":3,"sources":["../../../../src/Cytoscape/lib/encodeSvg.ts","../../../../src/Cytoscape/lib/iconMap.ts","../../../../src/Cytoscape/lib/layout/ColaLayout.ts","../../../../src/Cytoscape/lib/layout/ConcentricLayout.ts","../../../../src/Cytoscape/lib/parseModuleType.ts"],"sourcesContent":["import { ReactElement } from 'react'\n// eslint-disable-next-line import/no-internal-modules\nimport { renderToStaticMarkup } from 'react-dom/server'\n\nconst dataUri = 'data:image/svg+xml,'\n\nexport const encodeSvg = (reactElement: ReactElement, color?: string) => {\n const svgString = renderToStaticMarkup(reactElement)\n\n const doc = new DOMParser().parseFromString(svgString, 'text/html')\n const svgElement = doc.getElementsByTagName('svg')[0]\n if (svgElement) {\n svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')\n svgElement.setAttribute('height', '100')\n svgElement.style.fill = color ?? 'black'\n }\n\n return `${dataUri}${window.encodeURIComponent(svgElement.outerHTML)}`\n}\n","import { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const generateIconMap: () => Record<CyNodeModuleTypes, string> = () => ({\n archivist: '',\n bridge: '',\n diviner: '',\n module: '',\n node: '',\n sentinel: '',\n witness: '',\n})\n","export const ColaLayout = {\n centerGraph: false,\n convergenceThreshold: 0.01,\n name: 'cola',\n}\n","import { CytoscapeOptions } from 'cytoscape'\n\nexport const ConcentricLayout: CytoscapeOptions['layout'] = {\n concentric: function (node) {\n return node.degree()\n },\n levelWidth: function () {\n return 2\n },\n minNodeSpacing: 75,\n name: 'concentric',\n}\n","import { isArchivistInstance } from '@xyo-network/archivist-model'\nimport { isBridgeInstance } from '@xyo-network/bridge-model'\nimport { isDivinerInstance } from '@xyo-network/diviner-model'\nimport { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel'\nimport { isWitnessModule } from '@xyo-network/witness'\n\nimport { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const parseModuleType = (module?: ModuleInstance): CyNodeModuleTypes => {\n let type: CyNodeModuleTypes = 'module'\n if (module) {\n if (isArchivistInstance(module)) {\n type = 'archivist'\n } else if (isBridgeInstance(module)) {\n type = 'bridge'\n } else if (isDivinerInstance(module)) {\n type = 'diviner'\n } else if (isNodeInstance(module)) {\n type = 'node'\n } else if (isSentinelInstance(module)) {\n type = 'sentinel'\n } else if (isWitnessModule(module)) {\n type = 'witness'\n } else {\n type = 'module'\n }\n }\n return type\n}\n"],"mappings":";AAEA,SAAS,4BAA4B;AAErC,IAAM,UAAU;AAET,IAAM,YAAY,CAAC,cAA4B,UAAmB;AACvE,QAAM,YAAY,qBAAqB,YAAY;A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;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/Cytoscape/lib/layout/ColaLayout.ts"],"sourcesContent":["export const ColaLayout = {\n centerGraph: false,\n convergenceThreshold: 0.01,\n name: 'cola',\n}\n"],"mappings":"AAAO,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/Cytoscape/lib/layout/ColaLayout.ts"],"sourcesContent":["export const ColaLayout = {\n centerGraph: false,\n convergenceThreshold: 0.01,\n name: 'cola',\n}\n"],"mappings":";AAAO,IAAM,aAAa;AAAA,EACxB,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,MAAM;AACR;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/Cytoscape/lib/layout/ConcentricLayout.ts"],"sourcesContent":["import { CytoscapeOptions } from 'cytoscape'\n\nexport const ConcentricLayout: CytoscapeOptions['layout'] = {\n concentric: function (node) {\n return node.degree()\n },\n levelWidth: function () {\n return 2\n },\n minNodeSpacing: 75,\n name: 'concentric',\n}\n"],"mappings":"AAEO,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/Cytoscape/lib/layout/ConcentricLayout.ts"],"sourcesContent":["import { CytoscapeOptions } from 'cytoscape'\n\nexport const ConcentricLayout: CytoscapeOptions['layout'] = {\n concentric: function (node) {\n return node.degree()\n },\n levelWidth: function () {\n return 2\n },\n minNodeSpacing: 75,\n name: 'concentric',\n}\n"],"mappings":";AAEO,IAAM,mBAA+C;AAAA,EAC1D,YAAY,SAAU,MAAM;AAC1B,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EACA,YAAY,WAAY;AACtB,WAAO;AAAA,EACT;AAAA,EACA,gBAAgB;AAAA,EAChB,MAAM;AACR;","names":[]}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// src/Cytoscape/lib/layout/ColaLayout.ts
|
|
2
|
+
var ColaLayout = {
|
|
3
|
+
centerGraph: false,
|
|
4
|
+
convergenceThreshold: 0.01,
|
|
5
|
+
name: "cola"
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/Cytoscape/lib/layout/ConcentricLayout.ts
|
|
9
|
+
var ConcentricLayout = {
|
|
10
|
+
concentric: function(node) {
|
|
11
|
+
return node.degree();
|
|
12
|
+
},
|
|
13
|
+
levelWidth: function() {
|
|
14
|
+
return 2;
|
|
15
|
+
},
|
|
16
|
+
minNodeSpacing: 75,
|
|
17
|
+
name: "concentric"
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
ColaLayout,
|
|
21
|
+
ConcentricLayout
|
|
22
|
+
};
|
|
3
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/Cytoscape/lib/layout/
|
|
1
|
+
{"version":3,"sources":["../../../../../src/Cytoscape/lib/layout/ColaLayout.ts","../../../../../src/Cytoscape/lib/layout/ConcentricLayout.ts"],"sourcesContent":["export const ColaLayout = {\n centerGraph: false,\n convergenceThreshold: 0.01,\n name: 'cola',\n}\n","import { CytoscapeOptions } from 'cytoscape'\n\nexport const ConcentricLayout: CytoscapeOptions['layout'] = {\n concentric: function (node) {\n return node.degree()\n },\n levelWidth: function () {\n return 2\n },\n minNodeSpacing: 75,\n name: 'concentric',\n}\n"],"mappings":";AAAO,IAAM,aAAa;AAAA,EACxB,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,MAAM;AACR;;;ACFO,IAAM,mBAA+C;AAAA,EAC1D,YAAY,SAAU,MAAM;AAC1B,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EACA,YAAY,WAAY;AACtB,WAAO;AAAA,EACT;AAAA,EACA,gBAAgB;AAAA,EAChB,MAAM;AACR;","names":[]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
// src/Cytoscape/lib/parseModuleType.ts
|
|
1
2
|
import { isArchivistInstance } from "@xyo-network/archivist-model";
|
|
2
3
|
import { isBridgeInstance } from "@xyo-network/bridge-model";
|
|
3
4
|
import { isDivinerInstance } from "@xyo-network/diviner-model";
|
|
4
5
|
import { isNodeInstance } from "@xyo-network/node-model";
|
|
5
6
|
import { isSentinelInstance } from "@xyo-network/sentinel";
|
|
6
7
|
import { isWitnessModule } from "@xyo-network/witness";
|
|
7
|
-
|
|
8
|
+
var parseModuleType = (module) => {
|
|
8
9
|
let type = "module";
|
|
9
10
|
if (module) {
|
|
10
11
|
if (isArchivistInstance(module)) {
|