@xyo-network/react-node-renderer 7.2.1 → 7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/Cytoscape/CytoscapeElements.d.ts.map +1 -1
- package/dist/browser/Cytoscape/lib/encodeSvg.d.ts.map +1 -1
- package/dist/browser/components/module/graph/GraphFlexBox.stories.d.ts +3 -3
- package/dist/browser/components/relational/graph/Graph.d.ts.map +1 -1
- package/dist/browser/components/relational/graph/Graph.stories.d.ts +6 -6
- package/dist/browser/components/relational/graph/GraphCola.stories.d.ts +6 -6
- package/dist/browser/components/relational/graph/GraphCoseBilkent.stories.d.ts +6 -6
- package/dist/browser/components/relational/graph/GraphDagre.stories.d.ts +6 -6
- package/dist/browser/components/relational/graph/GraphEuler.stories.d.ts +6 -6
- package/dist/browser/components/relational/graph/GraphEvents.stories.d.ts +1 -1
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.d.ts.map +1 -1
- package/dist/browser/hooks/cytoscape/useModuleDetails.d.ts.map +1 -1
- package/dist/browser/index.mjs +22 -8
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +22 -18
- package/src/Cytoscape/CytoscapeElements.ts +2 -1
- package/src/Cytoscape/lib/encodeSvg.ts +2 -1
- package/src/components/relational/graph/Graph.tsx +8 -2
- package/src/hooks/cytoscape/useCytoscapeOptions.ts +2 -1
- package/src/hooks/cytoscape/useModuleDetails.tsx +6 -3
- package/src/types/global.d.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CytoscapeElements.d.ts","sourceRoot":"","sources":["../../../src/Cytoscape/CytoscapeElements.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CytoscapeElements.d.ts","sourceRoot":"","sources":["../../../src/Cytoscape/CytoscapeElements.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAIlD,UAAU,UAAU;IAClB,QAAQ,EAAE,UAAU,EAAE,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,cAAc,CAAA;CACpB;AAED,eAAO,MAAM,iBAAiB;;wBAGR,iBAAiB,WAAW,iBAAiB,eAAe;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE;;;;;;;uBAWjF,cAAc,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;gCAOpC,UAAU,SAAS,iBAAiB,YAAW,MAAM,EAAE,GAAQ,OAAO,CAAC,iBAAiB,EAAE,CAAC;mBAiB9G,cAAc,eAAe;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,YAAY,MAAM,EAAE,GAAG,iBAAiB;yBAczF,cAAc,KAAG,iBAAiB;yBAIlC,MAAM;uBAMF,cAAc,sCAA6B,OAAO,CAAC,UAAU,CAAC;CAqBxF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encodeSvg.d.ts","sourceRoot":"","sources":["../../../../src/Cytoscape/lib/encodeSvg.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encodeSvg.d.ts","sourceRoot":"","sources":["../../../../src/Cytoscape/lib/encodeSvg.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAMzC,eAAO,MAAM,SAAS,GAAI,cAAc,YAAY,EAAE,QAAQ,MAAM,WAYnE,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
declare const Default: import(".store/storybook-virtual-
|
|
5
|
-
declare const WithProvidedNode: import(".store/storybook-virtual-
|
|
6
|
-
declare const WithDisabledDetails: import(".store/storybook-virtual-
|
|
4
|
+
declare const Default: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("./GraphFlexBox.tsx").ModuleGraphFlexBoxProps>;
|
|
5
|
+
declare const WithProvidedNode: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("./GraphFlexBox.tsx").ModuleGraphFlexBoxProps>;
|
|
6
|
+
declare const WithDisabledDetails: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("./GraphFlexBox.tsx").ModuleGraphFlexBoxProps>;
|
|
7
7
|
export { Default, WithDisabledDetails, WithProvidedNode, };
|
|
8
8
|
//# sourceMappingURL=GraphFlexBox.stories.d.ts.map
|
|
@@ -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":"AAiBA,OAAO,KAEN,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAiDlE,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA+GzE,CAAA;AAID,kBAAkB;AAClB,eAAO,MAAM,mBAAmB,oCAA6B,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
declare const Default: import(".store/storybook-virtual-
|
|
5
|
-
declare const WithData: import(".store/storybook-virtual-
|
|
6
|
-
declare const WithDescribe: import(".store/storybook-virtual-
|
|
7
|
-
declare const WithCustomAddress: import(".store/storybook-virtual-
|
|
8
|
-
declare const WithAttachDetach: import(".store/storybook-virtual-
|
|
9
|
-
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-
|
|
4
|
+
declare const Default: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
5
|
+
declare const WithData: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
6
|
+
declare const WithDescribe: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
7
|
+
declare const WithCustomAddress: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
8
|
+
declare const WithAttachDetach: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
9
|
+
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("./ProvidedNodeRenderer.tsx").ProvidedNodeRendererProps>;
|
|
10
10
|
export { Default, WithAttachDetach, WithCustomAddress, WithData, WithDescribe, WithProvidedNodeRenderer, };
|
|
11
11
|
//# sourceMappingURL=Graph.stories.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
declare const Default: import(".store/storybook-virtual-
|
|
5
|
-
declare const WithData: import(".store/storybook-virtual-
|
|
6
|
-
declare const WithDescribe: import(".store/storybook-virtual-
|
|
7
|
-
declare const WithCustomAddress: import(".store/storybook-virtual-
|
|
8
|
-
declare const WithAttachDetach: import(".store/storybook-virtual-
|
|
9
|
-
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-
|
|
4
|
+
declare const Default: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
5
|
+
declare const WithData: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
6
|
+
declare const WithDescribe: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
7
|
+
declare const WithCustomAddress: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
8
|
+
declare const WithAttachDetach: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
9
|
+
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("./ProvidedNodeRenderer.tsx").ProvidedNodeRendererProps>;
|
|
10
10
|
export { Default, WithAttachDetach, WithCustomAddress, WithData, WithDescribe, WithProvidedNodeRenderer, };
|
|
11
11
|
//# sourceMappingURL=GraphCola.stories.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
declare const Default: import(".store/storybook-virtual-
|
|
5
|
-
declare const WithData: import(".store/storybook-virtual-
|
|
6
|
-
declare const WithDescribe: import(".store/storybook-virtual-
|
|
7
|
-
declare const WithCustomAddress: import(".store/storybook-virtual-
|
|
8
|
-
declare const WithAttachDetach: import(".store/storybook-virtual-
|
|
9
|
-
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-
|
|
4
|
+
declare const Default: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
5
|
+
declare const WithData: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
6
|
+
declare const WithDescribe: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
7
|
+
declare const WithCustomAddress: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
8
|
+
declare const WithAttachDetach: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
9
|
+
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("./ProvidedNodeRenderer.tsx").ProvidedNodeRendererProps>;
|
|
10
10
|
export { Default, WithAttachDetach, WithCustomAddress, WithData, WithDescribe, WithProvidedNodeRenderer, };
|
|
11
11
|
//# sourceMappingURL=GraphCoseBilkent.stories.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
declare const Default: import(".store/storybook-virtual-
|
|
5
|
-
declare const WithData: import(".store/storybook-virtual-
|
|
6
|
-
declare const WithDescribe: import(".store/storybook-virtual-
|
|
7
|
-
declare const WithCustomAddress: import(".store/storybook-virtual-
|
|
8
|
-
declare const WithAttachDetach: import(".store/storybook-virtual-
|
|
9
|
-
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-
|
|
4
|
+
declare const Default: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
5
|
+
declare const WithData: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
6
|
+
declare const WithDescribe: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
7
|
+
declare const WithCustomAddress: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
8
|
+
declare const WithAttachDetach: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
9
|
+
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("./ProvidedNodeRenderer.tsx").ProvidedNodeRendererProps>;
|
|
10
10
|
export { Default, WithAttachDetach, WithCustomAddress, WithData, WithDescribe, WithProvidedNodeRenderer, };
|
|
11
11
|
//# sourceMappingURL=GraphDagre.stories.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
declare const Default: import(".store/storybook-virtual-
|
|
5
|
-
declare const WithData: import(".store/storybook-virtual-
|
|
6
|
-
declare const WithDescribe: import(".store/storybook-virtual-
|
|
7
|
-
declare const WithCustomAddress: import(".store/storybook-virtual-
|
|
8
|
-
declare const WithAttachDetach: import(".store/storybook-virtual-
|
|
9
|
-
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-
|
|
4
|
+
declare const Default: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
5
|
+
declare const WithData: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
6
|
+
declare const WithDescribe: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
7
|
+
declare const WithCustomAddress: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
8
|
+
declare const WithAttachDetach: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
9
|
+
declare const WithProvidedNodeRenderer: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("./ProvidedNodeRenderer.tsx").ProvidedNodeRendererProps>;
|
|
10
10
|
export { Default, WithAttachDetach, WithCustomAddress, WithData, WithDescribe, WithProvidedNodeRenderer, };
|
|
11
11
|
//# sourceMappingURL=GraphEuler.stories.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
declare const Default: import(".store/storybook-virtual-
|
|
4
|
+
declare const Default: import(".store/storybook-virtual-a33617eefc/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("../../index.ts").NodeRelationalGraphProps>;
|
|
5
5
|
export { Default };
|
|
6
6
|
//# sourceMappingURL=GraphEvents.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCytoscapeOptions.d.ts","sourceRoot":"","sources":["../../../../src/hooks/cytoscape/useCytoscapeOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCytoscapeOptions.d.ts","sourceRoot":"","sources":["../../../../src/hooks/cytoscape/useCytoscapeOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAMjD,eAAO,MAAM,mBAAmB,GAC9B,UAAU,gBAAgB,CAAC,UAAU,CAAC,EACtC,QAAQ,gBAAgB,CAAC,OAAO,CAAC,EACjC,SAAS,gBAAgB,CAAC,QAAQ,CAAC,iCAkBpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModuleDetails.d.ts","sourceRoot":"","sources":["../../../../src/hooks/cytoscape/useModuleDetails.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useModuleDetails.d.ts","sourceRoot":"","sources":["../../../../src/hooks/cytoscape/useModuleDetails.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAO/D,eAAO,MAAM,gBAAgB,GAAI,aAAa,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,EAAE,gBAAgB,MAAM,IAAI;;gCAmDnE,MAAM,GAAG,IAAI;CAoBjD,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -50,15 +50,17 @@ import { useEffect, useState as useState2 } from "react";
|
|
|
50
50
|
|
|
51
51
|
// src/Cytoscape/CytoscapeElements.ts
|
|
52
52
|
import { exists } from "@xylabs/exists";
|
|
53
|
+
import { isFalsy } from "@xylabs/typeof";
|
|
53
54
|
|
|
54
55
|
// src/Cytoscape/lib/encodeSvg.ts
|
|
56
|
+
import { isDefined } from "@xylabs/typeof";
|
|
55
57
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
56
58
|
var dataUri = "data:image/svg+xml,";
|
|
57
59
|
var encodeSvg = (reactElement, color) => {
|
|
58
60
|
const svgString = renderToStaticMarkup(reactElement);
|
|
59
61
|
const doc = new DOMParser().parseFromString(svgString, "text/html");
|
|
60
62
|
const svgElement = doc.querySelectorAll("svg")[0];
|
|
61
|
-
if (svgElement) {
|
|
63
|
+
if (isDefined(svgElement)) {
|
|
62
64
|
svgElement.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
63
65
|
svgElement.setAttribute("height", "100");
|
|
64
66
|
svgElement.style.fill = color ?? "black";
|
|
@@ -170,7 +172,7 @@ var CytoscapeElements = {
|
|
|
170
172
|
return CytoscapeElements.buildNode(mod, {}, ["activeNode"]);
|
|
171
173
|
},
|
|
172
174
|
normalizeName(name) {
|
|
173
|
-
if (
|
|
175
|
+
if (isFalsy(name)) return;
|
|
174
176
|
if (name.length > this.MaxNameLength) return `${name.slice(0, 20)}...`;
|
|
175
177
|
return name;
|
|
176
178
|
},
|
|
@@ -376,6 +378,7 @@ var useElements = (hideLabels) => {
|
|
|
376
378
|
};
|
|
377
379
|
|
|
378
380
|
// src/hooks/cytoscape/useCytoscapeOptions.ts
|
|
381
|
+
import { isDefined as isDefined2 } from "@xylabs/typeof";
|
|
379
382
|
import { useMemo as useMemo6 } from "react";
|
|
380
383
|
|
|
381
384
|
// src/hooks/cytoscape/useCytoscapeStyle.tsx
|
|
@@ -430,7 +433,7 @@ var useCytoscapeOptions = (elements, style, layout) => {
|
|
|
430
433
|
const resolvedLayout = layout ?? ConcentricLayout;
|
|
431
434
|
const resolvedStyle = style ?? defaultStyle;
|
|
432
435
|
const options = useMemo6(() => {
|
|
433
|
-
if (elements && resolvedLayout && resolvedStyle) {
|
|
436
|
+
if (elements && isDefined2(resolvedLayout) && isDefined2(resolvedStyle)) {
|
|
434
437
|
return {
|
|
435
438
|
elements,
|
|
436
439
|
layout: resolvedLayout,
|
|
@@ -443,6 +446,11 @@ var useCytoscapeOptions = (elements, style, layout) => {
|
|
|
443
446
|
|
|
444
447
|
// src/hooks/cytoscape/useModuleDetails.tsx
|
|
445
448
|
import { usePromise } from "@xylabs/react-promise";
|
|
449
|
+
import {
|
|
450
|
+
isDefined as isDefined3,
|
|
451
|
+
isDefinedNotNull,
|
|
452
|
+
isTruthy
|
|
453
|
+
} from "@xylabs/typeof";
|
|
446
454
|
import {
|
|
447
455
|
useCallback as useCallback2,
|
|
448
456
|
useEffect as useEffect3,
|
|
@@ -454,7 +462,7 @@ var useModuleDetails = (rootModule, onFoundModule) => {
|
|
|
454
462
|
const [foundModule] = usePromise(async () => {
|
|
455
463
|
if (moduleAddress === null) return null;
|
|
456
464
|
const rootModuleInstance = rootModule?.deref();
|
|
457
|
-
if (moduleAddress && rootModuleInstance) {
|
|
465
|
+
if (isDefined3(moduleAddress) && isDefined3(rootModuleInstance)) {
|
|
458
466
|
const foundModule2 = await rootModuleInstance.resolve(moduleAddress);
|
|
459
467
|
return foundModule2 ?? null;
|
|
460
468
|
}
|
|
@@ -493,12 +501,12 @@ var useModuleDetails = (rootModule, onFoundModule) => {
|
|
|
493
501
|
const rootModuleNode = cy?.deref()?.nodes(`[id="${rootModule?.deref()?.address}"]`);
|
|
494
502
|
const foundModuleNode = cy?.deref()?.nodes(`[id="${foundModule?.address}"]`);
|
|
495
503
|
const notModuleNode = cy?.deref()?.nodes(`[id != "${address}"]`);
|
|
496
|
-
if (address) {
|
|
504
|
+
if (isTruthy(address)) {
|
|
497
505
|
moduleNode?.toggleClass("activeNode", true);
|
|
498
506
|
notModuleNode?.toggleClass("activeNode", false);
|
|
499
507
|
} else {
|
|
500
508
|
notModuleNode?.toggleClass("activeNode", false);
|
|
501
|
-
const activeNode = foundModuleNode
|
|
509
|
+
const activeNode = isDefinedNotNull(foundModuleNode) && foundModuleNode.length > 0 ? foundModuleNode : rootModuleNode;
|
|
502
510
|
activeNode?.toggleClass("activeNode", true);
|
|
503
511
|
}
|
|
504
512
|
setModuleAddress(address);
|
|
@@ -555,10 +563,12 @@ import {
|
|
|
555
563
|
FlexRow
|
|
556
564
|
} from "@xylabs/react-flexbox";
|
|
557
565
|
import { Identicon } from "@xylabs/react-identicon";
|
|
566
|
+
import { isDefined as isDefined4 } from "@xylabs/typeof";
|
|
558
567
|
import { useWeakModuleFromNode as useWeakModuleFromNode2 } from "@xyo-network/react-node";
|
|
559
568
|
import cytoscape2 from "cytoscape";
|
|
560
569
|
import cola2 from "cytoscape-cola";
|
|
561
570
|
import coseBilkentLayout from "cytoscape-cose-bilkent";
|
|
571
|
+
import euler from "cytoscape-euler";
|
|
562
572
|
import {
|
|
563
573
|
useEffect as useEffect4,
|
|
564
574
|
useRef,
|
|
@@ -578,6 +588,10 @@ var loadLayout = (layout = "cola") => {
|
|
|
578
588
|
cytoscape2.use(cola2);
|
|
579
589
|
break;
|
|
580
590
|
}
|
|
591
|
+
case "euler": {
|
|
592
|
+
cytoscape2.use(euler);
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
581
595
|
}
|
|
582
596
|
};
|
|
583
597
|
var ModuleHoverDetails = ({
|
|
@@ -625,7 +639,7 @@ var NodeRelationalGraphFlexBox = ({
|
|
|
625
639
|
const bb = cyNode?.renderedBoundingBox?.();
|
|
626
640
|
setHoverBoundingBox(bb);
|
|
627
641
|
const id = cyNode.id?.();
|
|
628
|
-
if (id) {
|
|
642
|
+
if (isDefined4(id)) {
|
|
629
643
|
if (id.includes("/")) {
|
|
630
644
|
setHoverAddress(void 0);
|
|
631
645
|
onHover?.();
|
|
@@ -666,7 +680,7 @@ var NodeRelationalGraphFlexBox = ({
|
|
|
666
680
|
}, [cy, layoutOptions, layout]);
|
|
667
681
|
return /* @__PURE__ */ jsxs(FlexCol, { id: "relational-graph-wrapper", ...props, children: [
|
|
668
682
|
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,
|
|
669
|
-
/* @__PURE__ */ jsx5(FlexRow, { justifyContent: "start", width: "100%", children: actions === null ? null : actions ? /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
683
|
+
/* @__PURE__ */ jsx5(FlexRow, { justifyContent: "start", width: "100%", children: actions === null ? null : isDefined4(actions) ? /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
670
684
|
actions,
|
|
671
685
|
/* @__PURE__ */ jsx5(Button, { size: "small", variant: "contained", onClick: handleReset, children: "Reset View" })
|
|
672
686
|
] }) : /* @__PURE__ */ jsx5(Button, { size: "small", variant: "contained", onClick: handleReset, children: "Reset" }) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../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":["import { asArchivistInstance, isArchivistInstance } from '@xyo-network/archivist-model'\nimport { asDivinerInstance, isDivinerInstance } from '@xyo-network/diviner-model'\nimport type { ModuleInstance } from '@xyo-network/module-model'\nimport { ArchivistCard } from '@xyo-network/react-archivist'\nimport { DivinerCard, ModuleCard } from '@xyo-network/react-module'\nimport React from 'react'\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport type { ModuleInstance } from '@xyo-network/module-model'\nimport React, { useRef } from 'react'\n\nimport { CytoscapeInstanceProvider } from '../../../contexts/index.ts'\nimport {\n useElements, useModuleDetails, useRelationalGraphOptions,\n} from '../../../hooks/index.ts'\nimport { WithExtensions } from '../../cytoscape-extensions/index.ts'\nimport { NodeRelationalGraphFlexBox } from '../../relational/index.ts'\nimport { DetailsFlexbox } from './DetailsFlexbox.tsx'\nimport { ModuleGraphNodeHover } from './node/index.ts'\nimport { StyledModuleHoverPopper } from './Popper.tsx'\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> = ({\n hideActions, rootModule, disableModuleDetails, ...props\n}) => {\n const cytoscapeRef = useRef<HTMLDivElement>(null)\n const {\n handleToggleLabels, hideLabels, options,\n } = useRelationalGraphOptions(rootModule ?? undefined)\n const {\n hoveredNode, setHoveredNode, toggleSelectedElement,\n } = useElements(hideLabels)\n\n const { mod, onModuleDetails } = useModuleDetails(rootModule, () => setHoveredNode(undefined))\n\n return (\n <WithExtensions>\n <NodeRelationalGraphFlexBox\n actions={\n mod\n ? null\n : hideActions\n ? null\n : (\n <Button size=\"small\" onClick={handleToggleLabels} variant=\"contained\">\n Toggle Labels\n </Button>\n )\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 '@xylabs/react-shared'\n\nimport type { CytoscapeInstanceState } from './State.ts'\n\nexport const CytoscapeInstanceContext = createContextEx<CytoscapeInstanceState>()\n","import type { Core } from 'cytoscape'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo, useState } from 'react'\n\nimport { CytoscapeInstanceContext } from './Context.ts'\nimport type { CytoscapeInstanceState } from './State.ts'\n\nexport interface CytoscapeInstanceProviderProps extends PropsWithChildren {\n defaultInstance?: WeakRef<Core>\n}\n\nexport const CytoscapeInstanceProvider: React.FC<CytoscapeInstanceProviderProps> = ({ children, defaultInstance }) => {\n const [cy, setCy] = useState<WeakRef<Core> | undefined>(() => defaultInstance)\n\n const value: CytoscapeInstanceState = useMemo(() => ({\n cy, provided: true, setCy,\n }), [cy, setCy])\n\n return (\n <CytoscapeInstanceContext value={value}>\n {children}\n </CytoscapeInstanceContext>\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { CytoscapeInstanceContext } from './Context.ts'\n\nexport const useCytoscapeInstance = (required = false) => useContextEx(CytoscapeInstanceContext, 'CytoscapeInstance', required)\n","import type { EventUnsubscribeFunction } from '@xylabs/events'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type { ModuleInstance } from '@xyo-network/module-model'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport type { ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { CytoscapeElements } from '../../../Cytoscape/index.ts'\n\nexport const useCytoscapeElements = (mod?: WeakRef<ModuleInstance> | null) => {\n const [elements, setElements] = useState<ElementDefinition[]>([])\n\n useAsyncEffect(\n\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 type { ModuleInstance } from '@xyo-network/module-model'\nimport type { ElementDefinition } from 'cytoscape'\n\nimport { parseModuleType } from './lib/index.ts'\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\n ? CytoscapeElements.buildEdge(root, newNode, { depth: info.depth, siblingCount: info.children.length })\n : 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 = {\n children: [], depth, mod: root,\n }\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 type { ReactElement } from 'react'\n// eslint-disable-next-line import-x/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}${globalThis.encodeURIComponent(svgElement.outerHTML)}`\n}\n","import type { CyNodeModuleTypes } from './CyNodeModuleTypes.ts'\n\nexport const generateIconMap: () => Record<CyNodeModuleTypes, string> = () => ({\n archivist: '',\n bridge: '',\n diviner: '',\n\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 type { LayoutOptions } from 'cytoscape'\n\nexport const ConcentricLayout: LayoutOptions = {\n concentric: function (node) {\n return node.degree(false)\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 type { 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 type { CyNodeModuleTypes } from './CyNodeModuleTypes.ts'\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 }\n }\n return type\n}\n","import type { SvgIconComponent } from '@mui/icons-material'\nimport {\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'\n\nimport type { CyNodeModuleTypes } from './lib/index.ts'\n\nexport const CyIconSet: Record<CyNodeModuleTypes, SvgIconComponent> = {\n archivist: Inventory2RoundedIcon,\n bridge: InsertLinkRoundedIcon,\n diviner: BubbleChartRoundedIcon,\n\n module: QuestionMarkRoundedIcon,\n node: HubIcon,\n sentinel: TimerRoundedIcon,\n witness: VisibilityRoundedIcon,\n}\n","import type { StylesheetCSS } from 'cytoscape'\n\nimport type { CyNodeModuleTypes } from './lib/index.ts'\n\nexport const NodeWithName = (color?: string, outlineColor?: string): StylesheetCSS => ({\n selector: 'node[name]',\n css: {\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): StylesheetCSS => ({\n selector: 'node',\n css: {\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): StylesheetCSS => ({\n selector: '.activeNode',\n css: { 'background-color': bgColor },\n})\n\nexport const EdgeStyled = (lineColor?: string, targetArrowColor?: string): StylesheetCSS => ({\n selector: 'edge',\n css: {\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 type { NodeCollection, NodeSingular } from 'cytoscape'\nimport type { Dispatch, SetStateAction } from 'react'\nimport {\n useCallback, useEffect, useState,\n} from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts/index.ts'\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 type { NodeSingular } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { useCytoscapeElements } from './useCytoscapeElements.ts'\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 type { ElementDefinition } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts/index.ts'\nimport { ColaLayout } from '../../../Cytoscape/index.ts'\n\nexport const useRenderNewElements = (newElements: ElementDefinition[] = [], hideLabels?: boolean) => {\n const { cy } = useCytoscapeInstance(true)\n\n return useMemo(() => {\n if (newElements.length > 1) {\n const renderedElements = cy?.deref()?.add(newElements)\n cy?.deref()?.layout(ColaLayout).run()\n return renderedElements\n }\n }, [cy, hideLabels, newElements])\n}\n","import type { NodeSingular } from 'cytoscape'\nimport { useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts/index.ts'\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.tsx'\nimport { useNewElements } from './useNewElements.tsx'\nimport { useRenderNewElements } from './useRenderNewElements.tsx'\nimport { useSelectedElement } from './useSelectedElement.tsx'\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 {\n hoveredNode, setHoveredNode, toggleSelectedElement,\n }\n}\n","import type { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape/index.ts'\nimport { useCytoscapeStyle } from './useCytoscapeStyle.tsx'\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 { useIsDark } from '@xylabs/react-theme'\nimport type { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport {\n EdgeStyled, Node, NodeAsRoot, NodeWithName,\n} from '../../Cytoscape/index.ts'\nimport { useIcons } from './useIcons.tsx'\n\nexport const useCytoscapeStyle = (hideLabels = false) => {\n const theme = useTheme()\n const dark = useIsDark()\n const icons = useIcons()\n\n const style: CytoscapeOptions['style'] = useMemo(\n // eslint-disable-next-line complexity\n () => [\n Node(icons, dark ? theme.colorSchemes.dark?.palette.primary.main : theme.colorSchemes.light?.palette.primary.main, hideLabels),\n NodeWithName(\n dark ? theme.colorSchemes.dark?.palette.primary.contrastText : theme.colorSchemes.light?.palette.primary.contrastText,\n dark ? theme.colorSchemes.dark?.palette.text.primary : theme.colorSchemes.light?.palette.text.primary,\n ),\n NodeAsRoot(dark ? theme.colorSchemes.dark?.palette.secondary.main : theme.colorSchemes.light?.palette.secondary.main),\n EdgeStyled(\n dark ? theme.colorSchemes.dark?.palette.divider : theme.colorSchemes.light?.palette.divider,\n dark ? theme.colorSchemes.dark?.palette.divider : theme.colorSchemes.light?.palette.divider,\n ),\n ],\n [icons, hideLabels, theme],\n )\n\n return style\n}\n","import { useTheme } from '@mui/material'\nimport React, { useMemo } from 'react'\n\nimport type { CyNodeModuleTypes } from '../../Cytoscape/index.ts'\nimport {\n CyIconSet, encodeSvg, generateIconMap,\n} from '../../Cytoscape/index.ts'\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.vars.palette.primary.contrastText)\n return acc\n }, iconMap)\n }, [theme.palette])\n\n return icons\n}\n","import { usePromise } from '@xylabs/react-promise'\nimport type { ModuleInstance } from '@xyo-network/module-model'\nimport {\n useCallback, useEffect, useState,\n} from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts/index.ts'\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 const createObserver = useCallback(() => {\n return 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 }, [cy, moduleAddress, foundModule])\n\n useEffect(() => {\n const resizeObserver = createObserver()\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, createObserver])\n\n // eslint-disable-next-line complexity\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 type { ModuleInstance } from '@xyo-network/module-model'\nimport { useState } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape/index.ts'\nimport { useCytoscapeElements } from './elements/index.ts'\nimport { useCytoscapeOptions } from './useCytoscapeOptions.ts'\nimport { useCytoscapeStyle } from './useCytoscapeStyle.tsx'\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 {\n handleToggleLabels, hideLabels, options,\n }\n}\n","import cytoscape from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport coseBilkent from 'cytoscape-cose-bilkent'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo } from 'react'\n\nexport const WithExtensions: React.FC<PropsWithChildren> = ({ children }) => {\n const initialized = useMemo(() => {\n cytoscape.use(cola)\n cytoscape.use(coseBilkent)\n return true\n }, [])\n\n return <>{initialized ? children : undefined}</>\n}\n","import type { CardProps } from '@mui/material'\nimport {\n Box, Button, ButtonGroup, Card, CardHeader, Paper, useTheme,\n} from '@mui/material'\nimport type { Address } from '@xylabs/hex'\nimport { asAddress } from '@xylabs/hex'\nimport {\n FlexCol, FlexGrowRow, FlexRow,\n} from '@xylabs/react-flexbox'\nimport { Identicon } from '@xylabs/react-identicon'\nimport { useWeakModuleFromNode } from '@xyo-network/react-node'\nimport type { Core, NodeSingular } from 'cytoscape'\nimport cytoscape from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport coseBilkentLayout from 'cytoscape-cose-bilkent'\nimport React, {\n useEffect, useRef, useState,\n} from 'react'\n\nimport type { NodeRelationalGraphProps } from '../../lib/index.ts'\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 '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> = ({\n name, address, ...props\n}) => {\n return (\n <Card elevation={3} {...props}>\n <CardHeader\n avatar={(\n <Paper\n elevation={6}\n sx={{ bgcolor: '#fff', p: 1 }}\n >\n <Identicon value={address} size={24} />\n </Paper>\n )}\n title={name}\n subheader={address}\n />\n </Card>\n )\n}\n\nexport const NodeRelationalGraphFlexBox: React.FC<NodeRelationalGraphProps> = ({\n actions, children, node, layout, layoutOptions, showDetails, detail, options, onHover, ...props\n}) => {\n const theme = useTheme()\n const [cy, setCy] = useState<Core>()\n const cytoscapeRef = useRef<HTMLDivElement>(null)\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 // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n setCy(newCy)\n } else {\n newCy?.destroy()\n // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n setCy(undefined)\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\" {...props}>\n {hoverAddress && hoverPosition\n ? (\n <Box position=\"absolute\" top={hoverPosition.y1} left={hoverPosition.x1} zIndex={100}>\n <ModuleHoverDetails address={hoverAddress} name={moduleInstance?.deref()?.id ?? 'Unknown'} />\n </Box>\n )\n : null}\n <FlexRow justifyContent=\"start\" width=\"100%\">\n {actions === null\n ? null\n : actions\n ? (\n <ButtonGroup>\n {actions}\n <Button size=\"small\" variant=\"contained\" onClick={handleReset}>\n Reset View\n </Button>\n </ButtonGroup>\n )\n : (\n <Button size=\"small\" variant=\"contained\" onClick={handleReset}>\n Reset\n </Button>\n )}\n </FlexRow>\n <FlexGrowRow width=\"100%\" alignItems=\"start\">\n {showDetails\n ? (\n <FlexCol height=\"100%\" width=\"85%\">\n {detail}\n </FlexCol>\n )\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.vars.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\nNodeRelationalGraphFlexBox.displayName = 'NodeRelationalGraph'\n\n/** @deprecated */\nexport const NodeRelationalGraph = NodeRelationalGraphFlexBox\n","import type { AccountInstance } from '@xyo-network/account-model'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport { useWeakProvidedNode } from '@xyo-network/react-node'\nimport React from 'react'\n\nimport { useCytoscapeElements, useCytoscapeOptions } from '../../../hooks/index.ts'\nimport type { NodeRelationalGraphProps } from '../../lib/index.ts'\nimport { NodeRelationalGraphFlexBox } from './Graph.tsx'\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\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 type { PopperProps } from '@mui/material'\nimport { styled } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { NodeSingular } from 'cytoscape'\nimport type { ReactElement } from 'react'\nimport React from 'react'\n\nimport { useNodeElement } from './hooks/index.ts'\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 {\n boundingBox, ref, currentElement,\n } = 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 cursor: 'pointer',\n pointerEvents: 'none',\n position: 'absolute',\n}))\n","import type { PopperProps } from '@mui/material'\nimport type { NodeSingular } from 'cytoscape'\nimport {\n useEffect, useMemo, useRef, useState,\n} 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 useMemo(() => {\n setCurrentElement(null)\n }, [node])\n\n useMemo(() => {\n setBoundingBox(node?.renderedBoundingBox())\n }, [node])\n\n useEffect(() => {\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 useMemo(() => {\n setCurrentElement(ref.current)\n }, [boundingBox])\n\n return {\n boundingBox, currentElement, ref,\n }\n}\n","import { CancelRounded } from '@mui/icons-material'\nimport type { PopperProps } from '@mui/material'\nimport {\n Button, Card, CardActions, CardHeader, IconButton, Paper, Popper, styled,\n} from '@mui/material'\nimport { Identicon } from '@xylabs/react-identicon'\nimport type { NodeSingular } from 'cytoscape'\nimport React from 'react'\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> = ({\n anchorEl, onClose, onModuleDetails, onModuleExplore, node, ...props\n}) => {\n const { address, name } = node?.data() ?? {}\n return (\n <>\n {anchorEl\n ? (\n <Popper anchorEl={anchorEl} {...props}>\n <Card elevation={3}>\n <CardHeader\n action={\n onClose\n ? (\n <IconButton size=\"small\" onClick={onClose}>\n <CancelRounded />\n </IconButton>\n )\n : null\n }\n avatar={(\n <Paper\n elevation={6}\n sx={{ bgcolor: '#fff', p: 1 }}\n >\n <Identicon value={address} size={24} />\n </Paper>\n )}\n title={name}\n subheader={address}\n />\n <StyledCardActions>\n {onModuleDetails\n ? (\n <Button onClick={() => onModuleDetails?.(address)} size=\"small\" variant=\"contained\">\n Details\n </Button>\n )\n : null}\n {onModuleExplore\n ? (\n <Button onClick={() => onModuleExplore?.(address)} size=\"small\" variant=\"contained\">\n Explore\n </Button>\n )\n : null}\n </StyledCardActions>\n </Card>\n </Popper>\n )\n : null}\n </>\n )\n}\n\nexport const StyledModuleHoverPopper = styled(ModuleHoverPopper, { name: 'StyledComponents' })(() => ({ zIndex: 2 }))\n\nexport const StyledCardActions = styled(CardActions, { name: 'StyledCardActions' })(() => ({\n display: 'flex',\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,IAAI,GAAG;AAAA,MAC9D;AAAA,MACA,KAAK;AAAA,MACL,OAAM;AAAA,MACL,GAAG;AAAA,MAEJ,0BAAAA,MAAC,wBAAqB,MAAM,aACzB,uBACC,gBAAAA;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,WAAU;AAAA,UACV,MAAI;AAAA;AAAA,MACN,GAEJ;AAAA;AAAA,EACF,GACF;AAEJ;AAEO,IAAM,iCAAoE,CAAC,UAAU;AAC1F,SACE,gBAAAA,MAAC,6BACC,0BAAAA,MAAC,sBAAoB,GAAG,OAAO,GACjC;AAEJ;","names":["Button","useRef","jsx","isNodeInstance","useState","isArchivistInstance","isDivinerInstance","useState","isNodeInstance","useEffect","useState","useState","useEffect","useMemo","useMemo","selectedAddress","useMemo","useMemo","useState","useState","useMemo","useTheme","useMemo","useMemo","jsx","useMemo","useTheme","useMemo","useMemo","useCallback","useEffect","useState","useState","foundModule","useCallback","useEffect","useState","useState","useMemo","jsx","useTheme","useWeakModuleFromNode","cytoscape","cola","useEffect","useState","jsx","jsx","FlexRow","jsx","jsxs","FlexCol","useEffect","useMemo","useRef","useState","Fragment","jsx","jsxs","FlexCol","CancelRounded","Button","Card","CardHeader","IconButton","Paper","styled","Identicon","Fragment","jsx","jsxs","jsx","useRef","Button"]}
|
|
1
|
+
{"version":3,"sources":["../../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":["import { asArchivistInstance, isArchivistInstance } from '@xyo-network/archivist-model'\nimport { asDivinerInstance, isDivinerInstance } from '@xyo-network/diviner-model'\nimport type { ModuleInstance } from '@xyo-network/module-model'\nimport { ArchivistCard } from '@xyo-network/react-archivist'\nimport { DivinerCard, ModuleCard } from '@xyo-network/react-module'\nimport React from 'react'\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport type { ModuleInstance } from '@xyo-network/module-model'\nimport React, { useRef } from 'react'\n\nimport { CytoscapeInstanceProvider } from '../../../contexts/index.ts'\nimport {\n useElements, useModuleDetails, useRelationalGraphOptions,\n} from '../../../hooks/index.ts'\nimport { WithExtensions } from '../../cytoscape-extensions/index.ts'\nimport { NodeRelationalGraphFlexBox } from '../../relational/index.ts'\nimport { DetailsFlexbox } from './DetailsFlexbox.tsx'\nimport { ModuleGraphNodeHover } from './node/index.ts'\nimport { StyledModuleHoverPopper } from './Popper.tsx'\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> = ({\n hideActions, rootModule, disableModuleDetails, ...props\n}) => {\n const cytoscapeRef = useRef<HTMLDivElement>(null)\n const {\n handleToggleLabels, hideLabels, options,\n } = useRelationalGraphOptions(rootModule ?? undefined)\n const {\n hoveredNode, setHoveredNode, toggleSelectedElement,\n } = useElements(hideLabels)\n\n const { mod, onModuleDetails } = useModuleDetails(rootModule, () => setHoveredNode(undefined))\n\n return (\n <WithExtensions>\n <NodeRelationalGraphFlexBox\n actions={\n mod\n ? null\n : hideActions\n ? null\n : (\n <Button size=\"small\" onClick={handleToggleLabels} variant=\"contained\">\n Toggle Labels\n </Button>\n )\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 '@xylabs/react-shared'\n\nimport type { CytoscapeInstanceState } from './State.ts'\n\nexport const CytoscapeInstanceContext = createContextEx<CytoscapeInstanceState>()\n","import type { Core } from 'cytoscape'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo, useState } from 'react'\n\nimport { CytoscapeInstanceContext } from './Context.ts'\nimport type { CytoscapeInstanceState } from './State.ts'\n\nexport interface CytoscapeInstanceProviderProps extends PropsWithChildren {\n defaultInstance?: WeakRef<Core>\n}\n\nexport const CytoscapeInstanceProvider: React.FC<CytoscapeInstanceProviderProps> = ({ children, defaultInstance }) => {\n const [cy, setCy] = useState<WeakRef<Core> | undefined>(() => defaultInstance)\n\n const value: CytoscapeInstanceState = useMemo(() => ({\n cy, provided: true, setCy,\n }), [cy, setCy])\n\n return (\n <CytoscapeInstanceContext value={value}>\n {children}\n </CytoscapeInstanceContext>\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { CytoscapeInstanceContext } from './Context.ts'\n\nexport const useCytoscapeInstance = (required = false) => useContextEx(CytoscapeInstanceContext, 'CytoscapeInstance', required)\n","import type { EventUnsubscribeFunction } from '@xylabs/events'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type { ModuleInstance } from '@xyo-network/module-model'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport type { ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { CytoscapeElements } from '../../../Cytoscape/index.ts'\n\nexport const useCytoscapeElements = (mod?: WeakRef<ModuleInstance> | null) => {\n const [elements, setElements] = useState<ElementDefinition[]>([])\n\n useAsyncEffect(\n\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 { isFalsy } from '@xylabs/typeof'\nimport type { ModuleInstance } from '@xyo-network/module-model'\nimport type { ElementDefinition } from 'cytoscape'\n\nimport { parseModuleType } from './lib/index.ts'\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\n ? CytoscapeElements.buildEdge(root, newNode, { depth: info.depth, siblingCount: info.children.length })\n : 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 (isFalsy(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 = {\n children: [], depth, mod: root,\n }\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 { isDefined } from '@xylabs/typeof'\nimport type { ReactElement } from 'react'\n// eslint-disable-next-line import-x/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 (isDefined(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}${globalThis.encodeURIComponent(svgElement.outerHTML)}`\n}\n","import type { CyNodeModuleTypes } from './CyNodeModuleTypes.ts'\n\nexport const generateIconMap: () => Record<CyNodeModuleTypes, string> = () => ({\n archivist: '',\n bridge: '',\n diviner: '',\n\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 type { LayoutOptions } from 'cytoscape'\n\nexport const ConcentricLayout: LayoutOptions = {\n concentric: function (node) {\n return node.degree(false)\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 type { 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 type { CyNodeModuleTypes } from './CyNodeModuleTypes.ts'\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 }\n }\n return type\n}\n","import type { SvgIconComponent } from '@mui/icons-material'\nimport {\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'\n\nimport type { CyNodeModuleTypes } from './lib/index.ts'\n\nexport const CyIconSet: Record<CyNodeModuleTypes, SvgIconComponent> = {\n archivist: Inventory2RoundedIcon,\n bridge: InsertLinkRoundedIcon,\n diviner: BubbleChartRoundedIcon,\n\n module: QuestionMarkRoundedIcon,\n node: HubIcon,\n sentinel: TimerRoundedIcon,\n witness: VisibilityRoundedIcon,\n}\n","import type { StylesheetCSS } from 'cytoscape'\n\nimport type { CyNodeModuleTypes } from './lib/index.ts'\n\nexport const NodeWithName = (color?: string, outlineColor?: string): StylesheetCSS => ({\n selector: 'node[name]',\n css: {\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): StylesheetCSS => ({\n selector: 'node',\n css: {\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): StylesheetCSS => ({\n selector: '.activeNode',\n css: { 'background-color': bgColor },\n})\n\nexport const EdgeStyled = (lineColor?: string, targetArrowColor?: string): StylesheetCSS => ({\n selector: 'edge',\n css: {\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 type { NodeCollection, NodeSingular } from 'cytoscape'\nimport type { Dispatch, SetStateAction } from 'react'\nimport {\n useCallback, useEffect, useState,\n} from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts/index.ts'\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 type { NodeSingular } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { useCytoscapeElements } from './useCytoscapeElements.ts'\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 type { ElementDefinition } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts/index.ts'\nimport { ColaLayout } from '../../../Cytoscape/index.ts'\n\nexport const useRenderNewElements = (newElements: ElementDefinition[] = [], hideLabels?: boolean) => {\n const { cy } = useCytoscapeInstance(true)\n\n return useMemo(() => {\n if (newElements.length > 1) {\n const renderedElements = cy?.deref()?.add(newElements)\n cy?.deref()?.layout(ColaLayout).run()\n return renderedElements\n }\n }, [cy, hideLabels, newElements])\n}\n","import type { NodeSingular } from 'cytoscape'\nimport { useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../../contexts/index.ts'\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.tsx'\nimport { useNewElements } from './useNewElements.tsx'\nimport { useRenderNewElements } from './useRenderNewElements.tsx'\nimport { useSelectedElement } from './useSelectedElement.tsx'\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 {\n hoveredNode, setHoveredNode, toggleSelectedElement,\n }\n}\n","import { isDefined } from '@xylabs/typeof'\nimport type { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape/index.ts'\nimport { useCytoscapeStyle } from './useCytoscapeStyle.tsx'\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 && isDefined(resolvedLayout) && isDefined(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 { useIsDark } from '@xylabs/react-theme'\nimport type { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport {\n EdgeStyled, Node, NodeAsRoot, NodeWithName,\n} from '../../Cytoscape/index.ts'\nimport { useIcons } from './useIcons.tsx'\n\nexport const useCytoscapeStyle = (hideLabels = false) => {\n const theme = useTheme()\n const dark = useIsDark()\n const icons = useIcons()\n\n const style: CytoscapeOptions['style'] = useMemo(\n // eslint-disable-next-line complexity\n () => [\n Node(icons, dark ? theme.colorSchemes.dark?.palette.primary.main : theme.colorSchemes.light?.palette.primary.main, hideLabels),\n NodeWithName(\n dark ? theme.colorSchemes.dark?.palette.primary.contrastText : theme.colorSchemes.light?.palette.primary.contrastText,\n dark ? theme.colorSchemes.dark?.palette.text.primary : theme.colorSchemes.light?.palette.text.primary,\n ),\n NodeAsRoot(dark ? theme.colorSchemes.dark?.palette.secondary.main : theme.colorSchemes.light?.palette.secondary.main),\n EdgeStyled(\n dark ? theme.colorSchemes.dark?.palette.divider : theme.colorSchemes.light?.palette.divider,\n dark ? theme.colorSchemes.dark?.palette.divider : theme.colorSchemes.light?.palette.divider,\n ),\n ],\n [icons, hideLabels, theme],\n )\n\n return style\n}\n","import { useTheme } from '@mui/material'\nimport React, { useMemo } from 'react'\n\nimport type { CyNodeModuleTypes } from '../../Cytoscape/index.ts'\nimport {\n CyIconSet, encodeSvg, generateIconMap,\n} from '../../Cytoscape/index.ts'\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.vars.palette.primary.contrastText)\n return acc\n }, iconMap)\n }, [theme.palette])\n\n return icons\n}\n","import { usePromise } from '@xylabs/react-promise'\nimport {\n isDefined, isDefinedNotNull, isTruthy,\n} from '@xylabs/typeof'\nimport type { ModuleInstance } from '@xyo-network/module-model'\nimport {\n useCallback, useEffect, useState,\n} from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts/index.ts'\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 (isDefined(moduleAddress) && isDefined(rootModuleInstance)) {\n const foundModule = await rootModuleInstance.resolve(moduleAddress)\n return foundModule ?? null\n }\n }, [moduleAddress, rootModule])\n\n const createObserver = useCallback(() => {\n return 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 }, [cy, moduleAddress, foundModule])\n\n useEffect(() => {\n const resizeObserver = createObserver()\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, createObserver])\n\n // eslint-disable-next-line complexity\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 (isTruthy(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 = isDefinedNotNull(foundModuleNode) && foundModuleNode.length > 0 ? foundModuleNode : rootModuleNode\n activeNode?.toggleClass('activeNode', true)\n }\n setModuleAddress(address)\n }\n\n return { mod: foundModule, onModuleDetails }\n}\n","import type { ModuleInstance } from '@xyo-network/module-model'\nimport { useState } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape/index.ts'\nimport { useCytoscapeElements } from './elements/index.ts'\nimport { useCytoscapeOptions } from './useCytoscapeOptions.ts'\nimport { useCytoscapeStyle } from './useCytoscapeStyle.tsx'\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 {\n handleToggleLabels, hideLabels, options,\n }\n}\n","import cytoscape from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport coseBilkent from 'cytoscape-cose-bilkent'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo } from 'react'\n\nexport const WithExtensions: React.FC<PropsWithChildren> = ({ children }) => {\n const initialized = useMemo(() => {\n cytoscape.use(cola)\n cytoscape.use(coseBilkent)\n return true\n }, [])\n\n return <>{initialized ? children : undefined}</>\n}\n","import type { CardProps } from '@mui/material'\nimport {\n Box, Button, ButtonGroup, Card, CardHeader, Paper, useTheme,\n} from '@mui/material'\nimport type { Address } from '@xylabs/hex'\nimport { asAddress } from '@xylabs/hex'\nimport {\n FlexCol, FlexGrowRow, FlexRow,\n} from '@xylabs/react-flexbox'\nimport { Identicon } from '@xylabs/react-identicon'\nimport { isDefined } from '@xylabs/typeof'\nimport { useWeakModuleFromNode } from '@xyo-network/react-node'\nimport type { Core, NodeSingular } from 'cytoscape'\nimport cytoscape from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport coseBilkentLayout from 'cytoscape-cose-bilkent'\nimport euler from 'cytoscape-euler'\nimport React, {\n useEffect, useRef, useState,\n} from 'react'\n\nimport type { NodeRelationalGraphProps } from '../../lib/index.ts'\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 'cose-bilkent': {\n cytoscape.use(coseBilkentLayout)\n break\n }\n case 'cola': {\n cytoscape.use(cola)\n break\n }\n case 'euler': {\n cytoscape.use(euler)\n break\n }\n }\n}\n\ntype ModuleHoverDetailsProps = CardProps & {\n address: Address\n name: string\n}\n\nconst ModuleHoverDetails: React.FC<ModuleHoverDetailsProps> = ({\n name, address, ...props\n}) => {\n return (\n <Card elevation={3} {...props}>\n <CardHeader\n avatar={(\n <Paper\n elevation={6}\n sx={{ bgcolor: '#fff', p: 1 }}\n >\n <Identicon value={address} size={24} />\n </Paper>\n )}\n title={name}\n subheader={address}\n />\n </Card>\n )\n}\n\nexport const NodeRelationalGraphFlexBox: React.FC<NodeRelationalGraphProps> = ({\n actions, children, node, layout, layoutOptions, showDetails, detail, options, onHover, ...props\n}) => {\n const theme = useTheme()\n const [cy, setCy] = useState<Core>()\n const cytoscapeRef = useRef<HTMLDivElement>(null)\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 (isDefined(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 // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n setCy(newCy)\n } else {\n newCy?.destroy()\n // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n setCy(undefined)\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\" {...props}>\n {hoverAddress && hoverPosition\n ? (\n <Box position=\"absolute\" top={hoverPosition.y1} left={hoverPosition.x1} zIndex={100}>\n <ModuleHoverDetails address={hoverAddress} name={moduleInstance?.deref()?.id ?? 'Unknown'} />\n </Box>\n )\n : null}\n <FlexRow justifyContent=\"start\" width=\"100%\">\n {actions === null\n ? null\n : isDefined(actions)\n ? (\n <ButtonGroup>\n {actions}\n <Button size=\"small\" variant=\"contained\" onClick={handleReset}>\n Reset View\n </Button>\n </ButtonGroup>\n )\n : (\n <Button size=\"small\" variant=\"contained\" onClick={handleReset}>\n Reset\n </Button>\n )}\n </FlexRow>\n <FlexGrowRow width=\"100%\" alignItems=\"start\">\n {showDetails\n ? (\n <FlexCol height=\"100%\" width=\"85%\">\n {detail}\n </FlexCol>\n )\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.vars.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\nNodeRelationalGraphFlexBox.displayName = 'NodeRelationalGraph'\n\n/** @deprecated */\nexport const NodeRelationalGraph = NodeRelationalGraphFlexBox\n","import type { AccountInstance } from '@xyo-network/account-model'\nimport type { NodeInstance } from '@xyo-network/node-model'\nimport { useWeakProvidedNode } from '@xyo-network/react-node'\nimport React from 'react'\n\nimport { useCytoscapeElements, useCytoscapeOptions } from '../../../hooks/index.ts'\nimport type { NodeRelationalGraphProps } from '../../lib/index.ts'\nimport { NodeRelationalGraphFlexBox } from './Graph.tsx'\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\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 type { PopperProps } from '@mui/material'\nimport { styled } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { NodeSingular } from 'cytoscape'\nimport type { ReactElement } from 'react'\nimport React from 'react'\n\nimport { useNodeElement } from './hooks/index.ts'\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 {\n boundingBox, ref, currentElement,\n } = 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 cursor: 'pointer',\n pointerEvents: 'none',\n position: 'absolute',\n}))\n","import type { PopperProps } from '@mui/material'\nimport type { NodeSingular } from 'cytoscape'\nimport {\n useEffect, useMemo, useRef, useState,\n} 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 useMemo(() => {\n setCurrentElement(null)\n }, [node])\n\n useMemo(() => {\n setBoundingBox(node?.renderedBoundingBox())\n }, [node])\n\n useEffect(() => {\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 useMemo(() => {\n setCurrentElement(ref.current)\n }, [boundingBox])\n\n return {\n boundingBox, currentElement, ref,\n }\n}\n","import { CancelRounded } from '@mui/icons-material'\nimport type { PopperProps } from '@mui/material'\nimport {\n Button, Card, CardActions, CardHeader, IconButton, Paper, Popper, styled,\n} from '@mui/material'\nimport { Identicon } from '@xylabs/react-identicon'\nimport type { NodeSingular } from 'cytoscape'\nimport React from 'react'\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> = ({\n anchorEl, onClose, onModuleDetails, onModuleExplore, node, ...props\n}) => {\n const { address, name } = node?.data() ?? {}\n return (\n <>\n {anchorEl\n ? (\n <Popper anchorEl={anchorEl} {...props}>\n <Card elevation={3}>\n <CardHeader\n action={\n onClose\n ? (\n <IconButton size=\"small\" onClick={onClose}>\n <CancelRounded />\n </IconButton>\n )\n : null\n }\n avatar={(\n <Paper\n elevation={6}\n sx={{ bgcolor: '#fff', p: 1 }}\n >\n <Identicon value={address} size={24} />\n </Paper>\n )}\n title={name}\n subheader={address}\n />\n <StyledCardActions>\n {onModuleDetails\n ? (\n <Button onClick={() => onModuleDetails?.(address)} size=\"small\" variant=\"contained\">\n Details\n </Button>\n )\n : null}\n {onModuleExplore\n ? (\n <Button onClick={() => onModuleExplore?.(address)} size=\"small\" variant=\"contained\">\n Explore\n </Button>\n )\n : null}\n </StyledCardActions>\n </Card>\n </Popper>\n )\n : null}\n </>\n )\n}\n\nexport const StyledModuleHoverPopper = styled(ModuleHoverPopper, { name: 'StyledComponents' })(() => ({ zIndex: 2 }))\n\nexport const StyledCardActions = styled(CardActions, { name: 'StyledCardActions' })(() => ({\n display: 'flex',\n justifyContent: 'center',\n}))\n"],"mappings":";AAAA,SAAS,qBAAqB,2BAA2B;AACzD,SAAS,mBAAmB,yBAAyB;AAErD,SAAS,qBAAqB;AAC9B,SAAS,aAAa,kBAAkB;AAU3B;AAHN,IAAM,mBAAoD,CAAC,EAAE,IAAI,MAAM;AAC5E,UAAQ,MAAM;AAAA,IACZ,KAAK,oBAAoB,GAAG,GAAG;AAC7B,aAAO,oBAAC,iBAAc,KAAK,oBAAoB,GAAG,GAAG;AAAA,IACvD;AAAA,IACA,KAAK,kBAAkB,GAAG,GAAG;AAC3B,aAAO,oBAAC,eAAY,KAAK,kBAAkB,GAAG,GAAG;AAAA,IACnD;AAAA,IACA,SAAS;AACP,aAAO,oBAAC,cAAW,KAAU;AAAA,IAC/B;AAAA,EACF;AACF;;;ACvBA,SAAS,UAAAA,eAAc;AAGvB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AA,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,WAAU;AAAA,UACV,MAAI;AAAA;AAAA,MACN,GAEJ;AAAA;AAAA,EACF,GACF;AAEJ;AAEO,IAAM,iCAAoE,CAAC,UAAU;AAC1F,SACE,gBAAAA,MAAC,6BACC,0BAAAA,MAAC,sBAAoB,GAAG,OAAO,GACjC;AAEJ;","names":["Button","useRef","jsx","isNodeInstance","useState","isArchivistInstance","isDivinerInstance","useState","isNodeInstance","useEffect","useState","useState","useEffect","useMemo","useMemo","selectedAddress","useMemo","useMemo","useState","useState","isDefined","useMemo","useTheme","useMemo","useMemo","jsx","useMemo","useTheme","useMemo","useMemo","isDefined","isDefined","useCallback","useEffect","useState","useState","isDefined","foundModule","useCallback","useEffect","useState","useState","useMemo","jsx","useTheme","isDefined","useWeakModuleFromNode","cytoscape","cola","useEffect","useState","jsx","jsx","FlexRow","jsx","jsxs","FlexCol","useEffect","useMemo","useRef","useState","Fragment","jsx","jsxs","FlexCol","CancelRounded","Button","Card","CardHeader","IconButton","Paper","styled","Identicon","Fragment","jsx","jsxs","jsx","useRef","Button"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-node-renderer",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -45,33 +45,35 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@xylabs/exists": "~5.0.11",
|
|
47
47
|
"@xylabs/hex": "~5.0.11",
|
|
48
|
-
"@xylabs/react-async-effect": "~7.0
|
|
49
|
-
"@xylabs/react-flexbox": "~7.0
|
|
50
|
-
"@xylabs/react-identicon": "~7.0
|
|
51
|
-
"@xylabs/react-promise": "~7.0
|
|
52
|
-
"@xylabs/react-shared": "~7.0
|
|
53
|
-
"@xylabs/react-theme": "~7.0
|
|
48
|
+
"@xylabs/react-async-effect": "~7.1.0",
|
|
49
|
+
"@xylabs/react-flexbox": "~7.1.0",
|
|
50
|
+
"@xylabs/react-identicon": "~7.1.0",
|
|
51
|
+
"@xylabs/react-promise": "~7.1.0",
|
|
52
|
+
"@xylabs/react-shared": "~7.1.0",
|
|
53
|
+
"@xylabs/react-theme": "~7.1.0",
|
|
54
|
+
"@xylabs/typeof": "~5.0.11",
|
|
54
55
|
"@xyo-network/account-model": "~5.1.2",
|
|
55
56
|
"@xyo-network/archivist-model": "~5.1.2",
|
|
56
57
|
"@xyo-network/bridge-model": "~5.1.2",
|
|
57
58
|
"@xyo-network/diviner-model": "~5.1.2",
|
|
58
59
|
"@xyo-network/module-model": "~5.1.2",
|
|
59
60
|
"@xyo-network/node-model": "~5.1.2",
|
|
60
|
-
"@xyo-network/react-archivist": "^7.
|
|
61
|
-
"@xyo-network/react-module": "^7.
|
|
62
|
-
"@xyo-network/react-node": "^7.
|
|
61
|
+
"@xyo-network/react-archivist": "^7.3.1",
|
|
62
|
+
"@xyo-network/react-module": "^7.3.1",
|
|
63
|
+
"@xyo-network/react-node": "^7.3.1",
|
|
63
64
|
"@xyo-network/sentinel-model": "~5.1.2",
|
|
64
65
|
"@xyo-network/witness-model": "~5.1.2",
|
|
65
66
|
"cytoscape": "~3.33.1",
|
|
66
67
|
"cytoscape-cola": "~2.5.1",
|
|
67
|
-
"cytoscape-cose-bilkent": "~4.1.0"
|
|
68
|
+
"cytoscape-cose-bilkent": "~4.1.0",
|
|
69
|
+
"cytoscape-euler": "~1.2.3"
|
|
68
70
|
},
|
|
69
71
|
"devDependencies": {
|
|
70
72
|
"@mui/icons-material": "~7.3.2",
|
|
71
73
|
"@mui/material": "~7.3.2",
|
|
72
|
-
"@storybook/react-vite": "~9.1.
|
|
74
|
+
"@storybook/react-vite": "~9.1.7",
|
|
73
75
|
"@types/cytoscape": "~3.21.9",
|
|
74
|
-
"@types/react": "~19.1.
|
|
76
|
+
"@types/react": "~19.1.13",
|
|
75
77
|
"@types/react-dom": "~19.1.9",
|
|
76
78
|
"@xylabs/events": "~5.0.11",
|
|
77
79
|
"@xylabs/ts-scripts-yarn3": "~7.1.7",
|
|
@@ -84,21 +86,23 @@
|
|
|
84
86
|
"@xyo-network/bridge-model": "~5.1.2",
|
|
85
87
|
"@xyo-network/id-plugin": "~5.1.0",
|
|
86
88
|
"@xyo-network/node-memory": "~5.1.2",
|
|
87
|
-
"@xyo-network/react-storybook": "^7.
|
|
88
|
-
"@xyo-network/react-wallet": "^7.
|
|
89
|
+
"@xyo-network/react-storybook": "^7.3.1",
|
|
90
|
+
"@xyo-network/react-wallet": "^7.3.1",
|
|
89
91
|
"@xyo-network/sentinel": "~5.1.2",
|
|
90
92
|
"@xyo-network/sentinel-memory": "~5.1.2",
|
|
91
93
|
"react": "~19.1.1",
|
|
92
94
|
"react-dom": "~19.1.1",
|
|
93
|
-
"
|
|
95
|
+
"react-router-dom": "^7",
|
|
96
|
+
"storybook": "~9.1.7",
|
|
94
97
|
"typescript": "~5.9.2",
|
|
95
|
-
"vite": "~7.1.
|
|
98
|
+
"vite": "~7.1.7"
|
|
96
99
|
},
|
|
97
100
|
"peerDependencies": {
|
|
98
101
|
"@mui/icons-material": ">=6 <8",
|
|
99
102
|
"@mui/material": ">=6 <8",
|
|
100
103
|
"react": "~19",
|
|
101
|
-
"react-dom": "~19"
|
|
104
|
+
"react-dom": "~19",
|
|
105
|
+
"react-router-dom": "^7"
|
|
102
106
|
},
|
|
103
107
|
"publishConfig": {
|
|
104
108
|
"access": "public"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { exists } from '@xylabs/exists'
|
|
2
|
+
import { isFalsy } from '@xylabs/typeof'
|
|
2
3
|
import type { ModuleInstance } from '@xyo-network/module-model'
|
|
3
4
|
import type { ElementDefinition } from 'cytoscape'
|
|
4
5
|
|
|
@@ -67,7 +68,7 @@ export const CytoscapeElements = {
|
|
|
67
68
|
},
|
|
68
69
|
|
|
69
70
|
normalizeName(name?: string) {
|
|
70
|
-
if (
|
|
71
|
+
if (isFalsy(name)) return
|
|
71
72
|
if (name.length > this.MaxNameLength) return `${name.slice(0, 20)}...`
|
|
72
73
|
return name
|
|
73
74
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDefined } from '@xylabs/typeof'
|
|
1
2
|
import type { ReactElement } from 'react'
|
|
2
3
|
// eslint-disable-next-line import-x/no-internal-modules
|
|
3
4
|
import { renderToStaticMarkup } from 'react-dom/server'
|
|
@@ -9,7 +10,7 @@ export const encodeSvg = (reactElement: ReactElement, color?: string) => {
|
|
|
9
10
|
|
|
10
11
|
const doc = new DOMParser().parseFromString(svgString, 'text/html')
|
|
11
12
|
const svgElement = doc.querySelectorAll('svg')[0]
|
|
12
|
-
if (svgElement) {
|
|
13
|
+
if (isDefined(svgElement)) {
|
|
13
14
|
svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')
|
|
14
15
|
svgElement.setAttribute('height', '100')
|
|
15
16
|
svgElement.style.fill = color ?? 'black'
|
|
@@ -8,11 +8,13 @@ import {
|
|
|
8
8
|
FlexCol, FlexGrowRow, FlexRow,
|
|
9
9
|
} from '@xylabs/react-flexbox'
|
|
10
10
|
import { Identicon } from '@xylabs/react-identicon'
|
|
11
|
+
import { isDefined } from '@xylabs/typeof'
|
|
11
12
|
import { useWeakModuleFromNode } from '@xyo-network/react-node'
|
|
12
13
|
import type { Core, NodeSingular } from 'cytoscape'
|
|
13
14
|
import cytoscape from 'cytoscape'
|
|
14
15
|
import cola from 'cytoscape-cola'
|
|
15
16
|
import coseBilkentLayout from 'cytoscape-cose-bilkent'
|
|
17
|
+
import euler from 'cytoscape-euler'
|
|
16
18
|
import React, {
|
|
17
19
|
useEffect, useRef, useState,
|
|
18
20
|
} from 'react'
|
|
@@ -33,6 +35,10 @@ const loadLayout = (layout = 'cola') => {
|
|
|
33
35
|
cytoscape.use(cola)
|
|
34
36
|
break
|
|
35
37
|
}
|
|
38
|
+
case 'euler': {
|
|
39
|
+
cytoscape.use(euler)
|
|
40
|
+
break
|
|
41
|
+
}
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -79,7 +85,7 @@ export const NodeRelationalGraphFlexBox: React.FC<NodeRelationalGraphProps> = ({
|
|
|
79
85
|
const bb = cyNode?.renderedBoundingBox?.()
|
|
80
86
|
setHoverBoundingBox(bb)
|
|
81
87
|
const id = cyNode.id?.()
|
|
82
|
-
if (id) {
|
|
88
|
+
if (isDefined(id)) {
|
|
83
89
|
if (id.includes('/')) {
|
|
84
90
|
setHoverAddress(undefined)
|
|
85
91
|
onHover?.()
|
|
@@ -136,7 +142,7 @@ export const NodeRelationalGraphFlexBox: React.FC<NodeRelationalGraphProps> = ({
|
|
|
136
142
|
<FlexRow justifyContent="start" width="100%">
|
|
137
143
|
{actions === null
|
|
138
144
|
? null
|
|
139
|
-
: actions
|
|
145
|
+
: isDefined(actions)
|
|
140
146
|
? (
|
|
141
147
|
<ButtonGroup>
|
|
142
148
|
{actions}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDefined } from '@xylabs/typeof'
|
|
1
2
|
import type { CytoscapeOptions } from 'cytoscape'
|
|
2
3
|
import { useMemo } from 'react'
|
|
3
4
|
|
|
@@ -15,7 +16,7 @@ export const useCytoscapeOptions = (
|
|
|
15
16
|
const resolvedStyle = style ?? defaultStyle
|
|
16
17
|
|
|
17
18
|
const options = useMemo<CytoscapeOptions | undefined>(() => {
|
|
18
|
-
if (elements && resolvedLayout && resolvedStyle) {
|
|
19
|
+
if (elements && isDefined(resolvedLayout) && isDefined(resolvedStyle)) {
|
|
19
20
|
return {
|
|
20
21
|
elements,
|
|
21
22
|
layout: resolvedLayout,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { usePromise } from '@xylabs/react-promise'
|
|
2
|
+
import {
|
|
3
|
+
isDefined, isDefinedNotNull, isTruthy,
|
|
4
|
+
} from '@xylabs/typeof'
|
|
2
5
|
import type { ModuleInstance } from '@xyo-network/module-model'
|
|
3
6
|
import {
|
|
4
7
|
useCallback, useEffect, useState,
|
|
@@ -13,7 +16,7 @@ export const useModuleDetails = (rootModule?: WeakRef<ModuleInstance> | null, on
|
|
|
13
16
|
const [foundModule] = usePromise(async () => {
|
|
14
17
|
if (moduleAddress === null) return null
|
|
15
18
|
const rootModuleInstance = rootModule?.deref()
|
|
16
|
-
if (moduleAddress && rootModuleInstance) {
|
|
19
|
+
if (isDefined(moduleAddress) && isDefined(rootModuleInstance)) {
|
|
17
20
|
const foundModule = await rootModuleInstance.resolve(moduleAddress)
|
|
18
21
|
return foundModule ?? null
|
|
19
22
|
}
|
|
@@ -63,14 +66,14 @@ export const useModuleDetails = (rootModule?: WeakRef<ModuleInstance> | null, on
|
|
|
63
66
|
const foundModuleNode = cy?.deref()?.nodes(`[id="${foundModule?.address}"]`)
|
|
64
67
|
const notModuleNode = cy?.deref()?.nodes(`[id != "${address}"]`)
|
|
65
68
|
|
|
66
|
-
if (address) {
|
|
69
|
+
if (isTruthy(address)) {
|
|
67
70
|
// address was passed so we set the node to active styles
|
|
68
71
|
moduleNode?.toggleClass('activeNode', true)
|
|
69
72
|
notModuleNode?.toggleClass('activeNode', false)
|
|
70
73
|
} else {
|
|
71
74
|
// no address was passes so we reset the state
|
|
72
75
|
notModuleNode?.toggleClass('activeNode', false)
|
|
73
|
-
const activeNode = foundModuleNode
|
|
76
|
+
const activeNode = isDefinedNotNull(foundModuleNode) && foundModuleNode.length > 0 ? foundModuleNode : rootModuleNode
|
|
74
77
|
activeNode?.toggleClass('activeNode', true)
|
|
75
78
|
}
|
|
76
79
|
setModuleAddress(address)
|