@xyo-network/react-node-renderer 2.76.0 → 2.76.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/dist/browser/components/lib/RelationalGraphProps.d.cts +4 -0
- package/dist/browser/components/lib/RelationalGraphProps.d.cts.map +1 -1
- package/dist/browser/components/lib/RelationalGraphProps.d.mts +4 -0
- package/dist/browser/components/lib/RelationalGraphProps.d.mts.map +1 -1
- package/dist/browser/components/lib/RelationalGraphProps.d.ts +4 -0
- package/dist/browser/components/lib/RelationalGraphProps.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 +39 -9
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +41 -11
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/components/lib/RelationalGraphProps.d.cts +4 -0
- package/dist/neutral/components/lib/RelationalGraphProps.d.cts.map +1 -1
- package/dist/neutral/components/lib/RelationalGraphProps.d.mts +4 -0
- package/dist/neutral/components/lib/RelationalGraphProps.d.mts.map +1 -1
- package/dist/neutral/components/lib/RelationalGraphProps.d.ts +4 -0
- package/dist/neutral/components/lib/RelationalGraphProps.d.ts.map +1 -1
- package/dist/neutral/components/relational/graph/Graph.d.cts.map +1 -1
- package/dist/neutral/components/relational/graph/Graph.d.mts.map +1 -1
- package/dist/neutral/components/relational/graph/Graph.d.ts.map +1 -1
- package/dist/neutral/index.cjs +39 -9
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +41 -11
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/components/lib/RelationalGraphProps.d.cts +4 -0
- package/dist/node/components/lib/RelationalGraphProps.d.cts.map +1 -1
- package/dist/node/components/lib/RelationalGraphProps.d.mts +4 -0
- package/dist/node/components/lib/RelationalGraphProps.d.mts.map +1 -1
- package/dist/node/components/lib/RelationalGraphProps.d.ts +4 -0
- package/dist/node/components/lib/RelationalGraphProps.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 +41 -9
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +43 -11
- package/dist/node/index.js.map +1 -1
- package/package.json +22 -22
- package/src/components/lib/RelationalGraphProps.ts +4 -0
- package/src/components/relational/graph/Graph.tsx +54 -9
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Address } from '@xylabs/hex';
|
|
1
2
|
import { FlexBoxProps } from '@xylabs/react-flexbox';
|
|
3
|
+
import { NodeInstance } from '@xyo-network/node-model';
|
|
2
4
|
import { CytoscapeOptions } from 'cytoscape';
|
|
3
5
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
4
6
|
export interface NodeRelationalGraphProps extends PropsWithChildren<FlexBoxProps> {
|
|
@@ -6,6 +8,8 @@ export interface NodeRelationalGraphProps extends PropsWithChildren<FlexBoxProps
|
|
|
6
8
|
detail?: ReactNode;
|
|
7
9
|
layout?: 'dagre' | 'euler' | 'cose-bilkent' | 'cola';
|
|
8
10
|
layoutOptions?: object;
|
|
11
|
+
node?: WeakRef<NodeInstance>;
|
|
12
|
+
onHover?: (address?: Address) => void;
|
|
9
13
|
options?: CytoscapeOptions;
|
|
10
14
|
showDetails?: boolean;
|
|
11
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationalGraphProps.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/RelationalGraphProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB,CAAC,YAAY,CAAC;IAC/E,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,MAAM,CAAA;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB"}
|
|
1
|
+
{"version":3,"file":"RelationalGraphProps.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/RelationalGraphProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB,CAAC,YAAY,CAAC;IAC/E,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,MAAM,CAAA;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC5B,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Address } from '@xylabs/hex';
|
|
1
2
|
import { FlexBoxProps } from '@xylabs/react-flexbox';
|
|
3
|
+
import { NodeInstance } from '@xyo-network/node-model';
|
|
2
4
|
import { CytoscapeOptions } from 'cytoscape';
|
|
3
5
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
4
6
|
export interface NodeRelationalGraphProps extends PropsWithChildren<FlexBoxProps> {
|
|
@@ -6,6 +8,8 @@ export interface NodeRelationalGraphProps extends PropsWithChildren<FlexBoxProps
|
|
|
6
8
|
detail?: ReactNode;
|
|
7
9
|
layout?: 'dagre' | 'euler' | 'cose-bilkent' | 'cola';
|
|
8
10
|
layoutOptions?: object;
|
|
11
|
+
node?: WeakRef<NodeInstance>;
|
|
12
|
+
onHover?: (address?: Address) => void;
|
|
9
13
|
options?: CytoscapeOptions;
|
|
10
14
|
showDetails?: boolean;
|
|
11
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationalGraphProps.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/RelationalGraphProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB,CAAC,YAAY,CAAC;IAC/E,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,MAAM,CAAA;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB"}
|
|
1
|
+
{"version":3,"file":"RelationalGraphProps.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/RelationalGraphProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB,CAAC,YAAY,CAAC;IAC/E,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,MAAM,CAAA;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC5B,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Address } from '@xylabs/hex';
|
|
1
2
|
import { FlexBoxProps } from '@xylabs/react-flexbox';
|
|
3
|
+
import { NodeInstance } from '@xyo-network/node-model';
|
|
2
4
|
import { CytoscapeOptions } from 'cytoscape';
|
|
3
5
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
4
6
|
export interface NodeRelationalGraphProps extends PropsWithChildren<FlexBoxProps> {
|
|
@@ -6,6 +8,8 @@ export interface NodeRelationalGraphProps extends PropsWithChildren<FlexBoxProps
|
|
|
6
8
|
detail?: ReactNode;
|
|
7
9
|
layout?: 'dagre' | 'euler' | 'cose-bilkent' | 'cola';
|
|
8
10
|
layoutOptions?: object;
|
|
11
|
+
node?: WeakRef<NodeInstance>;
|
|
12
|
+
onHover?: (address?: Address) => void;
|
|
9
13
|
options?: CytoscapeOptions;
|
|
10
14
|
showDetails?: boolean;
|
|
11
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationalGraphProps.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/RelationalGraphProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB,CAAC,YAAY,CAAC;IAC/E,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,MAAM,CAAA;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB"}
|
|
1
|
+
{"version":3,"file":"RelationalGraphProps.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/RelationalGraphProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB,CAAC,YAAY,CAAC;IAC/E,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,MAAM,CAAA;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC5B,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/components/relational/graph/Graph.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/components/relational/graph/Graph.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAgDpD,eAAO,MAAM,0BAA0B,qHAmGtC,CAAA;AAID,kBAAkB;AAClB,eAAO,MAAM,mBAAmB,qHAA6B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/components/relational/graph/Graph.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/components/relational/graph/Graph.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAgDpD,eAAO,MAAM,0BAA0B,qHAmGtC,CAAA;AAID,kBAAkB;AAClB,eAAO,MAAM,mBAAmB,qHAA6B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/components/relational/graph/Graph.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/components/relational/graph/Graph.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAgDpD,eAAO,MAAM,0BAA0B,qHAmGtC,CAAA;AAID,kBAAkB;AAClB,eAAO,MAAM,mBAAmB,qHAA6B,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -576,7 +576,10 @@ var WithExtensions = ({ children }) => {
|
|
|
576
576
|
|
|
577
577
|
// src/components/relational/graph/Graph.tsx
|
|
578
578
|
var import_material3 = require("@mui/material");
|
|
579
|
+
var import_hex = require("@xylabs/hex");
|
|
579
580
|
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
581
|
+
var import_react_identicon = require("@xylabs/react-identicon");
|
|
582
|
+
var import_react_node2 = require("@xyo-network/react-node");
|
|
580
583
|
var import_cytoscape2 = __toESM(require("cytoscape"), 1);
|
|
581
584
|
var import_cytoscape_cola2 = __toESM(require("cytoscape-cola"), 1);
|
|
582
585
|
var import_cytoscape_cose_bilkent2 = __toESM(require("cytoscape-cose-bilkent"), 1);
|
|
@@ -607,12 +610,41 @@ var loadLayout = (layout = "cola") => {
|
|
|
607
610
|
}
|
|
608
611
|
}
|
|
609
612
|
};
|
|
613
|
+
var ModuleHoverDetails = ({ name, address, ...props }) => {
|
|
614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material3.Card, { elevation: 3, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
615
|
+
import_material3.CardHeader,
|
|
616
|
+
{
|
|
617
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material3.Paper, { elevation: 6, sx: { bgcolor: "#fff", p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_identicon.Identicon, { value: address, size: 24 }) }),
|
|
618
|
+
title: name,
|
|
619
|
+
subheader: address
|
|
620
|
+
}
|
|
621
|
+
) });
|
|
622
|
+
};
|
|
610
623
|
var NodeRelationalGraphFlexBox = (0, import_react13.forwardRef)(
|
|
611
|
-
({ actions, children, layout, layoutOptions, showDetails, detail, options, ...props }, ref) => {
|
|
624
|
+
({ actions, children, node, layout, layoutOptions, showDetails, detail, options, onHover, ...props }, ref) => {
|
|
612
625
|
const theme = (0, import_material3.useTheme)();
|
|
613
626
|
const [cy, setCy] = (0, import_react13.useState)();
|
|
614
|
-
const { setCy: setCyContext } = useCytoscapeInstance();
|
|
615
627
|
const cytoscapeRef = (0, import_react13.useRef)();
|
|
628
|
+
const [hoverPosition, setHoverBoundingBox] = (0, import_react13.useState)();
|
|
629
|
+
const [hoverAddress, setHoverAddress] = (0, import_react13.useState)();
|
|
630
|
+
const [moduleInstance] = (0, import_react_node2.useWeakModuleFromNode)(hoverAddress, { node });
|
|
631
|
+
(0, import_react13.useEffect)(() => {
|
|
632
|
+
cy?.on("mouseover tap", ({ target }) => {
|
|
633
|
+
const cyNode = target;
|
|
634
|
+
const bb = cyNode?.renderedBoundingBox?.();
|
|
635
|
+
setHoverBoundingBox(bb);
|
|
636
|
+
const id = cyNode.id?.();
|
|
637
|
+
if (id) {
|
|
638
|
+
if (id.includes("/")) {
|
|
639
|
+
setHoverAddress(void 0);
|
|
640
|
+
onHover?.();
|
|
641
|
+
} else {
|
|
642
|
+
setHoverAddress((0, import_hex.asAddress)(id));
|
|
643
|
+
onHover?.((0, import_hex.asAddress)(id));
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}, [onHover, cy]);
|
|
616
648
|
const handleReset = () => {
|
|
617
649
|
cy?.reset();
|
|
618
650
|
applyLayout(cy, layout ?? "euler", layoutOptions);
|
|
@@ -638,10 +670,8 @@ var NodeRelationalGraphFlexBox = (0, import_react13.forwardRef)(
|
|
|
638
670
|
applyLayout(cy, layout ?? "euler", layoutOptions);
|
|
639
671
|
}
|
|
640
672
|
}, [cy, layoutOptions, layout]);
|
|
641
|
-
(0, import_react13.useEffect)(() => {
|
|
642
|
-
setCyContext?.(cy ? new WeakRef(cy) : void 0);
|
|
643
|
-
}, [cy, setCyContext]);
|
|
644
673
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_flexbox.FlexCol, { id: "relational-graph-wrapper", ref, ...props, children: [
|
|
674
|
+
hoverAddress && hoverPosition ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material3.Box, { position: "absolute", top: hoverPosition.y1, left: hoverPosition.x1, zIndex: 100, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ModuleHoverDetails, { address: hoverAddress, name: moduleInstance?.deref()?.id ?? "Unknown" }) }) : null,
|
|
645
675
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_flexbox.FlexRow, { justifyContent: "start", width: "100%", children: actions === null ? null : actions ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_material3.ButtonGroup, { children: [
|
|
646
676
|
actions,
|
|
647
677
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material3.Button, { size: "small", variant: "contained", onClick: handleReset, children: "Reset View" })
|
|
@@ -670,10 +700,10 @@ NodeRelationalGraphFlexBox.displayName = "NodeRelationalGraph";
|
|
|
670
700
|
var NodeRelationalGraph = NodeRelationalGraphFlexBox;
|
|
671
701
|
|
|
672
702
|
// src/components/relational/graph/ProvidedNodeRenderer.tsx
|
|
673
|
-
var
|
|
703
|
+
var import_react_node3 = require("@xyo-network/react-node");
|
|
674
704
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
675
705
|
var ProvidedNodeRenderer = ({ node, ...props }) => {
|
|
676
|
-
const [providedNode] = (0,
|
|
706
|
+
const [providedNode] = (0, import_react_node3.useWeakProvidedNode)();
|
|
677
707
|
const elements = useCytoscapeElements(node ?? providedNode);
|
|
678
708
|
const options = useCytoscapeOptions(elements);
|
|
679
709
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NodeRelationalGraphFlexBox, { alignItems: "stretch", flexGrow: 1, height: "100%", options, ...props });
|
|
@@ -744,7 +774,7 @@ var StyledNodeGhostElementFlexCol = (0, import_material5.styled)(import_react_fl
|
|
|
744
774
|
// src/components/module/graph/Popper.tsx
|
|
745
775
|
var import_icons_material3 = require("@mui/icons-material");
|
|
746
776
|
var import_material6 = require("@mui/material");
|
|
747
|
-
var
|
|
777
|
+
var import_react_identicon2 = require("@xylabs/react-identicon");
|
|
748
778
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
749
779
|
var ModuleHoverPopper = ({ anchorEl, onClose, onModuleDetails, onModuleExplore, node, ...props }) => {
|
|
750
780
|
const { address, name } = node?.data() ?? {};
|
|
@@ -753,7 +783,7 @@ var ModuleHoverPopper = ({ anchorEl, onClose, onModuleDetails, onModuleExplore,
|
|
|
753
783
|
import_material6.CardHeader,
|
|
754
784
|
{
|
|
755
785
|
action: onClose ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.IconButton, { size: "small", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons_material3.CancelRounded, {}) }) : null,
|
|
756
|
-
avatar: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.Paper, { elevation: 6, sx: { bgcolor: "#fff", p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
786
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.Paper, { elevation: 6, sx: { bgcolor: "#fff", p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_identicon2.Identicon, { value: address, size: 24 }) }),
|
|
757
787
|
title: name,
|
|
758
788
|
subheader: address
|
|
759
789
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/components/module/CardParser.tsx","../../src/components/module/graph/GraphFlexBox.tsx","../../src/contexts/CytoscapeInstance/Context.ts","../../src/contexts/CytoscapeInstance/Provider.tsx","../../src/contexts/CytoscapeInstance/use.ts","../../src/hooks/cytoscape/elements/useCytoscapeElements.ts","../../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","../../src/hooks/cytoscape/elements/useHoveredNode.tsx","../../src/hooks/cytoscape/elements/useNewElements.tsx","../../src/hooks/cytoscape/elements/useRenderNewElements.tsx","../../src/hooks/cytoscape/elements/useSelectedElement.tsx","../../src/hooks/cytoscape/elements/useElements.tsx","../../src/hooks/cytoscape/useCytoscapeOptions.ts","../../src/hooks/cytoscape/useCytoscapeStyle.tsx","../../src/hooks/cytoscape/useIcons.tsx","../../src/hooks/cytoscape/useModuleDetails.tsx","../../src/hooks/cytoscape/useRelationalGraphOptions.tsx","../../src/components/cytoscape-extensions/WithExtensions.tsx","../../src/components/relational/graph/Graph.tsx","../../src/components/relational/graph/ProvidedNodeRenderer.tsx","../../src/components/module/graph/DetailsFlexbox.tsx","../../src/components/module/graph/node/Hover.tsx","../../src/components/module/graph/node/hooks/useNodeElement.tsx","../../src/components/module/graph/Popper.tsx"],"sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './Cytoscape'\nexport * from './hooks'\n","import { asArchivistInstance, isArchivistInstance } from '@xyo-network/archivist-model'\nimport { asDivinerInstance, isDivinerInstance } from '@xyo-network/diviner-model'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { ArchivistCard } from '@xyo-network/react-archivist'\nimport { DivinerCard, ModuleCard } from '@xyo-network/react-module'\n\nexport interface ModuleCardParserProps {\n mod?: ModuleInstance\n}\n\nexport const ModuleCardParser: React.FC<ModuleCardParserProps> = ({ mod }) => {\n switch (true) {\n case isArchivistInstance(mod): {\n return <ArchivistCard mod={asArchivistInstance(mod)} />\n }\n case isDivinerInstance(mod): {\n return <DivinerCard mod={asDivinerInstance(mod)} />\n }\n default: {\n return <ModuleCard mod={mod} />\n }\n }\n}\n","import { Button } from '@mui/material'\nimport { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { useRef } from 'react'\n\nimport { CytoscapeInstanceProvider } from '../../../contexts'\nimport { useElements, useModuleDetails, useRelationalGraphOptions } from '../../../hooks'\nimport { WithExtensions } from '../../cytoscape-extensions'\nimport { NodeRelationalGraphFlexBox } from '../../relational'\nimport { DetailsFlexbox } from './DetailsFlexbox'\nimport { ModuleGraphNodeHover } from './node'\nimport { StyledModuleHoverPopper } from './Popper'\n\nexport interface ModuleGraphFlexBoxProps extends FlexBoxProps {\n disableModuleDetails?: boolean\n hideActions?: boolean\n layout?: 'dagre' | 'euler' | 'cose-bilkent' | 'cola'\n layoutOptions?: object\n rootModule?: WeakRef<ModuleInstance> | null\n}\n\nexport const ModuleGraphFlexBox: React.FC<ModuleGraphFlexBoxProps> = ({ hideActions, rootModule, disableModuleDetails, ...props }) => {\n const cytoscapeRef = useRef<HTMLDivElement>(null)\n const { handleToggleLabels, hideLabels, options } = useRelationalGraphOptions(rootModule ?? undefined)\n const { hoveredNode, setHoveredNode, toggleSelectedElement } = useElements(hideLabels)\n\n const { mod, onModuleDetails } = useModuleDetails(rootModule, () => setHoveredNode(undefined))\n\n return (\n <WithExtensions>\n <NodeRelationalGraphFlexBox\n actions={\n mod ? null\n : hideActions ?\n null\n : <Button size={'small'} onClick={handleToggleLabels} variant=\"contained\">\n Toggle Labels\n </Button>\n\n }\n showDetails={!!mod}\n detail={<DetailsFlexbox onClose={() => onModuleDetails(null)} />}\n options={options}\n ref={cytoscapeRef}\n width=\"100%\"\n {...props}\n >\n <ModuleGraphNodeHover node={hoveredNode}>\n {(element) => (\n <StyledModuleHoverPopper\n anchorEl={element}\n container={cytoscapeRef.current}\n node={hoveredNode}\n onClose={() => setHoveredNode(undefined)}\n onModuleExplore={toggleSelectedElement}\n onModuleDetails={disableModuleDetails ? undefined : onModuleDetails}\n placement={'top'}\n open\n />\n )}\n </ModuleGraphNodeHover>\n </NodeRelationalGraphFlexBox>\n </WithExtensions>\n )\n}\n\nexport const ModuleGraphFlexBoxWithProvider: React.FC<ModuleGraphFlexBoxProps> = (props) => {\n return (\n <CytoscapeInstanceProvider>\n <ModuleGraphFlexBox {...props} />\n </CytoscapeInstanceProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { CytoscapeInstanceState } from './State'\n\nexport const CytoscapeInstanceContext = createContextEx<CytoscapeInstanceState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { Core } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { CytoscapeInstanceContext } from './Context'\n\nexport interface CytoscapeInstanceProviderProps extends WithChildren {\n defaultInstance?: WeakRef<Core>\n}\n\nexport const CytoscapeInstanceProvider: React.FC<CytoscapeInstanceProviderProps> = ({ children, defaultInstance }) => {\n const [cy, setCy] = useState<WeakRef<Core> | undefined>(defaultInstance)\n useEffect(() => {\n setCy(defaultInstance)\n }, [defaultInstance])\n\n return <CytoscapeInstanceContext.Provider value={{ cy, provided: true, setCy }}>{children}</CytoscapeInstanceContext.Provider>\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { CytoscapeInstanceContext } from './Context'\n\nexport const useCytoscapeInstance = (required = false) => useContextEx(CytoscapeInstanceContext, 'CytoscapeInstance', required)\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { EventUnsubscribeFunction } from '@xyo-network/module-events'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { CytoscapeElements } from '../../../Cytoscape'\n\nexport const useCytoscapeElements = (mod?: WeakRef<ModuleInstance> | null) => {\n const [elements, setElements] = useState<ElementDefinition[]>([])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async () => {\n const moduleInstance = mod?.deref()\n if (moduleInstance) {\n const newElements = (await CytoscapeElements.buildElements(moduleInstance)) ?? []\n setElements(newElements)\n }\n },\n [mod],\n )\n\n useEffect(() => {\n let attachedListener: EventUnsubscribeFunction | undefined\n let detachedListener: EventUnsubscribeFunction | undefined\n\n if (mod && isNodeInstance(mod)) {\n attachedListener = mod.on('moduleAttached', async () => {\n const newElements = (await CytoscapeElements.buildElements(mod)) ?? []\n setElements(newElements)\n })\n detachedListener = mod.on('moduleDetached', async () => {\n const newElements = (await CytoscapeElements.buildElements(mod)) ?? []\n setElements(newElements)\n })\n }\n\n return () => {\n attachedListener?.()\n detachedListener?.()\n }\n }, [mod])\n\n return elements\n}\n","import { exists } from '@xylabs/exists'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { ElementDefinition } from 'cytoscape'\n\nimport { parseModuleType } from './lib'\n\ninterface ModuleInfo {\n children: ModuleInfo[]\n depth: number\n mod: ModuleInstance\n}\n\nexport const CytoscapeElements = {\n MaxNameLength: 20,\n\n buildEdge(rootNode: ElementDefinition, newNode: ElementDefinition, properties?: { [key: string]: unknown }) {\n return {\n data: {\n id: `${rootNode.data.id}/${newNode.data.id}`,\n source: rootNode.data.id,\n target: newNode.data.id,\n ...properties,\n },\n }\n },\n\n async buildElements(mod: ModuleInstance): Promise<ElementDefinition[]> {\n const info = await CytoscapeElements.recurseNodes(mod)\n const newElements: ElementDefinition[] = await this.buildElementsFromInfo(info, undefined, ['activeNode'])\n\n return newElements\n },\n\n async buildElementsFromInfo(info: ModuleInfo, root?: ElementDefinition, classes: string[] = []): Promise<ElementDefinition[]> {\n const newNode = CytoscapeElements.buildNode(info.mod, { childCount: info.children.length, depth: info.depth }, classes)\n const newEdge = root ? CytoscapeElements.buildEdge(root, newNode, { depth: info.depth, siblingCount: info.children.length }) : undefined\n const newElements: ElementDefinition[] = [newNode]\n if (newEdge) {\n newElements.push(newEdge)\n }\n\n for (const childInfo of info.children) {\n newElements.push(...(await this.buildElementsFromInfo(childInfo, newNode)))\n }\n\n return newElements\n },\n\n buildNode(mod: ModuleInstance, properties?: { [key: string]: unknown }, classes?: string[]): ElementDefinition {\n const { address, id } = mod\n return {\n classes,\n data: {\n address,\n id: address,\n name: id,\n type: parseModuleType(mod),\n ...properties,\n },\n }\n },\n\n buildRootNode: (mod: ModuleInstance): ElementDefinition => {\n return CytoscapeElements.buildNode(mod, {}, ['activeNode'])\n },\n\n normalizeName(name?: string) {\n if (!name) return\n if (name.length > this.MaxNameLength) return `${name.slice(0, 20)}...`\n return name\n },\n\n async recurseNodes(root: ModuleInstance, maxDepth = 10, depth = 1): Promise<ModuleInfo> {\n const info: ModuleInfo = { children: [], depth, mod: root }\n\n if (maxDepth > 0) {\n const children = await root.resolve('*', { direction: 'down', maxDepth: 1 })\n info.children = (\n await Promise.all(\n children.map(async (child) => {\n // don't re add the root module that was passed in\n if (child.address !== root.address) {\n return await this.recurseNodes(child, maxDepth - 1, depth + 1)\n }\n }),\n )\n ).filter(exists)\n }\n\n return info\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.querySelectorAll('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 // eslint-disable-next-line id-denylist\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 { LayoutOptions } from 'cytoscape'\n\nexport const ConcentricLayout: LayoutOptions = {\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-model'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel-model'\nimport { isWitnessModule } from '@xyo-network/witness-model'\n\nimport { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const parseModuleType = (mod?: ModuleInstance): CyNodeModuleTypes => {\n let type: CyNodeModuleTypes = 'module'\n if (mod) {\n if (isArchivistInstance(mod)) {\n type = 'archivist'\n } else if (isBridgeInstance(mod)) {\n type = 'bridge'\n } else if (isDivinerInstance(mod)) {\n type = 'diviner'\n } else if (isNodeInstance(mod)) {\n type = 'node'\n } else if (isSentinelInstance(mod)) {\n type = 'sentinel'\n } else if (isWitnessModule(mod)) {\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'\n// eslint-disable-next-line import/no-internal-modules\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 // eslint-disable-next-line id-denylist\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 NodeWithName = (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 Node = (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 NodeAsRoot = (bgColor?: string) => ({\n selector: '.activeNode',\n style: {\n 'background-color': bgColor,\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","import { NodeCollection, NodeSingular } from 'cytoscape'\nimport { Dispatch, SetStateAction, useCallback, useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts'\n\nexport const useHoveredNode = (renderedElements?: NodeCollection): [NodeSingular | undefined, Dispatch<SetStateAction<NodeSingular | undefined>>] => {\n const { cy } = useCytoscapeInstance(true)\n const [hoveredNode, setHoveredNode] = useState<NodeSingular>()\n\n const nodeListener = useCallback((node: NodeSingular) => {\n node.on('mouseover tap', () => {\n setHoveredNode(node)\n })\n }, [])\n\n useEffect(() => {\n if (renderedElements) {\n // eslint-disable-next-line unicorn/no-array-for-each\n renderedElements.nodes().forEach(nodeListener)\n }\n }, [nodeListener, renderedElements])\n\n useEffect(() => {\n cy?.deref()?.ready(() => {\n // eslint-disable-next-line unicorn/no-array-for-each\n cy?.deref()?.nodes().forEach(nodeListener)\n })\n }, [cy, nodeListener])\n\n return [hoveredNode, setHoveredNode]\n}\n","import { useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { NodeSingular } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { useCytoscapeElements } from './useCytoscapeElements'\n\nexport const useNewElements = (selectedElement?: NodeSingular) => {\n const selectedAddress = useMemo(() => {\n const { address: selectedAddress } = selectedElement?.data() ?? {}\n return selectedAddress\n }, [selectedElement])\n\n const [mod] = useWeakModuleFromNode(selectedAddress)\n const newElements = useCytoscapeElements(mod)\n\n return newElements\n}\n","import { CollectionReturnValue, ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts'\nimport { ColaLayout } from '../../../Cytoscape'\n\nexport const useRenderNewElements = (newElements: ElementDefinition[] = [], hideLabels?: boolean) => {\n const { cy } = useCytoscapeInstance(true)\n const [renderedElements, setRenderedElements] = useState<CollectionReturnValue>()\n\n useEffect(() => {\n if (newElements.length > 1) {\n const renderedElements = cy?.deref()?.add(newElements)\n setRenderedElements(renderedElements)\n cy?.deref()?.layout(ColaLayout).run()\n }\n }, [cy, hideLabels, newElements])\n\n return renderedElements\n}\n","import { NodeSingular } from 'cytoscape'\nimport { useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts'\n\nexport const useSelectedElement = () => {\n const [selectedElement, setSelectedElement] = useState<NodeSingular>()\n const { cy } = useCytoscapeInstance(true)\n\n const updateStyles = (element: NodeSingular) => {\n const nodes = cy?.deref()?.nodes()\n nodes?.toggleClass('activeNode', false)\n element.toggleClass('activeNode', true)\n }\n\n const toggleSelectedElement = (address?: string) => {\n const selectedNode = cy?.deref()?.nodes(`[id=\"${address}\"]`)?.[0]\n if (selectedNode) {\n setSelectedElement(selectedNode)\n updateStyles(selectedNode)\n }\n }\n\n return { selectedElement, toggleSelectedElement }\n}\n","import { useHoveredNode } from './useHoveredNode'\nimport { useNewElements } from './useNewElements'\nimport { useRenderNewElements } from './useRenderNewElements'\nimport { useSelectedElement } from './useSelectedElement'\n\nexport const useElements = (hideLabels: boolean) => {\n const { selectedElement, toggleSelectedElement } = useSelectedElement()\n const newElements = useNewElements(selectedElement)\n const renderedElements = useRenderNewElements(newElements, hideLabels)\n const [hoveredNode, setHoveredNode] = useHoveredNode(renderedElements)\n\n return { hoveredNode, setHoveredNode, toggleSelectedElement }\n}\n","import { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape'\nimport { useCytoscapeStyle } from './useCytoscapeStyle'\n\nexport const useCytoscapeOptions = (\n elements: CytoscapeOptions['elements'],\n style?: CytoscapeOptions['style'],\n layout?: CytoscapeOptions['layout'],\n) => {\n const defaultStyle = useCytoscapeStyle()\n\n const resolvedLayout = layout ?? ConcentricLayout\n const resolvedStyle = style ?? defaultStyle\n\n const options = useMemo<CytoscapeOptions | undefined>(() => {\n if (elements && resolvedLayout && resolvedStyle) {\n return {\n elements,\n layout: resolvedLayout,\n style: resolvedStyle,\n }\n }\n }, [elements, layout, style])\n\n return options\n}\n","import { useTheme } from '@mui/material'\nimport { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { EdgeStyled, Node, NodeAsRoot, NodeWithName } from '../../Cytoscape'\nimport { useIcons } from './useIcons'\n\nexport const useCytoscapeStyle = (hideLabels = false) => {\n const theme = useTheme()\n const icons = useIcons()\n\n const style: CytoscapeOptions['style'] = useMemo(\n () => [\n Node(icons, theme.palette.primary.main, hideLabels),\n NodeWithName(theme.palette.text.primary, theme.palette.getContrastText(theme.palette.text.primary)),\n NodeAsRoot(theme.palette.secondary.main),\n EdgeStyled(theme.palette.divider, theme.palette.divider),\n ],\n [icons, hideLabels, theme],\n )\n\n return style\n}\n","import { useTheme } from '@mui/material'\nimport { useMemo } from 'react'\n\nimport { CyIconSet, CyNodeModuleTypes, encodeSvg, generateIconMap } from '../../Cytoscape'\n\nexport const useIcons = () => {\n const theme = useTheme()\n const icons = useMemo(() => {\n const iconMap = generateIconMap()\n // eslint-disable-next-line unicorn/no-array-reduce\n return Object.entries(CyIconSet).reduce((acc, [name, IconComponent]) => {\n const icon = <IconComponent fontSize=\"small\" />\n acc[name as CyNodeModuleTypes] = encodeSvg(icon, theme.palette.getContrastText(theme.palette.text.primary))\n return acc\n }, iconMap)\n }, [theme.palette])\n\n return icons\n}\n","import { usePromise } from '@xylabs/react-promise'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\n\nexport const useModuleDetails = (rootModule?: WeakRef<ModuleInstance> | null, onFoundModule?: () => void) => {\n const { cy } = useCytoscapeInstance()\n const [moduleAddress, setModuleAddress] = useState<string | null>()\n\n const [foundModule] = usePromise(async () => {\n if (moduleAddress === null) return null\n const rootModuleInstance = rootModule?.deref()\n if (moduleAddress && rootModuleInstance) {\n const foundModule = await rootModuleInstance.resolve(moduleAddress)\n return foundModule ?? null\n }\n }, [moduleAddress, rootModule])\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(() => {\n if (moduleAddress === null) {\n // cytoscape tries to center prematurely without it :(\n setTimeout(() => {\n cy?.deref()?.center()\n }, 100)\n } else if (foundModule && cy) {\n const node = cy?.deref()?.nodes(`[id=\"${moduleAddress}\"]`)?.[0]\n // cy.pan(newPan)\n // cytoscape tries to center prematurely without it :(\n setTimeout(() => {\n cy?.deref()?.center(node)\n }, 100)\n }\n })\n\n const container = cy?.deref()?.container()\n if (container) {\n resizeObserver.observe(container)\n }\n\n return () => {\n if (container) resizeObserver.unobserve(container)\n }\n }, [cy, moduleAddress, foundModule, rootModule])\n\n useEffect(() => {\n if (foundModule) {\n onFoundModule?.()\n }\n }, [cy, moduleAddress, foundModule, onFoundModule])\n\n const onModuleDetails = (address?: string | null) => {\n const moduleNode = cy?.deref()?.nodes(`[id=\"${address}\"]`)\n const rootModuleNode = cy?.deref()?.nodes(`[id=\"${rootModule?.deref()?.address}\"]`)\n const foundModuleNode = cy?.deref()?.nodes(`[id=\"${foundModule?.address}\"]`)\n const notModuleNode = cy?.deref()?.nodes(`[id != \"${address}\"]`)\n\n if (address) {\n // address was passed so we set the node to active styles\n moduleNode?.toggleClass('activeNode', true)\n notModuleNode?.toggleClass('activeNode', false)\n } else {\n // no address was passes so we reset the state\n notModuleNode?.toggleClass('activeNode', false)\n const activeNode = foundModuleNode?.length ? foundModuleNode : rootModuleNode\n activeNode?.toggleClass('activeNode', true)\n }\n setModuleAddress(address)\n }\n\n return { mod: foundModule, onModuleDetails }\n}\n","import { ModuleInstance } from '@xyo-network/module-model'\nimport { useState } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape'\nimport { useCytoscapeElements } from './elements'\nimport { useCytoscapeOptions } from './useCytoscapeOptions'\nimport { useCytoscapeStyle } from './useCytoscapeStyle'\n\nexport const useRelationalGraphOptions = (mod?: WeakRef<ModuleInstance>) => {\n const [hideLabels, setHideLabels] = useState(true)\n\n const handleToggleLabels = () => {\n setHideLabels((oldValue) => !oldValue)\n }\n\n const elements = useCytoscapeElements(mod)\n const style = useCytoscapeStyle(hideLabels)\n const options = useCytoscapeOptions(elements, style, ConcentricLayout)\n\n return { handleToggleLabels, hideLabels, options }\n}\n","import cytoscape from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport coseBilkent from 'cytoscape-cose-bilkent'\nimport dagre from 'cytoscape-dagre'\nimport euler from 'cytoscape-euler'\nimport { PropsWithChildren, useEffect, useState } from 'react'\n\nexport const WithExtensions: React.FC<PropsWithChildren> = ({ children }) => {\n const [initialized, setInitialized] = useState(false)\n useEffect(() => {\n cytoscape.use(cola)\n cytoscape.use(dagre)\n cytoscape.use(coseBilkent)\n cytoscape.use(euler)\n setInitialized(true)\n }, [])\n\n return <>{initialized ? children : undefined}</>\n}\n","import { Button, ButtonGroup, useTheme } from '@mui/material'\nimport { FlexCol, FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'\nimport cytoscape, { Core } from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport coseBilkentLayout from 'cytoscape-cose-bilkent'\nimport dagre from 'cytoscape-dagre'\nimport eulerLayout from 'cytoscape-euler'\nimport { forwardRef, useEffect, useRef, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts'\nimport { NodeRelationalGraphProps } from '../../lib'\n\nconst applyLayout = (cy?: cytoscape.Core, name = 'cola', options?: object) => {\n cy?.layout({ name, ...options }).run()\n}\n\nconst loadLayout = (layout = 'cola') => {\n switch (layout) {\n case 'dagre': {\n cytoscape.use(dagre)\n break\n }\n case 'euler': {\n cytoscape.use(eulerLayout)\n break\n }\n case 'cose-bilkent': {\n cytoscape.use(coseBilkentLayout)\n break\n }\n case 'cola': {\n cytoscape.use(cola)\n break\n }\n }\n}\n\nexport const NodeRelationalGraphFlexBox = forwardRef<HTMLDivElement, NodeRelationalGraphProps>(\n ({ actions, children, layout, layoutOptions, showDetails, detail, options, ...props }, ref) => {\n const theme = useTheme()\n const [cy, setCy] = useState<Core>()\n const { setCy: setCyContext } = useCytoscapeInstance()\n const cytoscapeRef = useRef<HTMLDivElement>()\n\n const handleReset = () => {\n cy?.reset()\n applyLayout(cy, layout ?? 'euler', layoutOptions)\n }\n\n useEffect(() => {\n let newCy: Core | undefined\n const container = cytoscapeRef.current\n if (container) {\n newCy = cytoscape({\n container,\n ...options,\n })\n setCy(newCy)\n }\n return () => {\n newCy?.destroy()\n setCy(undefined)\n }\n }, [options, cytoscapeRef, layoutOptions])\n\n useEffect(() => {\n if (cy) {\n loadLayout(layout)\n applyLayout(cy, layout ?? 'euler', layoutOptions)\n }\n }, [cy, layoutOptions, layout])\n\n useEffect(() => {\n setCyContext?.(cy ? new WeakRef(cy) : undefined)\n }, [cy, setCyContext])\n\n return (\n <FlexCol id=\"relational-graph-wrapper\" ref={ref} {...props}>\n <FlexRow justifyContent=\"start\" width=\"100%\">\n {actions === null ?\n null\n : actions ?\n <ButtonGroup>\n {actions}\n <Button size={'small'} variant={'contained'} onClick={handleReset}>\n Reset View\n </Button>\n </ButtonGroup>\n : <Button size={'small'} variant={'contained'} onClick={handleReset}>\n Reset\n </Button>\n }\n </FlexRow>\n <FlexGrowRow width=\"100%\" alignItems=\"start\">\n {showDetails ?\n <FlexCol height=\"100%\" width={'85%'}>\n {detail}\n </FlexCol>\n : null}\n <FlexCol\n justifyContent=\"start\"\n classes=\"cytoscape-wrap\"\n width={showDetails ? '15%' : '100%'}\n height={showDetails ? '50%' : '100%'}\n border={showDetails ? `1px solid ${theme.palette.divider}` : undefined}\n >\n {/* Cytoscape Element */}\n <FlexCol alignItems=\"stretch\" position=\"absolute\" width=\"100%\" height=\"100%\" ref={cytoscapeRef} />\n {children}\n </FlexCol>\n </FlexGrowRow>\n </FlexCol>\n )\n },\n)\n\nNodeRelationalGraphFlexBox.displayName = 'NodeRelationalGraph'\n\n/** @deprecated */\nexport const NodeRelationalGraph = NodeRelationalGraphFlexBox\n","import { AccountInstance } from '@xyo-network/account-model'\nimport { NodeInstance } from '@xyo-network/node-model'\nimport { useWeakProvidedNode } from '@xyo-network/react-node'\n\nimport { useCytoscapeElements, useCytoscapeOptions } from '../../../hooks'\nimport { NodeRelationalGraphProps } from '../../lib'\nimport { NodeRelationalGraphFlexBox } from './Graph'\n\nexport interface ProvidedNodeRendererProps extends NodeRelationalGraphProps {\n account?: AccountInstance\n layout?: 'dagre' | 'euler' | 'cose-bilkent' | 'cola'\n layoutOptions?: object\n node?: WeakRef<NodeInstance>\n}\n\nexport const ProvidedNodeRenderer: React.FC<ProvidedNodeRendererProps> = ({ node, ...props }) => {\n const [providedNode] = useWeakProvidedNode()\n const elements = useCytoscapeElements(node ?? providedNode)\n const options = useCytoscapeOptions(elements)\n\n return <NodeRelationalGraphFlexBox alignItems=\"stretch\" flexGrow={1} height=\"100%\" options={options} {...props} />\n}\n","import { CancelRounded } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { FlexBoxProps, FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'\n\nexport interface DetailsFlexboxProps extends FlexBoxProps {\n onClose?: () => void\n}\n\nexport const DetailsFlexbox: React.FC<DetailsFlexboxProps> = ({ children, onClose }) => {\n return (\n <FlexGrowCol alignItems=\"end\" justifyContent=\"start\" id=\"module-detail\" width=\"100%\" p={2} gap={2}>\n <FlexRow justifyContent=\"end\">\n <IconButton onClick={onClose} size={'small'}>\n <CancelRounded />\n </IconButton>\n </FlexRow>\n {children}\n </FlexGrowCol>\n )\n}\n","import { PopperProps, styled } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { NodeSingular } from 'cytoscape'\nimport { ReactElement } from 'react'\n\nimport { useNodeElement } from './hooks'\n\nexport interface ModuleHoverProps {\n children?: (anchorElement?: PopperProps['anchorEl'], container?: PopperProps['container']) => ReactElement\n node?: NodeSingular\n}\n\nexport const ModuleGraphNodeHover: React.FC<ModuleHoverProps> = ({ children, node }) => {\n const { boundingBox, ref, currentElement } = useNodeElement(node)\n\n return (\n <>\n <StyledNodeGhostElementFlexCol ref={ref} left={boundingBox?.x1} height={boundingBox?.h} top={boundingBox?.y1} width={boundingBox?.w} />\n {node ?\n <>{children?.(currentElement)}</>\n : null}\n </>\n )\n}\n\nconst StyledNodeGhostElementFlexCol = styled(FlexCol, { name: 'StyledNodeGhostElementFlexCol' })(() => ({\n // For easier debugging of the 'ghost' element that matches the hovered cytoscape node\n // backgroundColor: '#fff',\n // opacity: 0.25,\n\n // eslint-disable-next-line sort-keys-fix/sort-keys-fix\n cursor: 'pointer',\n pointerEvents: 'none',\n position: 'absolute',\n}))\n","import { PopperProps } from '@mui/material'\nimport { NodeSingular } from 'cytoscape'\nimport { useEffect, useRef, useState } from 'react'\n\nexport const useNodeElement = (node?: NodeSingular) => {\n const ref = useRef<HTMLDivElement>(null)\n const [currentElement, setCurrentElement] = useState<PopperProps['anchorEl'] | null>(null)\n const [boundingBox, setBoundingBox] = useState(node?.renderedBoundingBox())\n\n // Ensure first render clears the previous element when node changes to avoid flicker\n useEffect(() => {\n setCurrentElement(null)\n }, [node])\n\n useEffect(() => {\n if (node) {\n setBoundingBox(node.renderedBoundingBox())\n }\n\n const listener = () => {\n setBoundingBox(node?.renderedBoundingBox())\n }\n\n node?.on('position', listener)\n\n return () => {\n node?.off('position', undefined, listener)\n }\n }, [node])\n\n // Once boundingBox state is set and applied to the layout, update the ref\n useEffect(() => {\n setCurrentElement(ref.current)\n }, [boundingBox])\n\n return { boundingBox, currentElement, ref }\n}\n","import { CancelRounded } from '@mui/icons-material'\nimport { Button, Card, CardActions, CardHeader, IconButton, Paper, Popper, PopperProps, styled } from '@mui/material'\nimport { Identicon } from '@xylabs/react-identicon'\nimport { NodeSingular } from 'cytoscape'\n\nexport interface ModuleHoverPopperProps extends PopperProps {\n node?: NodeSingular\n onClose?: () => void\n onModuleDetails?: (address?: string) => void\n onModuleExplore?: (address?: string) => void\n}\n\nexport const ModuleHoverPopper: React.FC<ModuleHoverPopperProps> = ({ anchorEl, onClose, onModuleDetails, onModuleExplore, node, ...props }) => {\n const { address, name } = node?.data() ?? {}\n return (\n <>\n {anchorEl ?\n <Popper anchorEl={anchorEl} {...props}>\n <Card elevation={3}>\n <CardHeader\n action={\n onClose ?\n <IconButton size=\"small\" onClick={onClose}>\n <CancelRounded />\n </IconButton>\n : null\n }\n avatar={\n <Paper elevation={6} sx={{ bgcolor: '#fff', p: 1 }}>\n <Identicon value={address} size={24} />\n </Paper>\n }\n title={name}\n subheader={address}\n />\n <StyledCardActions>\n {onModuleDetails ?\n <Button onClick={() => onModuleDetails?.(address)} size=\"small\" variant=\"contained\">\n Details\n </Button>\n : null}\n {onModuleExplore ?\n <Button onClick={() => onModuleExplore?.(address)} size=\"small\" variant=\"contained\">\n Explore\n </Button>\n : null}\n </StyledCardActions>\n </Card>\n </Popper>\n : null}\n </>\n )\n}\n\nexport const StyledModuleHoverPopper = styled(ModuleHoverPopper, { name: 'StyledComponents' })(() => ({\n zIndex: 2,\n}))\n\nexport const StyledCardActions = styled(CardActions, { name: 'StyledCardActions' })(() => ({\n display: 'flex',\n justifyContent: 'center',\n}))\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,6BAAyD;AACzD,2BAAqD;AAErD,6BAA8B;AAC9B,0BAAwC;AAS3B;AAHN,IAAM,mBAAoD,CAAC,EAAE,IAAI,MAAM;AAC5E,UAAQ,MAAM;AAAA,IACZ,SAAK,4CAAoB,GAAG,GAAG;AAC7B,aAAO,4CAAC,wCAAc,SAAK,4CAAoB,GAAG,GAAG;AAAA,IACvD;AAAA,IACA,SAAK,wCAAkB,GAAG,GAAG;AAC3B,aAAO,4CAAC,mCAAY,SAAK,wCAAkB,GAAG,GAAG;AAAA,IACnD;AAAA,IACA,SAAS;AACP,aAAO,4CAAC,kCAAW,KAAU;AAAA,IAC/B;AAAA,EACF;AACF;;;ACtBA,IAAAA,mBAAuB;AAGvB,IAAAC,iBAAuB;;;ACHvB,0BAAgC;AAIzB,IAAM,+BAA2B,qCAAwC;;;ACFhF,mBAAoC;AAc3B,IAAAC,sBAAA;AANF,IAAM,4BAAsE,CAAC,EAAE,UAAU,gBAAgB,MAAM;AACpH,QAAM,CAAC,IAAI,KAAK,QAAI,uBAAoC,eAAe;AACvE,8BAAU,MAAM;AACd,UAAM,eAAe;AAAA,EACvB,GAAG,CAAC,eAAe,CAAC;AAEpB,SAAO,6CAAC,yBAAyB,UAAzB,EAAkC,OAAO,EAAE,IAAI,UAAU,MAAM,MAAM,GAAI,UAAS;AAC5F;;;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C,SACE,MAAM,OACJ,cACA,OACA,8CAAC,2BAAO,MAAM,SAAS,SAAS,oBAAoB,SAAQ,aAAY,2BAExE;AAAA,MAGJ,aAAa,CAAC,CAAC;AAAA,MACf,QAAQ,8CAAC,kBAAe,SAAS,MAAM,gBAAgB,IAAI,GAAG;AAAA,MAC9D;AAAA,MACA,KAAK;AAAA,MACL,OAAM;AAAA,MACL,GAAG;AAAA,MAEJ,wDAAC,wBAAqB,MAAM,aACzB,WAAC,YACA;AAAA,QAAC;AAAA;AAAA,UACC,UAAU;AAAA,UACV,WAAW,aAAa;AAAA,UACxB,MAAM;AAAA,UACN,SAAS,MAAM,eAAe,MAAS;AAAA,UACvC,iBAAiB;AAAA,UACjB,iBAAiB,uBAAuB,SAAY;AAAA,UACpD,WAAW;AAAA,UACX,MAAI;AAAA;AAAA,MACN,GAEJ;AAAA;AAAA,EACF,GACF;AAEJ;AAEO,IAAM,iCAAoE,CAAC,UAAU;AAC1F,SACE,8CAAC,6BACC,wDAAC,sBAAoB,GAAG,OAAO,GACjC;AAEJ;","names":["import_material","import_react","import_jsx_runtime","import_react_shared","import_node_model","import_react","import_archivist_model","import_diviner_model","Inventory2RoundedIcon","InsertLinkRoundedIcon","BubbleChartRoundedIcon","QuestionMarkRoundedIcon","HubIcon","TimerRoundedIcon","VisibilityRoundedIcon","import_react","import_react","selectedAddress","import_react","renderedElements","import_react","import_react","import_material","import_react","import_react","import_jsx_runtime","import_react","foundModule","import_react","import_react","import_jsx_runtime","cytoscape","cola","dagre","coseBilkent","euler","import_material","import_cytoscape","import_cytoscape_cola","import_cytoscape_cose_bilkent","import_cytoscape_dagre","import_cytoscape_euler","import_react","import_jsx_runtime","cytoscape","dagre","eulerLayout","coseBilkentLayout","cola","import_react_node","import_jsx_runtime","import_icons_material","import_material","import_react_flexbox","import_jsx_runtime","import_material","import_react_flexbox","import_react","import_jsx_runtime","import_icons_material","import_material","import_jsx_runtime","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/module/CardParser.tsx","../../src/components/module/graph/GraphFlexBox.tsx","../../src/contexts/CytoscapeInstance/Context.ts","../../src/contexts/CytoscapeInstance/Provider.tsx","../../src/contexts/CytoscapeInstance/use.ts","../../src/hooks/cytoscape/elements/useCytoscapeElements.ts","../../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","../../src/hooks/cytoscape/elements/useHoveredNode.tsx","../../src/hooks/cytoscape/elements/useNewElements.tsx","../../src/hooks/cytoscape/elements/useRenderNewElements.tsx","../../src/hooks/cytoscape/elements/useSelectedElement.tsx","../../src/hooks/cytoscape/elements/useElements.tsx","../../src/hooks/cytoscape/useCytoscapeOptions.ts","../../src/hooks/cytoscape/useCytoscapeStyle.tsx","../../src/hooks/cytoscape/useIcons.tsx","../../src/hooks/cytoscape/useModuleDetails.tsx","../../src/hooks/cytoscape/useRelationalGraphOptions.tsx","../../src/components/cytoscape-extensions/WithExtensions.tsx","../../src/components/relational/graph/Graph.tsx","../../src/components/relational/graph/ProvidedNodeRenderer.tsx","../../src/components/module/graph/DetailsFlexbox.tsx","../../src/components/module/graph/node/Hover.tsx","../../src/components/module/graph/node/hooks/useNodeElement.tsx","../../src/components/module/graph/Popper.tsx"],"sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './Cytoscape'\nexport * from './hooks'\n","import { asArchivistInstance, isArchivistInstance } from '@xyo-network/archivist-model'\nimport { asDivinerInstance, isDivinerInstance } from '@xyo-network/diviner-model'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { ArchivistCard } from '@xyo-network/react-archivist'\nimport { DivinerCard, ModuleCard } from '@xyo-network/react-module'\n\nexport interface ModuleCardParserProps {\n mod?: ModuleInstance\n}\n\nexport const ModuleCardParser: React.FC<ModuleCardParserProps> = ({ mod }) => {\n switch (true) {\n case isArchivistInstance(mod): {\n return <ArchivistCard mod={asArchivistInstance(mod)} />\n }\n case isDivinerInstance(mod): {\n return <DivinerCard mod={asDivinerInstance(mod)} />\n }\n default: {\n return <ModuleCard mod={mod} />\n }\n }\n}\n","import { Button } from '@mui/material'\nimport { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { useRef } from 'react'\n\nimport { CytoscapeInstanceProvider } from '../../../contexts'\nimport { useElements, useModuleDetails, useRelationalGraphOptions } from '../../../hooks'\nimport { WithExtensions } from '../../cytoscape-extensions'\nimport { NodeRelationalGraphFlexBox } from '../../relational'\nimport { DetailsFlexbox } from './DetailsFlexbox'\nimport { ModuleGraphNodeHover } from './node'\nimport { StyledModuleHoverPopper } from './Popper'\n\nexport interface ModuleGraphFlexBoxProps extends FlexBoxProps {\n disableModuleDetails?: boolean\n hideActions?: boolean\n layout?: 'dagre' | 'euler' | 'cose-bilkent' | 'cola'\n layoutOptions?: object\n rootModule?: WeakRef<ModuleInstance> | null\n}\n\nexport const ModuleGraphFlexBox: React.FC<ModuleGraphFlexBoxProps> = ({ hideActions, rootModule, disableModuleDetails, ...props }) => {\n const cytoscapeRef = useRef<HTMLDivElement>(null)\n const { handleToggleLabels, hideLabels, options } = useRelationalGraphOptions(rootModule ?? undefined)\n const { hoveredNode, setHoveredNode, toggleSelectedElement } = useElements(hideLabels)\n\n const { mod, onModuleDetails } = useModuleDetails(rootModule, () => setHoveredNode(undefined))\n\n return (\n <WithExtensions>\n <NodeRelationalGraphFlexBox\n actions={\n mod ? null\n : hideActions ?\n null\n : <Button size={'small'} onClick={handleToggleLabels} variant=\"contained\">\n Toggle Labels\n </Button>\n\n }\n showDetails={!!mod}\n detail={<DetailsFlexbox onClose={() => onModuleDetails(null)} />}\n options={options}\n ref={cytoscapeRef}\n width=\"100%\"\n {...props}\n >\n <ModuleGraphNodeHover node={hoveredNode}>\n {(element) => (\n <StyledModuleHoverPopper\n anchorEl={element}\n container={cytoscapeRef.current}\n node={hoveredNode}\n onClose={() => setHoveredNode(undefined)}\n onModuleExplore={toggleSelectedElement}\n onModuleDetails={disableModuleDetails ? undefined : onModuleDetails}\n placement={'top'}\n open\n />\n )}\n </ModuleGraphNodeHover>\n </NodeRelationalGraphFlexBox>\n </WithExtensions>\n )\n}\n\nexport const ModuleGraphFlexBoxWithProvider: React.FC<ModuleGraphFlexBoxProps> = (props) => {\n return (\n <CytoscapeInstanceProvider>\n <ModuleGraphFlexBox {...props} />\n </CytoscapeInstanceProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { CytoscapeInstanceState } from './State'\n\nexport const CytoscapeInstanceContext = createContextEx<CytoscapeInstanceState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { Core } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { CytoscapeInstanceContext } from './Context'\n\nexport interface CytoscapeInstanceProviderProps extends WithChildren {\n defaultInstance?: WeakRef<Core>\n}\n\nexport const CytoscapeInstanceProvider: React.FC<CytoscapeInstanceProviderProps> = ({ children, defaultInstance }) => {\n const [cy, setCy] = useState<WeakRef<Core> | undefined>(defaultInstance)\n useEffect(() => {\n setCy(defaultInstance)\n }, [defaultInstance])\n\n return <CytoscapeInstanceContext.Provider value={{ cy, provided: true, setCy }}>{children}</CytoscapeInstanceContext.Provider>\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { CytoscapeInstanceContext } from './Context'\n\nexport const useCytoscapeInstance = (required = false) => useContextEx(CytoscapeInstanceContext, 'CytoscapeInstance', required)\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { EventUnsubscribeFunction } from '@xyo-network/module-events'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { CytoscapeElements } from '../../../Cytoscape'\n\nexport const useCytoscapeElements = (mod?: WeakRef<ModuleInstance> | null) => {\n const [elements, setElements] = useState<ElementDefinition[]>([])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async () => {\n const moduleInstance = mod?.deref()\n if (moduleInstance) {\n const newElements = (await CytoscapeElements.buildElements(moduleInstance)) ?? []\n setElements(newElements)\n }\n },\n [mod],\n )\n\n useEffect(() => {\n let attachedListener: EventUnsubscribeFunction | undefined\n let detachedListener: EventUnsubscribeFunction | undefined\n\n if (mod && isNodeInstance(mod)) {\n attachedListener = mod.on('moduleAttached', async () => {\n const newElements = (await CytoscapeElements.buildElements(mod)) ?? []\n setElements(newElements)\n })\n detachedListener = mod.on('moduleDetached', async () => {\n const newElements = (await CytoscapeElements.buildElements(mod)) ?? []\n setElements(newElements)\n })\n }\n\n return () => {\n attachedListener?.()\n detachedListener?.()\n }\n }, [mod])\n\n return elements\n}\n","import { exists } from '@xylabs/exists'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { ElementDefinition } from 'cytoscape'\n\nimport { parseModuleType } from './lib'\n\ninterface ModuleInfo {\n children: ModuleInfo[]\n depth: number\n mod: ModuleInstance\n}\n\nexport const CytoscapeElements = {\n MaxNameLength: 20,\n\n buildEdge(rootNode: ElementDefinition, newNode: ElementDefinition, properties?: { [key: string]: unknown }) {\n return {\n data: {\n id: `${rootNode.data.id}/${newNode.data.id}`,\n source: rootNode.data.id,\n target: newNode.data.id,\n ...properties,\n },\n }\n },\n\n async buildElements(mod: ModuleInstance): Promise<ElementDefinition[]> {\n const info = await CytoscapeElements.recurseNodes(mod)\n const newElements: ElementDefinition[] = await this.buildElementsFromInfo(info, undefined, ['activeNode'])\n\n return newElements\n },\n\n async buildElementsFromInfo(info: ModuleInfo, root?: ElementDefinition, classes: string[] = []): Promise<ElementDefinition[]> {\n const newNode = CytoscapeElements.buildNode(info.mod, { childCount: info.children.length, depth: info.depth }, classes)\n const newEdge = root ? CytoscapeElements.buildEdge(root, newNode, { depth: info.depth, siblingCount: info.children.length }) : undefined\n const newElements: ElementDefinition[] = [newNode]\n if (newEdge) {\n newElements.push(newEdge)\n }\n\n for (const childInfo of info.children) {\n newElements.push(...(await this.buildElementsFromInfo(childInfo, newNode)))\n }\n\n return newElements\n },\n\n buildNode(mod: ModuleInstance, properties?: { [key: string]: unknown }, classes?: string[]): ElementDefinition {\n const { address, id } = mod\n return {\n classes,\n data: {\n address,\n id: address,\n name: id,\n type: parseModuleType(mod),\n ...properties,\n },\n }\n },\n\n buildRootNode: (mod: ModuleInstance): ElementDefinition => {\n return CytoscapeElements.buildNode(mod, {}, ['activeNode'])\n },\n\n normalizeName(name?: string) {\n if (!name) return\n if (name.length > this.MaxNameLength) return `${name.slice(0, 20)}...`\n return name\n },\n\n async recurseNodes(root: ModuleInstance, maxDepth = 10, depth = 1): Promise<ModuleInfo> {\n const info: ModuleInfo = { children: [], depth, mod: root }\n\n if (maxDepth > 0) {\n const children = await root.resolve('*', { direction: 'down', maxDepth: 1 })\n info.children = (\n await Promise.all(\n children.map(async (child) => {\n // don't re add the root module that was passed in\n if (child.address !== root.address) {\n return await this.recurseNodes(child, maxDepth - 1, depth + 1)\n }\n }),\n )\n ).filter(exists)\n }\n\n return info\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.querySelectorAll('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 // eslint-disable-next-line id-denylist\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 { LayoutOptions } from 'cytoscape'\n\nexport const ConcentricLayout: LayoutOptions = {\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-model'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel-model'\nimport { isWitnessModule } from '@xyo-network/witness-model'\n\nimport { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const parseModuleType = (mod?: ModuleInstance): CyNodeModuleTypes => {\n let type: CyNodeModuleTypes = 'module'\n if (mod) {\n if (isArchivistInstance(mod)) {\n type = 'archivist'\n } else if (isBridgeInstance(mod)) {\n type = 'bridge'\n } else if (isDivinerInstance(mod)) {\n type = 'diviner'\n } else if (isNodeInstance(mod)) {\n type = 'node'\n } else if (isSentinelInstance(mod)) {\n type = 'sentinel'\n } else if (isWitnessModule(mod)) {\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'\n// eslint-disable-next-line import/no-internal-modules\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 // eslint-disable-next-line id-denylist\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 NodeWithName = (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 Node = (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 NodeAsRoot = (bgColor?: string) => ({\n selector: '.activeNode',\n style: {\n 'background-color': bgColor,\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","import { NodeCollection, NodeSingular } from 'cytoscape'\nimport { Dispatch, SetStateAction, useCallback, useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts'\n\nexport const useHoveredNode = (renderedElements?: NodeCollection): [NodeSingular | undefined, Dispatch<SetStateAction<NodeSingular | undefined>>] => {\n const { cy } = useCytoscapeInstance(true)\n const [hoveredNode, setHoveredNode] = useState<NodeSingular>()\n\n const nodeListener = useCallback((node: NodeSingular) => {\n node.on('mouseover tap', () => {\n setHoveredNode(node)\n })\n }, [])\n\n useEffect(() => {\n if (renderedElements) {\n // eslint-disable-next-line unicorn/no-array-for-each\n renderedElements.nodes().forEach(nodeListener)\n }\n }, [nodeListener, renderedElements])\n\n useEffect(() => {\n cy?.deref()?.ready(() => {\n // eslint-disable-next-line unicorn/no-array-for-each\n cy?.deref()?.nodes().forEach(nodeListener)\n })\n }, [cy, nodeListener])\n\n return [hoveredNode, setHoveredNode]\n}\n","import { useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { NodeSingular } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { useCytoscapeElements } from './useCytoscapeElements'\n\nexport const useNewElements = (selectedElement?: NodeSingular) => {\n const selectedAddress = useMemo(() => {\n const { address: selectedAddress } = selectedElement?.data() ?? {}\n return selectedAddress\n }, [selectedElement])\n\n const [mod] = useWeakModuleFromNode(selectedAddress)\n const newElements = useCytoscapeElements(mod)\n\n return newElements\n}\n","import { CollectionReturnValue, ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts'\nimport { ColaLayout } from '../../../Cytoscape'\n\nexport const useRenderNewElements = (newElements: ElementDefinition[] = [], hideLabels?: boolean) => {\n const { cy } = useCytoscapeInstance(true)\n const [renderedElements, setRenderedElements] = useState<CollectionReturnValue>()\n\n useEffect(() => {\n if (newElements.length > 1) {\n const renderedElements = cy?.deref()?.add(newElements)\n setRenderedElements(renderedElements)\n cy?.deref()?.layout(ColaLayout).run()\n }\n }, [cy, hideLabels, newElements])\n\n return renderedElements\n}\n","import { NodeSingular } from 'cytoscape'\nimport { useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts'\n\nexport const useSelectedElement = () => {\n const [selectedElement, setSelectedElement] = useState<NodeSingular>()\n const { cy } = useCytoscapeInstance(true)\n\n const updateStyles = (element: NodeSingular) => {\n const nodes = cy?.deref()?.nodes()\n nodes?.toggleClass('activeNode', false)\n element.toggleClass('activeNode', true)\n }\n\n const toggleSelectedElement = (address?: string) => {\n const selectedNode = cy?.deref()?.nodes(`[id=\"${address}\"]`)?.[0]\n if (selectedNode) {\n setSelectedElement(selectedNode)\n updateStyles(selectedNode)\n }\n }\n\n return { selectedElement, toggleSelectedElement }\n}\n","import { useHoveredNode } from './useHoveredNode'\nimport { useNewElements } from './useNewElements'\nimport { useRenderNewElements } from './useRenderNewElements'\nimport { useSelectedElement } from './useSelectedElement'\n\nexport const useElements = (hideLabels: boolean) => {\n const { selectedElement, toggleSelectedElement } = useSelectedElement()\n const newElements = useNewElements(selectedElement)\n const renderedElements = useRenderNewElements(newElements, hideLabels)\n const [hoveredNode, setHoveredNode] = useHoveredNode(renderedElements)\n\n return { hoveredNode, setHoveredNode, toggleSelectedElement }\n}\n","import { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape'\nimport { useCytoscapeStyle } from './useCytoscapeStyle'\n\nexport const useCytoscapeOptions = (\n elements: CytoscapeOptions['elements'],\n style?: CytoscapeOptions['style'],\n layout?: CytoscapeOptions['layout'],\n) => {\n const defaultStyle = useCytoscapeStyle()\n\n const resolvedLayout = layout ?? ConcentricLayout\n const resolvedStyle = style ?? defaultStyle\n\n const options = useMemo<CytoscapeOptions | undefined>(() => {\n if (elements && resolvedLayout && resolvedStyle) {\n return {\n elements,\n layout: resolvedLayout,\n style: resolvedStyle,\n }\n }\n }, [elements, layout, style])\n\n return options\n}\n","import { useTheme } from '@mui/material'\nimport { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { EdgeStyled, Node, NodeAsRoot, NodeWithName } from '../../Cytoscape'\nimport { useIcons } from './useIcons'\n\nexport const useCytoscapeStyle = (hideLabels = false) => {\n const theme = useTheme()\n const icons = useIcons()\n\n const style: CytoscapeOptions['style'] = useMemo(\n () => [\n Node(icons, theme.palette.primary.main, hideLabels),\n NodeWithName(theme.palette.text.primary, theme.palette.getContrastText(theme.palette.text.primary)),\n NodeAsRoot(theme.palette.secondary.main),\n EdgeStyled(theme.palette.divider, theme.palette.divider),\n ],\n [icons, hideLabels, theme],\n )\n\n return style\n}\n","import { useTheme } from '@mui/material'\nimport { useMemo } from 'react'\n\nimport { CyIconSet, CyNodeModuleTypes, encodeSvg, generateIconMap } from '../../Cytoscape'\n\nexport const useIcons = () => {\n const theme = useTheme()\n const icons = useMemo(() => {\n const iconMap = generateIconMap()\n // eslint-disable-next-line unicorn/no-array-reduce\n return Object.entries(CyIconSet).reduce((acc, [name, IconComponent]) => {\n const icon = <IconComponent fontSize=\"small\" />\n acc[name as CyNodeModuleTypes] = encodeSvg(icon, theme.palette.getContrastText(theme.palette.text.primary))\n return acc\n }, iconMap)\n }, [theme.palette])\n\n return icons\n}\n","import { usePromise } from '@xylabs/react-promise'\nimport { ModuleInstance } from '@xyo-network/module-model'\nimport { useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\n\nexport const useModuleDetails = (rootModule?: WeakRef<ModuleInstance> | null, onFoundModule?: () => void) => {\n const { cy } = useCytoscapeInstance()\n const [moduleAddress, setModuleAddress] = useState<string | null>()\n\n const [foundModule] = usePromise(async () => {\n if (moduleAddress === null) return null\n const rootModuleInstance = rootModule?.deref()\n if (moduleAddress && rootModuleInstance) {\n const foundModule = await rootModuleInstance.resolve(moduleAddress)\n return foundModule ?? null\n }\n }, [moduleAddress, rootModule])\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(() => {\n if (moduleAddress === null) {\n // cytoscape tries to center prematurely without it :(\n setTimeout(() => {\n cy?.deref()?.center()\n }, 100)\n } else if (foundModule && cy) {\n const node = cy?.deref()?.nodes(`[id=\"${moduleAddress}\"]`)?.[0]\n // cy.pan(newPan)\n // cytoscape tries to center prematurely without it :(\n setTimeout(() => {\n cy?.deref()?.center(node)\n }, 100)\n }\n })\n\n const container = cy?.deref()?.container()\n if (container) {\n resizeObserver.observe(container)\n }\n\n return () => {\n if (container) resizeObserver.unobserve(container)\n }\n }, [cy, moduleAddress, foundModule, rootModule])\n\n useEffect(() => {\n if (foundModule) {\n onFoundModule?.()\n }\n }, [cy, moduleAddress, foundModule, onFoundModule])\n\n const onModuleDetails = (address?: string | null) => {\n const moduleNode = cy?.deref()?.nodes(`[id=\"${address}\"]`)\n const rootModuleNode = cy?.deref()?.nodes(`[id=\"${rootModule?.deref()?.address}\"]`)\n const foundModuleNode = cy?.deref()?.nodes(`[id=\"${foundModule?.address}\"]`)\n const notModuleNode = cy?.deref()?.nodes(`[id != \"${address}\"]`)\n\n if (address) {\n // address was passed so we set the node to active styles\n moduleNode?.toggleClass('activeNode', true)\n notModuleNode?.toggleClass('activeNode', false)\n } else {\n // no address was passes so we reset the state\n notModuleNode?.toggleClass('activeNode', false)\n const activeNode = foundModuleNode?.length ? foundModuleNode : rootModuleNode\n activeNode?.toggleClass('activeNode', true)\n }\n setModuleAddress(address)\n }\n\n return { mod: foundModule, onModuleDetails }\n}\n","import { ModuleInstance } from '@xyo-network/module-model'\nimport { useState } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape'\nimport { useCytoscapeElements } from './elements'\nimport { useCytoscapeOptions } from './useCytoscapeOptions'\nimport { useCytoscapeStyle } from './useCytoscapeStyle'\n\nexport const useRelationalGraphOptions = (mod?: WeakRef<ModuleInstance>) => {\n const [hideLabels, setHideLabels] = useState(true)\n\n const handleToggleLabels = () => {\n setHideLabels((oldValue) => !oldValue)\n }\n\n const elements = useCytoscapeElements(mod)\n const style = useCytoscapeStyle(hideLabels)\n const options = useCytoscapeOptions(elements, style, ConcentricLayout)\n\n return { handleToggleLabels, hideLabels, options }\n}\n","import cytoscape from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport coseBilkent from 'cytoscape-cose-bilkent'\nimport dagre from 'cytoscape-dagre'\nimport euler from 'cytoscape-euler'\nimport { PropsWithChildren, useEffect, useState } from 'react'\n\nexport const WithExtensions: React.FC<PropsWithChildren> = ({ children }) => {\n const [initialized, setInitialized] = useState(false)\n useEffect(() => {\n cytoscape.use(cola)\n cytoscape.use(dagre)\n cytoscape.use(coseBilkent)\n cytoscape.use(euler)\n setInitialized(true)\n }, [])\n\n return <>{initialized ? children : undefined}</>\n}\n","import { Box, Button, ButtonGroup, Card, CardHeader, CardProps, Paper, useTheme } from '@mui/material'\nimport { Address, asAddress } from '@xylabs/hex'\nimport { FlexCol, FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'\nimport { Identicon } from '@xylabs/react-identicon'\nimport { useWeakModuleFromNode } from '@xyo-network/react-node'\nimport cytoscape, { Core, NodeSingular } from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport coseBilkentLayout from 'cytoscape-cose-bilkent'\nimport dagre from 'cytoscape-dagre'\nimport eulerLayout from 'cytoscape-euler'\nimport { forwardRef, useEffect, useRef, useState } from 'react'\n\nimport { NodeRelationalGraphProps } from '../../lib'\n\nconst applyLayout = (cy?: cytoscape.Core, name = 'cola', options?: object) => {\n cy?.layout({ name, ...options }).run()\n}\n\nconst loadLayout = (layout = 'cola') => {\n switch (layout) {\n case 'dagre': {\n cytoscape.use(dagre)\n break\n }\n case 'euler': {\n cytoscape.use(eulerLayout)\n break\n }\n case 'cose-bilkent': {\n cytoscape.use(coseBilkentLayout)\n break\n }\n case 'cola': {\n cytoscape.use(cola)\n break\n }\n }\n}\n\ntype ModuleHoverDetailsProps = CardProps & {\n address: Address\n name: string\n}\n\nconst ModuleHoverDetails: React.FC<ModuleHoverDetailsProps> = ({ name, address, ...props }) => {\n return (\n <Card elevation={3} {...props}>\n <CardHeader\n avatar={\n <Paper elevation={6} sx={{ bgcolor: '#fff', p: 1 }}>\n <Identicon value={address} size={24} />\n </Paper>\n }\n title={name}\n subheader={address}\n />\n </Card>\n )\n}\n\nexport const NodeRelationalGraphFlexBox = forwardRef<HTMLDivElement, NodeRelationalGraphProps>(\n ({ actions, children, node, layout, layoutOptions, showDetails, detail, options, onHover, ...props }, ref) => {\n const theme = useTheme()\n const [cy, setCy] = useState<Core>()\n const cytoscapeRef = useRef<HTMLDivElement>()\n const [hoverPosition, setHoverBoundingBox] = useState<{ x1: number; x2: number; y1: number; y2: number }>()\n const [hoverAddress, setHoverAddress] = useState<Address>()\n\n const [moduleInstance] = useWeakModuleFromNode(hoverAddress, { node })\n\n useEffect(() => {\n cy?.on('mouseover tap', ({ target }) => {\n const cyNode = target as NodeSingular\n const bb = cyNode?.renderedBoundingBox?.()\n setHoverBoundingBox(bb)\n const id = cyNode.id?.()\n if (id) {\n if (id.includes('/')) {\n setHoverAddress(undefined)\n onHover?.()\n } else {\n setHoverAddress(asAddress(id))\n onHover?.(asAddress(id))\n }\n }\n })\n }, [onHover, cy])\n\n const handleReset = () => {\n cy?.reset()\n applyLayout(cy, layout ?? 'euler', layoutOptions)\n }\n\n useEffect(() => {\n let newCy: Core | undefined\n const container = cytoscapeRef.current\n if (container) {\n newCy = cytoscape({\n container,\n ...options,\n })\n setCy(newCy)\n }\n return () => {\n newCy?.destroy()\n setCy(undefined)\n }\n }, [options, cytoscapeRef, layoutOptions])\n\n useEffect(() => {\n if (cy) {\n loadLayout(layout)\n applyLayout(cy, layout ?? 'euler', layoutOptions)\n }\n }, [cy, layoutOptions, layout])\n\n return (\n <FlexCol id=\"relational-graph-wrapper\" ref={ref} {...props}>\n {hoverAddress && hoverPosition ?\n <Box position=\"absolute\" top={hoverPosition.y1} left={hoverPosition.x1} zIndex={100}>\n <ModuleHoverDetails address={hoverAddress} name={moduleInstance?.deref()?.id ?? 'Unknown'} />\n </Box>\n : null}\n <FlexRow justifyContent=\"start\" width=\"100%\">\n {actions === null ?\n null\n : actions ?\n <ButtonGroup>\n {actions}\n <Button size={'small'} variant={'contained'} onClick={handleReset}>\n Reset View\n </Button>\n </ButtonGroup>\n : <Button size={'small'} variant={'contained'} onClick={handleReset}>\n Reset\n </Button>\n }\n </FlexRow>\n <FlexGrowRow width=\"100%\" alignItems=\"start\">\n {showDetails ?\n <FlexCol height=\"100%\" width={'85%'}>\n {detail}\n </FlexCol>\n : null}\n <FlexCol\n justifyContent=\"start\"\n classes=\"cytoscape-wrap\"\n width={showDetails ? '15%' : '100%'}\n height={showDetails ? '50%' : '100%'}\n border={showDetails ? `1px solid ${theme.palette.divider}` : undefined}\n >\n {/* Cytoscape Element */}\n <FlexCol alignItems=\"stretch\" position=\"absolute\" width=\"100%\" height=\"100%\" ref={cytoscapeRef} />\n {children}\n </FlexCol>\n </FlexGrowRow>\n </FlexCol>\n )\n },\n)\n\nNodeRelationalGraphFlexBox.displayName = 'NodeRelationalGraph'\n\n/** @deprecated */\nexport const NodeRelationalGraph = NodeRelationalGraphFlexBox\n","import { AccountInstance } from '@xyo-network/account-model'\nimport { NodeInstance } from '@xyo-network/node-model'\nimport { useWeakProvidedNode } from '@xyo-network/react-node'\n\nimport { useCytoscapeElements, useCytoscapeOptions } from '../../../hooks'\nimport { NodeRelationalGraphProps } from '../../lib'\nimport { NodeRelationalGraphFlexBox } from './Graph'\n\nexport interface ProvidedNodeRendererProps extends NodeRelationalGraphProps {\n account?: AccountInstance\n layout?: 'dagre' | 'euler' | 'cose-bilkent' | 'cola'\n layoutOptions?: object\n node?: WeakRef<NodeInstance>\n}\n\nexport const ProvidedNodeRenderer: React.FC<ProvidedNodeRendererProps> = ({ node, ...props }) => {\n const [providedNode] = useWeakProvidedNode()\n const elements = useCytoscapeElements(node ?? providedNode)\n const options = useCytoscapeOptions(elements)\n\n return <NodeRelationalGraphFlexBox alignItems=\"stretch\" flexGrow={1} height=\"100%\" options={options} {...props} />\n}\n","import { CancelRounded } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { FlexBoxProps, FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'\n\nexport interface DetailsFlexboxProps extends FlexBoxProps {\n onClose?: () => void\n}\n\nexport const DetailsFlexbox: React.FC<DetailsFlexboxProps> = ({ children, onClose }) => {\n return (\n <FlexGrowCol alignItems=\"end\" justifyContent=\"start\" id=\"module-detail\" width=\"100%\" p={2} gap={2}>\n <FlexRow justifyContent=\"end\">\n <IconButton onClick={onClose} size={'small'}>\n <CancelRounded />\n </IconButton>\n </FlexRow>\n {children}\n </FlexGrowCol>\n )\n}\n","import { PopperProps, styled } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { NodeSingular } from 'cytoscape'\nimport { ReactElement } from 'react'\n\nimport { useNodeElement } from './hooks'\n\nexport interface ModuleHoverProps {\n children?: (anchorElement?: PopperProps['anchorEl'], container?: PopperProps['container']) => ReactElement\n node?: NodeSingular\n}\n\nexport const ModuleGraphNodeHover: React.FC<ModuleHoverProps> = ({ children, node }) => {\n const { boundingBox, ref, currentElement } = useNodeElement(node)\n\n return (\n <>\n <StyledNodeGhostElementFlexCol ref={ref} left={boundingBox?.x1} height={boundingBox?.h} top={boundingBox?.y1} width={boundingBox?.w} />\n {node ?\n <>{children?.(currentElement)}</>\n : null}\n </>\n )\n}\n\nconst StyledNodeGhostElementFlexCol = styled(FlexCol, { name: 'StyledNodeGhostElementFlexCol' })(() => ({\n // For easier debugging of the 'ghost' element that matches the hovered cytoscape node\n // backgroundColor: '#fff',\n // opacity: 0.25,\n\n // eslint-disable-next-line sort-keys-fix/sort-keys-fix\n cursor: 'pointer',\n pointerEvents: 'none',\n position: 'absolute',\n}))\n","import { PopperProps } from '@mui/material'\nimport { NodeSingular } from 'cytoscape'\nimport { useEffect, useRef, useState } from 'react'\n\nexport const useNodeElement = (node?: NodeSingular) => {\n const ref = useRef<HTMLDivElement>(null)\n const [currentElement, setCurrentElement] = useState<PopperProps['anchorEl'] | null>(null)\n const [boundingBox, setBoundingBox] = useState(node?.renderedBoundingBox())\n\n // Ensure first render clears the previous element when node changes to avoid flicker\n useEffect(() => {\n setCurrentElement(null)\n }, [node])\n\n useEffect(() => {\n if (node) {\n setBoundingBox(node.renderedBoundingBox())\n }\n\n const listener = () => {\n setBoundingBox(node?.renderedBoundingBox())\n }\n\n node?.on('position', listener)\n\n return () => {\n node?.off('position', undefined, listener)\n }\n }, [node])\n\n // Once boundingBox state is set and applied to the layout, update the ref\n useEffect(() => {\n setCurrentElement(ref.current)\n }, [boundingBox])\n\n return { boundingBox, currentElement, ref }\n}\n","import { CancelRounded } from '@mui/icons-material'\nimport { Button, Card, CardActions, CardHeader, IconButton, Paper, Popper, PopperProps, styled } from '@mui/material'\nimport { Identicon } from '@xylabs/react-identicon'\nimport { NodeSingular } from 'cytoscape'\n\nexport interface ModuleHoverPopperProps extends PopperProps {\n node?: NodeSingular\n onClose?: () => void\n onModuleDetails?: (address?: string) => void\n onModuleExplore?: (address?: string) => void\n}\n\nexport const ModuleHoverPopper: React.FC<ModuleHoverPopperProps> = ({ anchorEl, onClose, onModuleDetails, onModuleExplore, node, ...props }) => {\n const { address, name } = node?.data() ?? {}\n return (\n <>\n {anchorEl ?\n <Popper anchorEl={anchorEl} {...props}>\n <Card elevation={3}>\n <CardHeader\n action={\n onClose ?\n <IconButton size=\"small\" onClick={onClose}>\n <CancelRounded />\n </IconButton>\n : null\n }\n avatar={\n <Paper elevation={6} sx={{ bgcolor: '#fff', p: 1 }}>\n <Identicon value={address} size={24} />\n </Paper>\n }\n title={name}\n subheader={address}\n />\n <StyledCardActions>\n {onModuleDetails ?\n <Button onClick={() => onModuleDetails?.(address)} size=\"small\" variant=\"contained\">\n Details\n </Button>\n : null}\n {onModuleExplore ?\n <Button onClick={() => onModuleExplore?.(address)} size=\"small\" variant=\"contained\">\n Explore\n </Button>\n : null}\n </StyledCardActions>\n </Card>\n </Popper>\n : null}\n </>\n )\n}\n\nexport const StyledModuleHoverPopper = styled(ModuleHoverPopper, { name: 'StyledComponents' })(() => ({\n zIndex: 2,\n}))\n\nexport const StyledCardActions = styled(CardActions, { name: 'StyledCardActions' })(() => ({\n display: 'flex',\n justifyContent: 'center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MAAS;AAAA,UACvC,iBAAiB;AAAA,UACjB,iBAAiB,uBAAuB,SAAY;AAAA,UACpD,WAAW;AAAA,UACX,MAAI;AAAA;AAAA,MACN,GAEJ;AAAA;AAAA,EACF,GACF;AAEJ;AAEO,IAAM,iCAAoE,CAAC,UAAU;AAC1F,SACE,8CAAC,6BACC,wDAAC,sBAAoB,GAAG,OAAO,GACjC;AAEJ;","names":["import_material","import_react","import_jsx_runtime","import_react_shared","import_node_model","import_react","import_archivist_model","import_diviner_model","Inventory2RoundedIcon","InsertLinkRoundedIcon","BubbleChartRoundedIcon","QuestionMarkRoundedIcon","HubIcon","TimerRoundedIcon","VisibilityRoundedIcon","import_react","import_react","selectedAddress","import_react","renderedElements","import_react","import_react","import_material","import_react","import_react","import_jsx_runtime","import_react","foundModule","import_react","import_react","import_jsx_runtime","cytoscape","cola","dagre","coseBilkent","euler","import_material","import_react_node","import_cytoscape","import_cytoscape_cola","import_cytoscape_cose_bilkent","import_cytoscape_dagre","import_cytoscape_euler","import_react","import_jsx_runtime","cytoscape","dagre","eulerLayout","coseBilkentLayout","cola","import_react_node","import_jsx_runtime","import_icons_material","import_material","import_react_flexbox","import_jsx_runtime","import_material","import_react_flexbox","import_react","import_jsx_runtime","import_icons_material","import_material","import_react_identicon","import_jsx_runtime","import_jsx_runtime"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -523,8 +523,11 @@ var WithExtensions = ({ children }) => {
|
|
|
523
523
|
};
|
|
524
524
|
|
|
525
525
|
// src/components/relational/graph/Graph.tsx
|
|
526
|
-
import { Button, ButtonGroup, useTheme as useTheme3 } from "@mui/material";
|
|
526
|
+
import { Box, Button, ButtonGroup, Card, CardHeader, Paper, useTheme as useTheme3 } from "@mui/material";
|
|
527
|
+
import { asAddress } from "@xylabs/hex";
|
|
527
528
|
import { FlexCol, FlexGrowRow, FlexRow } from "@xylabs/react-flexbox";
|
|
529
|
+
import { Identicon } from "@xylabs/react-identicon";
|
|
530
|
+
import { useWeakModuleFromNode as useWeakModuleFromNode2 } from "@xyo-network/react-node";
|
|
528
531
|
import cytoscape2 from "cytoscape";
|
|
529
532
|
import cola2 from "cytoscape-cola";
|
|
530
533
|
import coseBilkentLayout from "cytoscape-cose-bilkent";
|
|
@@ -555,12 +558,41 @@ var loadLayout = (layout = "cola") => {
|
|
|
555
558
|
}
|
|
556
559
|
}
|
|
557
560
|
};
|
|
561
|
+
var ModuleHoverDetails = ({ name, address, ...props }) => {
|
|
562
|
+
return /* @__PURE__ */ jsx5(Card, { elevation: 3, ...props, children: /* @__PURE__ */ jsx5(
|
|
563
|
+
CardHeader,
|
|
564
|
+
{
|
|
565
|
+
avatar: /* @__PURE__ */ jsx5(Paper, { elevation: 6, sx: { bgcolor: "#fff", p: 1 }, children: /* @__PURE__ */ jsx5(Identicon, { value: address, size: 24 }) }),
|
|
566
|
+
title: name,
|
|
567
|
+
subheader: address
|
|
568
|
+
}
|
|
569
|
+
) });
|
|
570
|
+
};
|
|
558
571
|
var NodeRelationalGraphFlexBox = forwardRef(
|
|
559
|
-
({ actions, children, layout, layoutOptions, showDetails, detail, options, ...props }, ref) => {
|
|
572
|
+
({ actions, children, node, layout, layoutOptions, showDetails, detail, options, onHover, ...props }, ref) => {
|
|
560
573
|
const theme = useTheme3();
|
|
561
574
|
const [cy, setCy] = useState9();
|
|
562
|
-
const { setCy: setCyContext } = useCytoscapeInstance();
|
|
563
575
|
const cytoscapeRef = useRef();
|
|
576
|
+
const [hoverPosition, setHoverBoundingBox] = useState9();
|
|
577
|
+
const [hoverAddress, setHoverAddress] = useState9();
|
|
578
|
+
const [moduleInstance] = useWeakModuleFromNode2(hoverAddress, { node });
|
|
579
|
+
useEffect7(() => {
|
|
580
|
+
cy?.on("mouseover tap", ({ target }) => {
|
|
581
|
+
const cyNode = target;
|
|
582
|
+
const bb = cyNode?.renderedBoundingBox?.();
|
|
583
|
+
setHoverBoundingBox(bb);
|
|
584
|
+
const id = cyNode.id?.();
|
|
585
|
+
if (id) {
|
|
586
|
+
if (id.includes("/")) {
|
|
587
|
+
setHoverAddress(void 0);
|
|
588
|
+
onHover?.();
|
|
589
|
+
} else {
|
|
590
|
+
setHoverAddress(asAddress(id));
|
|
591
|
+
onHover?.(asAddress(id));
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
}, [onHover, cy]);
|
|
564
596
|
const handleReset = () => {
|
|
565
597
|
cy?.reset();
|
|
566
598
|
applyLayout(cy, layout ?? "euler", layoutOptions);
|
|
@@ -586,10 +618,8 @@ var NodeRelationalGraphFlexBox = forwardRef(
|
|
|
586
618
|
applyLayout(cy, layout ?? "euler", layoutOptions);
|
|
587
619
|
}
|
|
588
620
|
}, [cy, layoutOptions, layout]);
|
|
589
|
-
useEffect7(() => {
|
|
590
|
-
setCyContext?.(cy ? new WeakRef(cy) : void 0);
|
|
591
|
-
}, [cy, setCyContext]);
|
|
592
621
|
return /* @__PURE__ */ jsxs(FlexCol, { id: "relational-graph-wrapper", ref, ...props, children: [
|
|
622
|
+
hoverAddress && hoverPosition ? /* @__PURE__ */ jsx5(Box, { position: "absolute", top: hoverPosition.y1, left: hoverPosition.x1, zIndex: 100, children: /* @__PURE__ */ jsx5(ModuleHoverDetails, { address: hoverAddress, name: moduleInstance?.deref()?.id ?? "Unknown" }) }) : null,
|
|
593
623
|
/* @__PURE__ */ jsx5(FlexRow, { justifyContent: "start", width: "100%", children: actions === null ? null : actions ? /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
594
624
|
actions,
|
|
595
625
|
/* @__PURE__ */ jsx5(Button, { size: "small", variant: "contained", onClick: handleReset, children: "Reset View" })
|
|
@@ -691,17 +721,17 @@ var StyledNodeGhostElementFlexCol = styled(FlexCol2, { name: "StyledNodeGhostEle
|
|
|
691
721
|
|
|
692
722
|
// src/components/module/graph/Popper.tsx
|
|
693
723
|
import { CancelRounded as CancelRounded2 } from "@mui/icons-material";
|
|
694
|
-
import { Button as Button2, Card, CardActions, CardHeader, IconButton as IconButton2, Paper, Popper, styled as styled2 } from "@mui/material";
|
|
695
|
-
import { Identicon } from "@xylabs/react-identicon";
|
|
724
|
+
import { Button as Button2, Card as Card2, CardActions, CardHeader as CardHeader2, IconButton as IconButton2, Paper as Paper2, Popper, styled as styled2 } from "@mui/material";
|
|
725
|
+
import { Identicon as Identicon2 } from "@xylabs/react-identicon";
|
|
696
726
|
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
697
727
|
var ModuleHoverPopper = ({ anchorEl, onClose, onModuleDetails, onModuleExplore, node, ...props }) => {
|
|
698
728
|
const { address, name } = node?.data() ?? {};
|
|
699
|
-
return /* @__PURE__ */ jsx9(Fragment3, { children: anchorEl ? /* @__PURE__ */ jsx9(Popper, { anchorEl, ...props, children: /* @__PURE__ */ jsxs4(
|
|
729
|
+
return /* @__PURE__ */ jsx9(Fragment3, { children: anchorEl ? /* @__PURE__ */ jsx9(Popper, { anchorEl, ...props, children: /* @__PURE__ */ jsxs4(Card2, { elevation: 3, children: [
|
|
700
730
|
/* @__PURE__ */ jsx9(
|
|
701
|
-
|
|
731
|
+
CardHeader2,
|
|
702
732
|
{
|
|
703
733
|
action: onClose ? /* @__PURE__ */ jsx9(IconButton2, { size: "small", onClick: onClose, children: /* @__PURE__ */ jsx9(CancelRounded2, {}) }) : null,
|
|
704
|
-
avatar: /* @__PURE__ */ jsx9(
|
|
734
|
+
avatar: /* @__PURE__ */ jsx9(Paper2, { elevation: 6, sx: { bgcolor: "#fff", p: 1 }, children: /* @__PURE__ */ jsx9(Identicon2, { value: address, size: 24 }) }),
|
|
705
735
|
title: name,
|
|
706
736
|
subheader: address
|
|
707
737
|
}
|