@xyo-network/react-node-renderer 2.64.3 → 2.64.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/components/ProvidedNodeRenderer.cjs +7 -5
- package/dist/browser/components/ProvidedNodeRenderer.cjs.map +1 -1
- package/dist/browser/components/ProvidedNodeRenderer.js +8 -6
- package/dist/browser/components/ProvidedNodeRenderer.js.map +1 -1
- package/dist/browser/components/RelationalGraph.cjs +2 -2
- package/dist/browser/components/RelationalGraph.cjs.map +1 -1
- package/dist/browser/components/RelationalGraph.d.cts.map +1 -1
- package/dist/browser/components/RelationalGraph.d.mts.map +1 -1
- package/dist/browser/components/RelationalGraph.d.ts.map +1 -1
- package/dist/browser/components/RelationalGraph.js +3 -3
- package/dist/browser/components/RelationalGraph.js.map +1 -1
- package/dist/browser/components/index.cjs +104 -82
- package/dist/browser/components/index.cjs.map +1 -1
- package/dist/browser/components/index.js +93 -71
- package/dist/browser/components/index.js.map +1 -1
- package/dist/browser/components/module/graph/GraphFlexBox.cjs +103 -81
- package/dist/browser/components/module/graph/GraphFlexBox.cjs.map +1 -1
- package/dist/browser/components/module/graph/GraphFlexBox.d.cts +1 -0
- package/dist/browser/components/module/graph/GraphFlexBox.d.cts.map +1 -1
- package/dist/browser/components/module/graph/GraphFlexBox.d.mts +1 -0
- package/dist/browser/components/module/graph/GraphFlexBox.d.mts.map +1 -1
- package/dist/browser/components/module/graph/GraphFlexBox.d.ts +1 -0
- package/dist/browser/components/module/graph/GraphFlexBox.d.ts.map +1 -1
- package/dist/browser/components/module/graph/GraphFlexBox.js +92 -70
- package/dist/browser/components/module/graph/GraphFlexBox.js.map +1 -1
- package/dist/browser/components/module/graph/NodeHover.cjs +17 -10
- package/dist/browser/components/module/graph/NodeHover.cjs.map +1 -1
- package/dist/browser/components/module/graph/NodeHover.d.cts.map +1 -1
- package/dist/browser/components/module/graph/NodeHover.d.mts.map +1 -1
- package/dist/browser/components/module/graph/NodeHover.d.ts.map +1 -1
- package/dist/browser/components/module/graph/NodeHover.js +20 -13
- package/dist/browser/components/module/graph/NodeHover.js.map +1 -1
- package/dist/browser/components/module/graph/Popper.cjs +2 -2
- package/dist/browser/components/module/graph/Popper.cjs.map +1 -1
- package/dist/browser/components/module/graph/Popper.d.cts +1 -1
- package/dist/browser/components/module/graph/Popper.d.cts.map +1 -1
- package/dist/browser/components/module/graph/Popper.d.mts +1 -1
- package/dist/browser/components/module/graph/Popper.d.mts.map +1 -1
- package/dist/browser/components/module/graph/Popper.d.ts +1 -1
- package/dist/browser/components/module/graph/Popper.d.ts.map +1 -1
- package/dist/browser/components/module/graph/Popper.js +3 -3
- package/dist/browser/components/module/graph/Popper.js.map +1 -1
- package/dist/browser/components/module/graph/index.cjs +103 -81
- package/dist/browser/components/module/graph/index.cjs.map +1 -1
- package/dist/browser/components/module/graph/index.js +92 -70
- package/dist/browser/components/module/graph/index.js.map +1 -1
- package/dist/browser/components/module/index.cjs +103 -81
- package/dist/browser/components/module/index.cjs.map +1 -1
- package/dist/browser/components/module/index.js +92 -70
- package/dist/browser/components/module/index.js.map +1 -1
- package/dist/browser/hooks/cytoscape/index.cjs +5 -3
- package/dist/browser/hooks/cytoscape/index.cjs.map +1 -1
- package/dist/browser/hooks/cytoscape/index.js +5 -3
- package/dist/browser/hooks/cytoscape/index.js.map +1 -1
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.cjs +5 -3
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.cjs.map +1 -1
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.d.cts.map +1 -1
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.d.mts.map +1 -1
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.d.ts.map +1 -1
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.js +5 -3
- package/dist/browser/hooks/cytoscape/useCytoscapeOptions.js.map +1 -1
- package/dist/browser/hooks/cytoscape/useRelationalGraphOptions.cjs +5 -3
- package/dist/browser/hooks/cytoscape/useRelationalGraphOptions.cjs.map +1 -1
- package/dist/browser/hooks/cytoscape/useRelationalGraphOptions.js +5 -3
- package/dist/browser/hooks/cytoscape/useRelationalGraphOptions.js.map +1 -1
- package/dist/browser/hooks/index.cjs +5 -3
- package/dist/browser/hooks/index.cjs.map +1 -1
- package/dist/browser/hooks/index.js +5 -3
- package/dist/browser/hooks/index.js.map +1 -1
- package/dist/browser/index.cjs +107 -82
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +1 -0
- package/dist/browser/index.d.cts.map +1 -1
- package/dist/browser/index.d.mts +1 -0
- package/dist/browser/index.d.mts.map +1 -1
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +96 -71
- package/dist/browser/index.js.map +1 -1
- package/dist/docs.json +1747 -1151
- package/dist/node/components/ProvidedNodeRenderer.cjs +7 -5
- package/dist/node/components/ProvidedNodeRenderer.cjs.map +1 -1
- package/dist/node/components/ProvidedNodeRenderer.js +8 -6
- package/dist/node/components/ProvidedNodeRenderer.js.map +1 -1
- package/dist/node/components/RelationalGraph.cjs +2 -2
- package/dist/node/components/RelationalGraph.cjs.map +1 -1
- package/dist/node/components/RelationalGraph.d.cts.map +1 -1
- package/dist/node/components/RelationalGraph.d.mts.map +1 -1
- package/dist/node/components/RelationalGraph.d.ts.map +1 -1
- package/dist/node/components/RelationalGraph.js +3 -3
- package/dist/node/components/RelationalGraph.js.map +1 -1
- package/dist/node/components/index.cjs +105 -82
- package/dist/node/components/index.cjs.map +1 -1
- package/dist/node/components/index.js +93 -71
- package/dist/node/components/index.js.map +1 -1
- package/dist/node/components/module/graph/GraphFlexBox.cjs +105 -82
- package/dist/node/components/module/graph/GraphFlexBox.cjs.map +1 -1
- package/dist/node/components/module/graph/GraphFlexBox.d.cts +1 -0
- package/dist/node/components/module/graph/GraphFlexBox.d.cts.map +1 -1
- package/dist/node/components/module/graph/GraphFlexBox.d.mts +1 -0
- package/dist/node/components/module/graph/GraphFlexBox.d.mts.map +1 -1
- package/dist/node/components/module/graph/GraphFlexBox.d.ts +1 -0
- package/dist/node/components/module/graph/GraphFlexBox.d.ts.map +1 -1
- package/dist/node/components/module/graph/GraphFlexBox.js +92 -70
- package/dist/node/components/module/graph/GraphFlexBox.js.map +1 -1
- package/dist/node/components/module/graph/NodeHover.cjs +17 -10
- package/dist/node/components/module/graph/NodeHover.cjs.map +1 -1
- package/dist/node/components/module/graph/NodeHover.d.cts.map +1 -1
- package/dist/node/components/module/graph/NodeHover.d.mts.map +1 -1
- package/dist/node/components/module/graph/NodeHover.d.ts.map +1 -1
- package/dist/node/components/module/graph/NodeHover.js +20 -13
- package/dist/node/components/module/graph/NodeHover.js.map +1 -1
- package/dist/node/components/module/graph/Popper.cjs +2 -2
- package/dist/node/components/module/graph/Popper.cjs.map +1 -1
- package/dist/node/components/module/graph/Popper.d.cts +1 -1
- package/dist/node/components/module/graph/Popper.d.cts.map +1 -1
- package/dist/node/components/module/graph/Popper.d.mts +1 -1
- package/dist/node/components/module/graph/Popper.d.mts.map +1 -1
- package/dist/node/components/module/graph/Popper.d.ts +1 -1
- package/dist/node/components/module/graph/Popper.d.ts.map +1 -1
- package/dist/node/components/module/graph/Popper.js +3 -3
- package/dist/node/components/module/graph/Popper.js.map +1 -1
- package/dist/node/components/module/graph/index.cjs +105 -82
- package/dist/node/components/module/graph/index.cjs.map +1 -1
- package/dist/node/components/module/graph/index.js +92 -70
- package/dist/node/components/module/graph/index.js.map +1 -1
- package/dist/node/components/module/index.cjs +105 -82
- package/dist/node/components/module/index.cjs.map +1 -1
- package/dist/node/components/module/index.js +92 -70
- package/dist/node/components/module/index.js.map +1 -1
- package/dist/node/hooks/cytoscape/index.cjs +5 -3
- package/dist/node/hooks/cytoscape/index.cjs.map +1 -1
- package/dist/node/hooks/cytoscape/index.js +5 -3
- package/dist/node/hooks/cytoscape/index.js.map +1 -1
- package/dist/node/hooks/cytoscape/useCytoscapeOptions.cjs +5 -3
- package/dist/node/hooks/cytoscape/useCytoscapeOptions.cjs.map +1 -1
- package/dist/node/hooks/cytoscape/useCytoscapeOptions.d.cts.map +1 -1
- package/dist/node/hooks/cytoscape/useCytoscapeOptions.d.mts.map +1 -1
- package/dist/node/hooks/cytoscape/useCytoscapeOptions.d.ts.map +1 -1
- package/dist/node/hooks/cytoscape/useCytoscapeOptions.js +5 -3
- package/dist/node/hooks/cytoscape/useCytoscapeOptions.js.map +1 -1
- package/dist/node/hooks/cytoscape/useRelationalGraphOptions.cjs +5 -3
- package/dist/node/hooks/cytoscape/useRelationalGraphOptions.cjs.map +1 -1
- package/dist/node/hooks/cytoscape/useRelationalGraphOptions.js +5 -3
- package/dist/node/hooks/cytoscape/useRelationalGraphOptions.js.map +1 -1
- package/dist/node/hooks/index.cjs +5 -3
- package/dist/node/hooks/index.cjs.map +1 -1
- package/dist/node/hooks/index.js +5 -3
- package/dist/node/hooks/index.js.map +1 -1
- package/dist/node/index.cjs +111 -82
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +1 -0
- package/dist/node/index.d.cts.map +1 -1
- package/dist/node/index.d.mts +1 -0
- package/dist/node/index.d.mts.map +1 -1
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +96 -71
- package/dist/node/index.js.map +1 -1
- package/package.json +8 -8
- package/src/components/RelationalGraph.stories.tsx +4 -1
- package/src/components/RelationalGraph.tsx +14 -6
- package/src/components/module/graph/GraphFlexBox.stories.tsx +7 -10
- package/src/components/module/graph/GraphFlexBox.tsx +9 -0
- package/src/components/module/graph/NodeHover.tsx +31 -19
- package/src/components/module/graph/Popper.tsx +14 -10
- package/src/hooks/cytoscape/useCytoscapeOptions.ts +6 -3
- package/src/index.ts +1 -0
|
@@ -30,15 +30,35 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/components/module/graph/GraphFlexBox.tsx
|
|
31
31
|
var GraphFlexBox_exports = {};
|
|
32
32
|
__export(GraphFlexBox_exports, {
|
|
33
|
-
ModuleGraphFlexBox: () => ModuleGraphFlexBox
|
|
33
|
+
ModuleGraphFlexBox: () => ModuleGraphFlexBox,
|
|
34
|
+
ModuleGraphFlexBoxWithProvider: () => ModuleGraphFlexBoxWithProvider
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(GraphFlexBox_exports);
|
|
36
37
|
var import_material5 = require("@mui/material");
|
|
37
38
|
|
|
39
|
+
// src/contexts/CytoscapeInstance/Context.ts
|
|
40
|
+
var import_react_shared = require("@xyo-network/react-shared");
|
|
41
|
+
var CytoscapeInstanceContext = (0, import_react_shared.createContextEx)();
|
|
42
|
+
|
|
43
|
+
// src/contexts/CytoscapeInstance/Provider.tsx
|
|
44
|
+
var import_react = require("react");
|
|
45
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
+
var CytoscapeInstanceProvider = ({ children, defaultInstance }) => {
|
|
47
|
+
const [cy, setCy] = (0, import_react.useState)(defaultInstance);
|
|
48
|
+
(0, import_react.useEffect)(() => {
|
|
49
|
+
setCy(defaultInstance);
|
|
50
|
+
}, [defaultInstance]);
|
|
51
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CytoscapeInstanceContext.Provider, { value: { cy, provided: true, setCy }, children });
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/contexts/CytoscapeInstance/use.ts
|
|
55
|
+
var import_react_shared2 = require("@xyo-network/react-shared");
|
|
56
|
+
var useCytoscapeInstance = (required = false) => (0, import_react_shared2.useContextEx)(CytoscapeInstanceContext, "CytoscapeInstance", required);
|
|
57
|
+
|
|
38
58
|
// src/hooks/cytoscape/useCytoscapeElements.ts
|
|
39
59
|
var import_react_async_effect = require("@xylabs/react-async-effect");
|
|
40
60
|
var import_node_model3 = require("@xyo-network/node-model");
|
|
41
|
-
var
|
|
61
|
+
var import_react2 = require("react");
|
|
42
62
|
|
|
43
63
|
// src/Cytoscape/CytoscapeElements.ts
|
|
44
64
|
var import_node_model2 = require("@xyo-network/node-model");
|
|
@@ -243,7 +263,7 @@ var EdgeStyled = (lineColor, targetArrowColor) => ({
|
|
|
243
263
|
|
|
244
264
|
// src/hooks/cytoscape/useCytoscapeElements.ts
|
|
245
265
|
var useCytoscapeElements = (module2) => {
|
|
246
|
-
const [elements, setElements] = (0,
|
|
266
|
+
const [elements, setElements] = (0, import_react2.useState)([]);
|
|
247
267
|
(0, import_react_async_effect.useAsyncEffect)(
|
|
248
268
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
249
269
|
async () => {
|
|
@@ -254,7 +274,7 @@ var useCytoscapeElements = (module2) => {
|
|
|
254
274
|
},
|
|
255
275
|
[module2]
|
|
256
276
|
);
|
|
257
|
-
(0,
|
|
277
|
+
(0, import_react2.useEffect)(() => {
|
|
258
278
|
let attachedListener = void 0;
|
|
259
279
|
let detachedListener = void 0;
|
|
260
280
|
if (module2 && (0, import_node_model3.isNodeInstance)(module2)) {
|
|
@@ -276,22 +296,22 @@ var useCytoscapeElements = (module2) => {
|
|
|
276
296
|
};
|
|
277
297
|
|
|
278
298
|
// src/hooks/cytoscape/useCytoscapeOptions.ts
|
|
279
|
-
var
|
|
299
|
+
var import_react5 = require("react");
|
|
280
300
|
|
|
281
301
|
// src/hooks/cytoscape/useCytoscapeStyle.tsx
|
|
282
302
|
var import_material2 = require("@mui/material");
|
|
283
|
-
var
|
|
303
|
+
var import_react4 = require("react");
|
|
284
304
|
|
|
285
305
|
// src/hooks/cytoscape/useIcons.tsx
|
|
286
306
|
var import_material = require("@mui/material");
|
|
287
|
-
var
|
|
288
|
-
var
|
|
307
|
+
var import_react3 = require("react");
|
|
308
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
289
309
|
var useIcons = () => {
|
|
290
310
|
const theme = (0, import_material.useTheme)();
|
|
291
|
-
const icons = (0,
|
|
311
|
+
const icons = (0, import_react3.useMemo)(() => {
|
|
292
312
|
const iconMap = generateIconMap();
|
|
293
313
|
return Object.entries(CyIconSet).reduce((acc, [name, IconComponent]) => {
|
|
294
|
-
const icon = /* @__PURE__ */ (0,
|
|
314
|
+
const icon = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconComponent, { fontSize: "small" });
|
|
295
315
|
acc[name] = encodeSvg(icon, theme.palette.getContrastText(theme.palette.text.primary));
|
|
296
316
|
return acc;
|
|
297
317
|
}, iconMap);
|
|
@@ -303,7 +323,7 @@ var useIcons = () => {
|
|
|
303
323
|
var useCytoscapeStyle = (hideLabels = false) => {
|
|
304
324
|
const theme = (0, import_material2.useTheme)();
|
|
305
325
|
const icons = useIcons();
|
|
306
|
-
const style = (0,
|
|
326
|
+
const style = (0, import_react4.useMemo)(
|
|
307
327
|
() => [
|
|
308
328
|
NodeIdStyles(theme.palette.text.primary, theme.palette.getContrastText(theme.palette.text.primary)),
|
|
309
329
|
NodeStyled(icons, theme.palette.primary.main, hideLabels),
|
|
@@ -317,12 +337,14 @@ var useCytoscapeStyle = (hideLabels = false) => {
|
|
|
317
337
|
// src/hooks/cytoscape/useCytoscapeOptions.ts
|
|
318
338
|
var useCytoscapeOptions = (elements, style, layout) => {
|
|
319
339
|
const defaultStyle = useCytoscapeStyle();
|
|
320
|
-
const
|
|
321
|
-
|
|
340
|
+
const resolvedLayout = layout ?? ConcentricLayout;
|
|
341
|
+
const resolvedStyle = style ?? defaultStyle;
|
|
342
|
+
const options = (0, import_react5.useMemo)(() => {
|
|
343
|
+
if (elements && resolvedLayout && resolvedStyle) {
|
|
322
344
|
return {
|
|
323
345
|
elements,
|
|
324
|
-
layout:
|
|
325
|
-
style:
|
|
346
|
+
layout: resolvedLayout,
|
|
347
|
+
style: resolvedStyle
|
|
326
348
|
};
|
|
327
349
|
}
|
|
328
350
|
}, [elements, layout, style]);
|
|
@@ -330,21 +352,11 @@ var useCytoscapeOptions = (elements, style, layout) => {
|
|
|
330
352
|
};
|
|
331
353
|
|
|
332
354
|
// src/hooks/cytoscape/useHoveredNode.tsx
|
|
333
|
-
var
|
|
334
|
-
|
|
335
|
-
// src/contexts/CytoscapeInstance/Context.ts
|
|
336
|
-
var import_react_shared = require("@xyo-network/react-shared");
|
|
337
|
-
var CytoscapeInstanceContext = (0, import_react_shared.createContextEx)();
|
|
338
|
-
|
|
339
|
-
// src/contexts/CytoscapeInstance/use.ts
|
|
340
|
-
var import_react_shared2 = require("@xyo-network/react-shared");
|
|
341
|
-
var useCytoscapeInstance = (required = false) => (0, import_react_shared2.useContextEx)(CytoscapeInstanceContext, "CytoscapeInstance", required);
|
|
342
|
-
|
|
343
|
-
// src/hooks/cytoscape/useHoveredNode.tsx
|
|
355
|
+
var import_react6 = require("react");
|
|
344
356
|
var useHoveredNode = (renderedElements) => {
|
|
345
357
|
const { cy } = useCytoscapeInstance(true);
|
|
346
|
-
const [hoveredNode, setHoveredNode] = (0,
|
|
347
|
-
const nodeListener = (0,
|
|
358
|
+
const [hoveredNode, setHoveredNode] = (0, import_react6.useState)();
|
|
359
|
+
const nodeListener = (0, import_react6.useCallback)((node) => {
|
|
348
360
|
node.on("mouseover tap", () => {
|
|
349
361
|
setHoveredNode(node);
|
|
350
362
|
});
|
|
@@ -352,12 +364,12 @@ var useHoveredNode = (renderedElements) => {
|
|
|
352
364
|
setHoveredNode(void 0);
|
|
353
365
|
});
|
|
354
366
|
}, []);
|
|
355
|
-
(0,
|
|
367
|
+
(0, import_react6.useEffect)(() => {
|
|
356
368
|
if (renderedElements) {
|
|
357
369
|
renderedElements.nodes().forEach(nodeListener);
|
|
358
370
|
}
|
|
359
371
|
}, [nodeListener, renderedElements]);
|
|
360
|
-
(0,
|
|
372
|
+
(0, import_react6.useEffect)(() => {
|
|
361
373
|
cy == null ? void 0 : cy.ready(() => {
|
|
362
374
|
cy.nodes().forEach(nodeListener);
|
|
363
375
|
});
|
|
@@ -367,13 +379,13 @@ var useHoveredNode = (renderedElements) => {
|
|
|
367
379
|
|
|
368
380
|
// src/hooks/cytoscape/useNewElements.tsx
|
|
369
381
|
var import_react_node = require("@xyo-network/react-node");
|
|
370
|
-
var
|
|
382
|
+
var import_react7 = require("react");
|
|
371
383
|
var useNewElements = (selectedElement) => {
|
|
372
384
|
const { cy } = useCytoscapeInstance(true);
|
|
373
385
|
const { address: selectedAddress } = (selectedElement == null ? void 0 : selectedElement.data()) ?? {};
|
|
374
386
|
const [module2] = (0, import_react_node.useModuleFromNode)(selectedAddress);
|
|
375
387
|
const newElements = useCytoscapeElements(module2);
|
|
376
|
-
(0,
|
|
388
|
+
(0, import_react7.useEffect)(() => {
|
|
377
389
|
if (selectedAddress) {
|
|
378
390
|
const element = cy == null ? void 0 : cy.$(`node[id="${selectedAddress}"]`);
|
|
379
391
|
if (element == null ? void 0 : element.length)
|
|
@@ -384,9 +396,9 @@ var useNewElements = (selectedElement) => {
|
|
|
384
396
|
};
|
|
385
397
|
|
|
386
398
|
// src/hooks/cytoscape/useRelationalGraphOptions.tsx
|
|
387
|
-
var
|
|
399
|
+
var import_react8 = require("react");
|
|
388
400
|
var useRelationalGraphOptions = (module2) => {
|
|
389
|
-
const [hideLabels, setHideLabels] = (0,
|
|
401
|
+
const [hideLabels, setHideLabels] = (0, import_react8.useState)(true);
|
|
390
402
|
const handleToggleLabels = () => {
|
|
391
403
|
setHideLabels((oldValue) => !oldValue);
|
|
392
404
|
};
|
|
@@ -397,11 +409,11 @@ var useRelationalGraphOptions = (module2) => {
|
|
|
397
409
|
};
|
|
398
410
|
|
|
399
411
|
// src/hooks/cytoscape/useRenderNewElements.tsx
|
|
400
|
-
var
|
|
412
|
+
var import_react9 = require("react");
|
|
401
413
|
var useRenderNewElements = (newElements = [], hideLabels) => {
|
|
402
414
|
const { cy } = useCytoscapeInstance(true);
|
|
403
|
-
const [renderedElements, setRenderedElements] = (0,
|
|
404
|
-
(0,
|
|
415
|
+
const [renderedElements, setRenderedElements] = (0, import_react9.useState)();
|
|
416
|
+
(0, import_react9.useEffect)(() => {
|
|
405
417
|
if (newElements.length > 1) {
|
|
406
418
|
const renderedElements2 = cy == null ? void 0 : cy.add(newElements);
|
|
407
419
|
setRenderedElements(renderedElements2);
|
|
@@ -412,11 +424,11 @@ var useRenderNewElements = (newElements = [], hideLabels) => {
|
|
|
412
424
|
};
|
|
413
425
|
|
|
414
426
|
// src/hooks/cytoscape/useSelectedElement.tsx
|
|
415
|
-
var
|
|
427
|
+
var import_react10 = require("react");
|
|
416
428
|
var useSelectedElement = () => {
|
|
417
429
|
const { cy } = useCytoscapeInstance(true);
|
|
418
|
-
const [selectedElement, setSelectedElement] = (0,
|
|
419
|
-
(0,
|
|
430
|
+
const [selectedElement, setSelectedElement] = (0, import_react10.useState)();
|
|
431
|
+
(0, import_react10.useEffect)(() => {
|
|
420
432
|
const listener = (event) => {
|
|
421
433
|
const element = event.target[0];
|
|
422
434
|
if (element.isNode())
|
|
@@ -433,15 +445,15 @@ var useSelectedElement = () => {
|
|
|
433
445
|
// src/components/cytoscape-extensions/WithExtensions.tsx
|
|
434
446
|
var import_cytoscape = require("cytoscape");
|
|
435
447
|
var import_cytoscape_cola = __toESM(require("cytoscape-cola"), 1);
|
|
436
|
-
var
|
|
437
|
-
var
|
|
448
|
+
var import_react11 = require("react");
|
|
449
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
438
450
|
var WithExtensions = ({ children }) => {
|
|
439
|
-
const [initialized, setInitialized] = (0,
|
|
440
|
-
(0,
|
|
451
|
+
const [initialized, setInitialized] = (0, import_react11.useState)(false);
|
|
452
|
+
(0, import_react11.useEffect)(() => {
|
|
441
453
|
(0, import_cytoscape.use)(import_cytoscape_cola.default);
|
|
442
454
|
setInitialized(true);
|
|
443
455
|
}, []);
|
|
444
|
-
return /* @__PURE__ */ (0,
|
|
456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: initialized ? children : void 0 });
|
|
445
457
|
};
|
|
446
458
|
|
|
447
459
|
// src/components/RelationalGraph.tsx
|
|
@@ -449,17 +461,17 @@ var import_material3 = require("@mui/material");
|
|
|
449
461
|
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
450
462
|
var import_react_shared3 = require("@xyo-network/react-shared");
|
|
451
463
|
var import_cytoscape2 = __toESM(require("cytoscape"), 1);
|
|
452
|
-
var
|
|
453
|
-
var
|
|
454
|
-
var NodeRelationalGraphFlexBox = (0,
|
|
455
|
-
const [cy, setCy] = (0,
|
|
464
|
+
var import_react12 = require("react");
|
|
465
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
466
|
+
var NodeRelationalGraphFlexBox = (0, import_react12.forwardRef)(({ actions, children, options, ...props }, ref) => {
|
|
467
|
+
const [cy, setCy] = (0, import_react12.useState)();
|
|
456
468
|
const { setCy: setCyContext } = useCytoscapeInstance();
|
|
457
469
|
const sharedRef = (0, import_react_shared3.useShareForwardedRef)(ref);
|
|
458
470
|
const handleReset = () => {
|
|
459
471
|
cy == null ? void 0 : cy.reset();
|
|
460
472
|
cy == null ? void 0 : cy.fit(void 0, 20);
|
|
461
473
|
};
|
|
462
|
-
(0,
|
|
474
|
+
(0, import_react12.useEffect)(() => {
|
|
463
475
|
if (sharedRef) {
|
|
464
476
|
const newCy = (0, import_cytoscape2.default)({
|
|
465
477
|
container: sharedRef.current,
|
|
@@ -468,15 +480,15 @@ var NodeRelationalGraphFlexBox = (0, import_react11.forwardRef)(({ actions, chil
|
|
|
468
480
|
setCy(newCy);
|
|
469
481
|
}
|
|
470
482
|
}, [options, sharedRef]);
|
|
471
|
-
(0,
|
|
483
|
+
(0, import_react12.useEffect)(() => {
|
|
472
484
|
setCyContext == null ? void 0 : setCyContext(cy);
|
|
473
485
|
}, [cy, setCyContext]);
|
|
474
|
-
return /* @__PURE__ */ (0,
|
|
475
|
-
/* @__PURE__ */ (0,
|
|
486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_flexbox.FlexCol, { ...props, children: [
|
|
487
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionsContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: actions ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material3.ButtonGroup, { children: [
|
|
476
488
|
actions,
|
|
477
|
-
/* @__PURE__ */ (0,
|
|
478
|
-
] }) }),
|
|
479
|
-
/* @__PURE__ */ (0,
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Button, { size: "small", variant: "contained", onClick: handleReset, children: "Reset" })
|
|
490
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material3.Button, { size: "small", variant: "contained", onClick: handleReset, children: "Reset" }) }) }),
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_flexbox.FlexCol, { alignItems: "stretch", height: "100%", position: "absolute", ref: sharedRef, width: "100%" }),
|
|
480
492
|
children
|
|
481
493
|
] });
|
|
482
494
|
});
|
|
@@ -491,34 +503,37 @@ var ActionsContainer = (0, import_material3.styled)(import_react_flexbox.FlexRow
|
|
|
491
503
|
}));
|
|
492
504
|
|
|
493
505
|
// src/components/module/graph/NodeHover.tsx
|
|
494
|
-
var
|
|
506
|
+
var import_react_flexbox3 = require("@xylabs/react-flexbox");
|
|
507
|
+
var import_react13 = require("react");
|
|
495
508
|
|
|
496
509
|
// src/components/module/graph/Popper.tsx
|
|
497
510
|
var import_material4 = require("@mui/material");
|
|
498
511
|
var import_react_flexbox2 = require("@xylabs/react-flexbox");
|
|
499
512
|
var import_react_identicon = require("@xylabs/react-identicon");
|
|
500
|
-
var
|
|
513
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
501
514
|
var ModuleHoverPopper = ({ address, element, name, ...props }) => {
|
|
502
|
-
return /* @__PURE__ */ (0,
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
504
|
-
/* @__PURE__ */ (0,
|
|
505
|
-
/* @__PURE__ */ (0,
|
|
515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: element ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material4.Popper, { anchorEl: element, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_flexbox2.FlexCol, { gap: 2, p: 2, paper: true, sx: { backgroundColor: (theme) => (0, import_material4.alpha)(theme.palette.background.paper, 0.95) }, children: [
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_flexbox2.FlexRow, { gap: 2, children: [
|
|
517
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_identicon.Identicon, { value: address, size: 24 }),
|
|
518
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material4.Typography, { children: name })
|
|
506
519
|
] }),
|
|
507
|
-
/* @__PURE__ */ (0,
|
|
508
|
-
] }) });
|
|
520
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material4.Chip, { label: address, color: "primary" })
|
|
521
|
+
] }) }) : null });
|
|
509
522
|
};
|
|
510
523
|
|
|
511
524
|
// src/components/module/graph/NodeHover.tsx
|
|
512
|
-
var
|
|
525
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
513
526
|
var ModuleGraphNodeHover = ({ node }) => {
|
|
514
527
|
const { address, name } = (node == null ? void 0 : node.data()) ?? {};
|
|
515
|
-
const [boundingBox, setBoundingBox] = (0,
|
|
516
|
-
const ref = (0,
|
|
517
|
-
const [currentEl, setCurrentEl] = (0,
|
|
518
|
-
(0,
|
|
519
|
-
|
|
528
|
+
const [boundingBox, setBoundingBox] = (0, import_react13.useState)(node == null ? void 0 : node.renderedBoundingBox());
|
|
529
|
+
const ref = (0, import_react13.useRef)(null);
|
|
530
|
+
const [currentEl, setCurrentEl] = (0, import_react13.useState)(null);
|
|
531
|
+
(0, import_react13.useEffect)(() => {
|
|
532
|
+
setCurrentEl(null);
|
|
533
|
+
}, [node]);
|
|
534
|
+
(0, import_react13.useEffect)(() => {
|
|
535
|
+
if (node) {
|
|
520
536
|
setBoundingBox(node.renderedBoundingBox());
|
|
521
|
-
setCurrentEl(ref.current);
|
|
522
537
|
}
|
|
523
538
|
const listener = () => {
|
|
524
539
|
setBoundingBox(node == null ? void 0 : node.renderedBoundingBox());
|
|
@@ -528,12 +543,16 @@ var ModuleGraphNodeHover = ({ node }) => {
|
|
|
528
543
|
node == null ? void 0 : node.off("position", void 0, listener);
|
|
529
544
|
};
|
|
530
545
|
}, [node]);
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
546
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
547
|
+
setCurrentEl(ref.current);
|
|
548
|
+
}, [boundingBox]);
|
|
549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
550
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
551
|
+
import_react_flexbox3.FlexCol,
|
|
534
552
|
{
|
|
535
553
|
ref,
|
|
536
|
-
|
|
554
|
+
sx: {
|
|
555
|
+
// For easier debugging of the 'ghost' element that matches the hovered cytoscape node
|
|
537
556
|
// backgroundColor: '#fff',
|
|
538
557
|
// opacity: 0.25,
|
|
539
558
|
cursor: "pointer",
|
|
@@ -546,30 +565,34 @@ var ModuleGraphNodeHover = ({ node }) => {
|
|
|
546
565
|
}
|
|
547
566
|
}
|
|
548
567
|
),
|
|
549
|
-
/* @__PURE__ */ (0,
|
|
550
|
-
] })
|
|
568
|
+
node ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModuleHoverPopper, { address, element: currentEl, name, placement: "top", open: true }) }) : null
|
|
569
|
+
] });
|
|
551
570
|
};
|
|
552
571
|
|
|
553
572
|
// src/components/module/graph/GraphFlexBox.tsx
|
|
554
|
-
var
|
|
573
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
555
574
|
var ModuleGraphFlexBox = ({ rootModule, ...props }) => {
|
|
556
575
|
const { handleToggleLabels, hideLabels, options } = useRelationalGraphOptions(rootModule ?? void 0);
|
|
557
576
|
const selectedElement = useSelectedElement();
|
|
558
577
|
const newElements = useNewElements(selectedElement);
|
|
559
578
|
const renderedElements = useRenderNewElements(newElements, hideLabels);
|
|
560
579
|
const hoveredNode = useHoveredNode(renderedElements);
|
|
561
|
-
return /* @__PURE__ */ (0,
|
|
580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WithExtensions, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
562
581
|
NodeRelationalGraphFlexBox,
|
|
563
582
|
{
|
|
564
|
-
actions: /* @__PURE__ */ (0,
|
|
583
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.Button, { size: "small", onClick: handleToggleLabels, variant: "contained", children: "Toggle Labels" }),
|
|
565
584
|
options,
|
|
566
585
|
...props,
|
|
567
|
-
children: /* @__PURE__ */ (0,
|
|
586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModuleGraphNodeHover, { node: hoveredNode })
|
|
568
587
|
}
|
|
569
588
|
) });
|
|
570
589
|
};
|
|
590
|
+
var ModuleGraphFlexBoxWithProvider = (props) => {
|
|
591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CytoscapeInstanceProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModuleGraphFlexBox, { ...props }) });
|
|
592
|
+
};
|
|
571
593
|
// Annotate the CommonJS export names for ESM import in node:
|
|
572
594
|
0 && (module.exports = {
|
|
573
|
-
ModuleGraphFlexBox
|
|
595
|
+
ModuleGraphFlexBox,
|
|
596
|
+
ModuleGraphFlexBoxWithProvider
|
|
574
597
|
});
|
|
575
598
|
//# sourceMappingURL=GraphFlexBox.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/module/graph/GraphFlexBox.tsx","../../../../../src/hooks/cytoscape/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/useCytoscapeOptions.ts","../../../../../src/hooks/cytoscape/useCytoscapeStyle.tsx","../../../../../src/hooks/cytoscape/useIcons.tsx","../../../../../src/hooks/cytoscape/useHoveredNode.tsx","../../../../../src/contexts/CytoscapeInstance/Context.ts","../../../../../src/contexts/CytoscapeInstance/use.ts","../../../../../src/hooks/cytoscape/useNewElements.tsx","../../../../../src/hooks/cytoscape/useRelationalGraphOptions.tsx","../../../../../src/hooks/cytoscape/useRenderNewElements.tsx","../../../../../src/hooks/cytoscape/useSelectedElement.tsx","../../../../../src/components/cytoscape-extensions/WithExtensions.tsx","../../../../../src/components/RelationalGraph.tsx","../../../../../src/components/module/graph/NodeHover.tsx","../../../../../src/components/module/graph/Popper.tsx"],"sourcesContent":["import { Button } from '@mui/material'\nimport { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { ModuleInstance } from '@xyo-network/module'\n\nimport { useHoveredNode, useNewElements, useRelationalGraphOptions, useRenderNewElements, useSelectedElement } from '../../../hooks'\nimport { WithExtensions } from '../../cytoscape-extensions'\nimport { NodeRelationalGraphFlexBox } from '../../RelationalGraph'\nimport { ModuleGraphNodeHover } from './NodeHover'\n\nexport interface ModuleGraphFlexBoxProps extends FlexBoxProps {\n rootModule?: ModuleInstance | null\n}\n\nexport const ModuleGraphFlexBox: React.FC<ModuleGraphFlexBoxProps> = ({ rootModule, ...props }) => {\n const { handleToggleLabels, hideLabels, options } = useRelationalGraphOptions(rootModule ?? undefined)\n const selectedElement = useSelectedElement()\n const newElements = useNewElements(selectedElement)\n const renderedElements = useRenderNewElements(newElements, hideLabels)\n const hoveredNode = useHoveredNode(renderedElements)\n\n return (\n <WithExtensions>\n <NodeRelationalGraphFlexBox\n actions={\n <Button size={'small'} onClick={handleToggleLabels} variant=\"contained\">\n Toggle Labels\n </Button>\n }\n options={options}\n {...props}\n >\n <ModuleGraphNodeHover node={hoveredNode} />\n </NodeRelationalGraphFlexBox>\n </WithExtensions>\n )\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { EventUnsubscribeFunction, ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { CytoscapeElements } from '../../Cytoscape'\n\nexport const useCytoscapeElements = (module?: ModuleInstance | null) => {\n const [elements, setElements] = useState<ElementDefinition[]>([])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async () => {\n if (module) {\n const newElements = (await CytoscapeElements.buildElements(module)) ?? []\n setElements(newElements)\n }\n },\n [module],\n )\n\n useEffect(() => {\n let attachedListener: EventUnsubscribeFunction | undefined = undefined\n let detachedListener: EventUnsubscribeFunction | undefined = undefined\n\n if (module && isNodeInstance(module)) {\n attachedListener = module.on('moduleAttached', async () => {\n const newElements = (await CytoscapeElements.buildElements(module)) ?? []\n setElements(newElements)\n })\n detachedListener = module.on('moduleDetached', async () => {\n const newElements = (await CytoscapeElements.buildElements(module)) ?? []\n setElements(newElements)\n })\n }\n\n return () => {\n attachedListener?.()\n detachedListener?.()\n }\n }, [module])\n\n return elements\n}\n","import { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { ElementDefinition } from 'cytoscape'\n\nimport { parseModuleType } from './lib'\n\nexport class CytoscapeElements {\n static MaxNameLength = 20\n\n static buildEdge(rootNode: ElementDefinition, newNode: ElementDefinition) {\n return {\n data: {\n id: `${rootNode.data.id}/${newNode.data.id}`,\n source: rootNode.data.id,\n target: newNode.data.id,\n },\n }\n }\n\n static async buildElements(module: ModuleInstance): Promise<ElementDefinition[]> {\n const newRootNode = CytoscapeElements.buildRootNode(module)\n const newElements: ElementDefinition[] = [newRootNode]\n\n try {\n const childElements = await CytoscapeElements.recurseNodes(module)\n childElements?.forEach((module) => {\n const newNode = CytoscapeElements.buildNode(module, newRootNode.data.id)\n newElements.push(newNode)\n\n const newEdge = CytoscapeElements.buildEdge(newRootNode, newNode)\n newElements.push(newEdge)\n })\n\n return newElements\n } catch (e) {\n console.error('error resolving modules', e)\n return []\n }\n }\n\n static buildNode(module: ModuleInstance, rootNodeId?: string): ElementDefinition {\n const { address, config } = module\n const normalizedName = config.name ?? address.substring(0, 8)\n return {\n data: {\n address,\n id: address,\n name: normalizedName,\n rootNodeId,\n type: parseModuleType(module),\n },\n }\n }\n\n static buildRootNode = (module: ModuleInstance): ElementDefinition => {\n return CytoscapeElements.buildNode(module)\n }\n\n static normalizeName(name?: string) {\n if (!name) return\n if (name.length > this.MaxNameLength) return `${name.substring(0, 20)}...`\n return name\n }\n\n static async recurseNodes(module: ModuleInstance, maxTraversals = 1): Promise<ModuleInstance[]> {\n let localDepth = 0\n const childModules: ModuleInstance[] = []\n\n const traverse = async (nestedNode: ModuleInstance) => {\n if (localDepth < maxTraversals) {\n const modules = await nestedNode.resolve(undefined, { direction: 'down', maxDepth: 2 })\n await Promise.all(\n modules.map(async (child) => {\n if (child !== nestedNode && isNodeInstance(child)) {\n localDepth++\n await traverse(child)\n // don't re add the root module that was passed in\n } else if (child !== module) {\n childModules.push(child)\n }\n }),\n )\n }\n }\n\n await traverse(module)\n\n return childModules\n }\n}\n","import { ReactElement } from 'react'\n// eslint-disable-next-line import/no-internal-modules\nimport { renderToStaticMarkup } from 'react-dom/server'\n\nconst dataUri = 'data:image/svg+xml,'\n\nexport const encodeSvg = (reactElement: ReactElement, color?: string) => {\n const svgString = renderToStaticMarkup(reactElement)\n\n const doc = new DOMParser().parseFromString(svgString, 'text/html')\n const svgElement = doc.getElementsByTagName('svg')[0]\n if (svgElement) {\n svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')\n svgElement.setAttribute('height', '100')\n svgElement.style.fill = color ?? 'black'\n }\n\n return `${dataUri}${window.encodeURIComponent(svgElement.outerHTML)}`\n}\n","import { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const generateIconMap: () => Record<CyNodeModuleTypes, string> = () => ({\n archivist: '',\n bridge: '',\n diviner: '',\n module: '',\n node: '',\n sentinel: '',\n witness: '',\n})\n","export const ColaLayout = {\n centerGraph: false,\n convergenceThreshold: 0.01,\n name: 'cola',\n}\n","import { LayoutOptions } from 'cytoscape'\n\nexport const ConcentricLayout: LayoutOptions = {\n concentric: function (node) {\n return node.degree()\n },\n levelWidth: function () {\n return 2\n },\n minNodeSpacing: 75,\n name: 'concentric',\n}\n","import { isArchivistInstance } from '@xyo-network/archivist-model'\nimport { isBridgeInstance } from '@xyo-network/bridge-model'\nimport { isDivinerInstance } from '@xyo-network/diviner-model'\nimport { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel'\nimport { isWitnessModule } from '@xyo-network/witness'\n\nimport { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const parseModuleType = (module?: ModuleInstance): CyNodeModuleTypes => {\n let type: CyNodeModuleTypes = 'module'\n if (module) {\n if (isArchivistInstance(module)) {\n type = 'archivist'\n } else if (isBridgeInstance(module)) {\n type = 'bridge'\n } else if (isDivinerInstance(module)) {\n type = 'diviner'\n } else if (isNodeInstance(module)) {\n type = 'node'\n } else if (isSentinelInstance(module)) {\n type = 'sentinel'\n } else if (isWitnessModule(module)) {\n type = 'witness'\n } else {\n type = 'module'\n }\n }\n return type\n}\n","import {\n BubbleChartRounded as BubbleChartRoundedIcon,\n Hub as HubIcon,\n InsertLinkRounded as InsertLinkRoundedIcon,\n Inventory2Rounded as Inventory2RoundedIcon,\n QuestionMarkRounded as QuestionMarkRoundedIcon,\n TimerRounded as TimerRoundedIcon,\n VisibilityRounded as VisibilityRoundedIcon,\n} from '@mui/icons-material'\nimport { SvgIconTypeMap } from '@mui/material'\nimport { OverridableComponent } from '@mui/material/OverridableComponent'\n\nimport { CyNodeModuleTypes } from './lib'\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport const CyIconSet: Record<CyNodeModuleTypes, OverridableComponent<SvgIconTypeMap<{}, 'svg'>>> = {\n archivist: Inventory2RoundedIcon,\n bridge: InsertLinkRoundedIcon,\n diviner: BubbleChartRoundedIcon,\n module: QuestionMarkRoundedIcon,\n node: HubIcon,\n sentinel: TimerRoundedIcon,\n witness: VisibilityRoundedIcon,\n}\n","import { Stylesheet } from 'cytoscape'\n\nimport { CyNodeModuleTypes } from './lib'\n\nexport const NodeIdStyles = (color?: string, outlineColor?: string): Stylesheet => ({\n selector: 'node[name]',\n style: {\n color,\n 'font-family': 'Lexend Deca, Helvetica, sans-serif',\n 'font-size': 12,\n 'overlay-padding': '6px',\n 'text-halign': 'center',\n 'text-outline-color': outlineColor,\n 'text-outline-width': '1px',\n 'text-valign': 'top',\n },\n})\n\nexport const NodeStyled = (icons: Record<CyNodeModuleTypes, string>, bgColor?: string, hideLabels = false): Stylesheet => ({\n selector: 'node',\n style: {\n 'background-color': bgColor,\n 'background-height': '75%',\n 'background-image': (elem) => icons[elem.data('type') as CyNodeModuleTypes],\n 'background-width': '24',\n label: hideLabels ? undefined : 'data(name)',\n shape: 'round-rectangle',\n },\n})\n\nexport const EdgeStyled = (lineColor?: string, targetArrowColor?: string) => ({\n selector: 'edge',\n style: {\n 'curve-style': 'bezier',\n 'line-color': lineColor,\n 'line-opacity': 0.1,\n 'target-arrow-color': targetArrowColor,\n 'target-arrow-shape': 'triangle',\n width: 3,\n },\n})\n","import { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape'\nimport { useCytoscapeStyle } from './useCytoscapeStyle'\n\nexport const useCytoscapeOptions = (\n elements: CytoscapeOptions['elements'],\n style?: CytoscapeOptions['style'],\n layout?: CytoscapeOptions['layout'],\n) => {\n const defaultStyle = useCytoscapeStyle()\n\n const options = useMemo<CytoscapeOptions | undefined>(() => {\n if (elements && layout && style) {\n return {\n elements,\n layout: layout ?? ConcentricLayout,\n style: style ?? defaultStyle,\n }\n }\n }, [elements, layout, style])\n\n return options\n}\n","import { useTheme } from '@mui/material'\nimport { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { EdgeStyled, NodeIdStyles, NodeStyled } from '../../Cytoscape'\nimport { useIcons } from './useIcons'\n\nexport const useCytoscapeStyle = (hideLabels = false) => {\n const theme = useTheme()\n const icons = useIcons()\n\n const style: CytoscapeOptions['style'] = useMemo(\n () => [\n NodeIdStyles(theme.palette.text.primary, theme.palette.getContrastText(theme.palette.text.primary)),\n NodeStyled(icons, theme.palette.primary.main, hideLabels),\n EdgeStyled(theme.palette.divider, theme.palette.divider),\n ],\n [icons, hideLabels, theme],\n )\n\n return style\n}\n","import { useTheme } from '@mui/material'\nimport { useMemo } from 'react'\n\nimport { CyIconSet, CyNodeModuleTypes, encodeSvg, generateIconMap } from '../../Cytoscape'\n\nexport const useIcons = () => {\n const theme = useTheme()\n const icons = useMemo(() => {\n const iconMap = generateIconMap()\n return Object.entries(CyIconSet).reduce((acc, [name, IconComponent]) => {\n const icon = <IconComponent fontSize=\"small\" />\n acc[name as CyNodeModuleTypes] = encodeSvg(icon, theme.palette.getContrastText(theme.palette.text.primary))\n return acc\n }, iconMap)\n }, [theme.palette])\n\n return icons\n}\n","import { NodeCollection, NodeSingular } from 'cytoscape'\nimport { useCallback, useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\n\nexport const useHoveredNode = (renderedElements?: NodeCollection) => {\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 node.on('mouseout', () => {\n setHoveredNode(undefined)\n })\n }, [])\n\n useEffect(() => {\n if (renderedElements) {\n renderedElements.nodes().forEach(nodeListener)\n }\n }, [nodeListener, renderedElements])\n\n useEffect(() => {\n cy?.ready(() => {\n cy.nodes().forEach(nodeListener)\n })\n }, [cy, nodeListener])\n\n return hoveredNode\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { CytoscapeInstanceState } from './State'\n\nexport const CytoscapeInstanceContext = createContextEx<CytoscapeInstanceState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { CytoscapeInstanceContext } from './Context'\n\nexport const useCytoscapeInstance = (required = false) => useContextEx(CytoscapeInstanceContext, 'CytoscapeInstance', required)\n","import { useModuleFromNode } from '@xyo-network/react-node'\nimport { NodeSingular } from 'cytoscape'\nimport { useEffect } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\nimport { useCytoscapeElements } from './useCytoscapeElements'\n\nexport const useNewElements = (selectedElement?: NodeSingular) => {\n const { cy } = useCytoscapeInstance(true)\n const { address: selectedAddress } = selectedElement?.data() ?? {}\n const [module] = useModuleFromNode(selectedAddress)\n const newElements = useCytoscapeElements(module)\n\n useEffect(() => {\n if (selectedAddress) {\n const element = cy?.$(`node[id=\"${selectedAddress}\"]`)\n if (element?.length) cy?.center(element)\n }\n }, [cy, selectedAddress])\n\n return newElements\n}\n","import { ModuleInstance } from '@xyo-network/module'\nimport { useState } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape'\nimport { useCytoscapeElements } from './useCytoscapeElements'\nimport { useCytoscapeOptions } from './useCytoscapeOptions'\nimport { useCytoscapeStyle } from './useCytoscapeStyle'\n\nexport const useRelationalGraphOptions = (module?: ModuleInstance) => {\n const [hideLabels, setHideLabels] = useState(true)\n\n const handleToggleLabels = () => {\n setHideLabels((oldValue) => !oldValue)\n }\n\n const elements = useCytoscapeElements(module)\n const style = useCytoscapeStyle(hideLabels)\n const options = useCytoscapeOptions(elements, style, ConcentricLayout)\n\n return { handleToggleLabels, hideLabels, options }\n}\n","import { CollectionReturnValue, ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\nimport { ColaLayout } from '../../Cytoscape'\n\nexport const useRenderNewElements = (newElements: ElementDefinition[] = [], hideLabels?: boolean) => {\n const { cy } = useCytoscapeInstance(true)\n const [renderedElements, setRenderedElements] = useState<CollectionReturnValue>()\n\n useEffect(() => {\n if (newElements.length > 1) {\n const renderedElements = cy?.add(newElements)\n setRenderedElements(renderedElements)\n cy?.layout(ColaLayout).run()\n }\n }, [cy, hideLabels, newElements])\n\n return renderedElements\n}\n","import { EventObject, NodeSingular } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\n\nexport const useSelectedElement = () => {\n const { cy } = useCytoscapeInstance(true)\n const [selectedElement, setSelectedElement] = useState<NodeSingular>()\n\n useEffect(() => {\n const listener = (event: EventObject) => {\n const element = event.target[0]\n if (element.isNode()) setSelectedElement(element)\n }\n cy?.on('select', listener)\n\n return () => {\n cy?.off('select', listener)\n }\n }, [cy, setSelectedElement])\n\n return selectedElement\n}\n","import { use } from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport { PropsWithChildren, useEffect, useState } from 'react'\n\nexport const WithExtensions: React.FC<PropsWithChildren> = ({ children }) => {\n const [initialized, setInitialized] = useState(false)\n useEffect(() => {\n use(cola)\n setInitialized(true)\n }, [])\n\n return <>{initialized ? children : undefined}</>\n}\n","import { Button, ButtonGroup, styled } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { useShareForwardedRef } from '@xyo-network/react-shared'\nimport cytoscape, { Core } from 'cytoscape'\nimport { forwardRef, useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../contexts'\nimport { NodeRelationalGraphProps } from './lib'\n\nexport const NodeRelationalGraphFlexBox = forwardRef<HTMLDivElement, NodeRelationalGraphProps>(({ actions, children, options, ...props }, ref) => {\n const [cy, setCy] = useState<Core>()\n const { setCy: setCyContext } = useCytoscapeInstance()\n const sharedRef = useShareForwardedRef(ref)\n\n const handleReset = () => {\n cy?.reset()\n cy?.fit(undefined, 20)\n }\n\n useEffect(() => {\n if (sharedRef) {\n const newCy = cytoscape({\n container: sharedRef.current,\n ...options,\n })\n setCy(newCy)\n }\n }, [options, sharedRef])\n\n useEffect(() => {\n setCyContext?.(cy)\n }, [cy, setCyContext])\n\n return (\n <FlexCol {...props}>\n <ActionsContainer>\n <ButtonGroup>\n {actions}\n <Button size={'small'} variant={'contained'} onClick={handleReset}>\n Reset\n </Button>\n </ButtonGroup>\n </ActionsContainer>\n {/* Cytoscape Element */}\n <FlexCol alignItems=\"stretch\" height=\"100%\" position=\"absolute\" ref={sharedRef} width=\"100%\"></FlexCol>\n {children}\n </FlexCol>\n )\n})\n\nNodeRelationalGraphFlexBox.displayName = 'NodeRelationalGraph'\n\nconst ActionsContainer = styled(FlexRow, { name: 'ActionsContainer' })(({ theme }) => ({\n flexWrap: 'wrap',\n gap: theme.spacing(1),\n position: 'absolute',\n right: '10px',\n top: '10px',\n zIndex: 2,\n}))\n\n/** @deprecated */\nexport const NodeRelationalGraph = NodeRelationalGraphFlexBox\n","import { NodeSingular } from 'cytoscape'\nimport { useLayoutEffect, useRef, useState } from 'react'\n\nimport { ModuleHoverPopper } from './Popper'\n\nexport interface ModuleHoverProps {\n node?: NodeSingular\n}\n\nexport const ModuleGraphNodeHover: React.FC<ModuleHoverProps> = ({ node }) => {\n const { address, name } = node?.data() ?? {}\n const [boundingBox, setBoundingBox] = useState(node?.renderedBoundingBox())\n const ref = useRef<HTMLDivElement>(null)\n const [currentEl, setCurrentEl] = useState<HTMLDivElement | null>(null)\n\n useLayoutEffect(() => {\n if (node && ref.current) {\n setBoundingBox(node.renderedBoundingBox())\n setCurrentEl(ref.current)\n }\n\n const listener = () => {\n setBoundingBox(node?.renderedBoundingBox())\n }\n\n node?.on('position', listener)\n\n return () => {\n node?.off('position', undefined, listener)\n }\n }, [node])\n\n return (\n <>\n {node ? (\n <>\n <div\n ref={ref}\n style={{\n // backgroundColor: '#fff',\n // opacity: 0.25,\n cursor: 'pointer',\n height: boundingBox?.h,\n left: boundingBox?.x1,\n pointerEvents: 'none',\n position: 'absolute',\n top: boundingBox?.y1,\n width: boundingBox?.w,\n }}\n ></div>\n <ModuleHoverPopper address={address} element={currentEl} name={name} placement={'top'} open />\n </>\n ) : null}\n </>\n )\n}\n","import { alpha, Chip, Popper, PopperProps, Theme, Typography } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { Identicon } from '@xylabs/react-identicon'\n\nexport interface ModuleHoverPopperProps extends PopperProps {\n address?: string\n element?: HTMLElement | null\n name?: string\n}\n\nexport const ModuleHoverPopper: React.FC<ModuleHoverPopperProps> = ({ address, element, name, ...props }) => {\n return (\n <Popper anchorEl={element} {...props}>\n <FlexCol gap={2} p={2} paper sx={{ backgroundColor: (theme: Theme) => alpha(theme.palette.background.paper, 0.95) }}>\n <FlexRow gap={2}>\n <Identicon value={address} size={24} />\n <Typography>{name}</Typography>\n </FlexRow>\n <Chip label={address} color={'primary'} />\n </FlexCol>\n </Popper>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAAuB;;;ACAvB,gCAA+B;AAE/B,IAAAC,qBAA+B;AAE/B,mBAAoC;;;ACHpC,IAAAC,qBAA+B;;;ACC/B,oBAAqC;AAErC,IAAM,UAAU;AAET,IAAM,YAAY,CAAC,cAA4B,UAAmB;AACvE,QAAM,gBAAY,oCAAqB,YAAY;AAEnD,QAAM,MAAM,IAAI,UAAU,EAAE,gBAAgB,WAAW,WAAW;AAClE,QAAM,aAAa,IAAI,qBAAqB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A,OAAO;AAAA;AAAA;AAAA,UAGL,QAAQ;AAAA,UACR,QAAQ,2CAAa;AAAA,UACrB,MAAM,2CAAa;AAAA,UACnB,eAAe;AAAA,UACf,UAAU;AAAA,UACV,KAAK,2CAAa;AAAA,UAClB,OAAO,2CAAa;AAAA,QACtB;AAAA;AAAA,IACD;AAAA,IACD,6CAAC,qBAAkB,SAAkB,SAAS,WAAW,MAAY,WAAW,OAAO,MAAI,MAAC;AAAA,KAC9F,IACE,MACN;AAEJ;;;AtB/BU,IAAAC,sBAAA;AAXH,IAAM,qBAAwD,CAAC,EAAE,YAAY,GAAG,MAAM,MAAM;AACjG,QAAM,EAAE,oBAAoB,YAAY,QAAQ,IAAI,0BAA0B,cAAc,MAAS;AACrG,QAAM,kBAAkB,mBAAmB;AAC3C,QAAM,cAAc,eAAe,eAAe;AAClD,QAAM,mBAAmB,qBAAqB,aAAa,UAAU;AACrE,QAAM,cAAc,eAAe,gBAAgB;AAEnD,SACE,6CAAC,kBACC;AAAA,IAAC;AAAA;AAAA,MACC,SACE,6CAAC,2BAAO,MAAM,SAAS,SAAS,oBAAoB,SAAQ,aAAY,2BAExE;AAAA,MAEF;AAAA,MACC,GAAG;AAAA,MAEJ,uDAAC,wBAAqB,MAAM,aAAa;AAAA;AAAA,EAC3C,GACF;AAEJ;","names":["import_material","import_node_model","import_node_model","module","module","Inventory2RoundedIcon","InsertLinkRoundedIcon","BubbleChartRoundedIcon","QuestionMarkRoundedIcon","HubIcon","TimerRoundedIcon","VisibilityRoundedIcon","module","import_react","import_material","import_react","import_react","import_react","import_react_shared","import_react","module","import_react","module","import_react","renderedElements","import_react","import_react","import_jsx_runtime","cola","import_material","import_react_shared","import_cytoscape","import_react","import_jsx_runtime","cytoscape","import_react","import_material","import_react_flexbox","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/module/graph/GraphFlexBox.tsx","../../../../../src/contexts/CytoscapeInstance/Context.ts","../../../../../src/contexts/CytoscapeInstance/Provider.tsx","../../../../../src/contexts/CytoscapeInstance/use.ts","../../../../../src/hooks/cytoscape/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/useCytoscapeOptions.ts","../../../../../src/hooks/cytoscape/useCytoscapeStyle.tsx","../../../../../src/hooks/cytoscape/useIcons.tsx","../../../../../src/hooks/cytoscape/useHoveredNode.tsx","../../../../../src/hooks/cytoscape/useNewElements.tsx","../../../../../src/hooks/cytoscape/useRelationalGraphOptions.tsx","../../../../../src/hooks/cytoscape/useRenderNewElements.tsx","../../../../../src/hooks/cytoscape/useSelectedElement.tsx","../../../../../src/components/cytoscape-extensions/WithExtensions.tsx","../../../../../src/components/RelationalGraph.tsx","../../../../../src/components/module/graph/NodeHover.tsx","../../../../../src/components/module/graph/Popper.tsx"],"sourcesContent":["import { Button } from '@mui/material'\nimport { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { ModuleInstance } from '@xyo-network/module'\n\nimport { CytoscapeInstanceProvider } from '../../../contexts'\nimport { useHoveredNode, useNewElements, useRelationalGraphOptions, useRenderNewElements, useSelectedElement } from '../../../hooks'\nimport { WithExtensions } from '../../cytoscape-extensions'\nimport { NodeRelationalGraphFlexBox } from '../../RelationalGraph'\nimport { ModuleGraphNodeHover } from './NodeHover'\n\nexport interface ModuleGraphFlexBoxProps extends FlexBoxProps {\n rootModule?: ModuleInstance | null\n}\n\nexport const ModuleGraphFlexBox: React.FC<ModuleGraphFlexBoxProps> = ({ rootModule, ...props }) => {\n const { handleToggleLabels, hideLabels, options } = useRelationalGraphOptions(rootModule ?? undefined)\n const selectedElement = useSelectedElement()\n const newElements = useNewElements(selectedElement)\n const renderedElements = useRenderNewElements(newElements, hideLabels)\n const hoveredNode = useHoveredNode(renderedElements)\n\n return (\n <WithExtensions>\n <NodeRelationalGraphFlexBox\n actions={\n <Button size={'small'} onClick={handleToggleLabels} variant=\"contained\">\n Toggle Labels\n </Button>\n }\n options={options}\n {...props}\n >\n <ModuleGraphNodeHover node={hoveredNode} />\n </NodeRelationalGraphFlexBox>\n </WithExtensions>\n )\n}\n\nexport const ModuleGraphFlexBoxWithProvider: React.FC<ModuleGraphFlexBoxProps> = (props) => {\n return (\n <CytoscapeInstanceProvider>\n <ModuleGraphFlexBox {...props} />\n </CytoscapeInstanceProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { CytoscapeInstanceState } from './State'\n\nexport const CytoscapeInstanceContext = createContextEx<CytoscapeInstanceState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { Core } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { CytoscapeInstanceContext } from './Context'\n\nexport interface CytoscapeInstanceProviderProps extends WithChildren {\n defaultInstance?: Core\n}\n\nexport const CytoscapeInstanceProvider: React.FC<CytoscapeInstanceProviderProps> = ({ children, defaultInstance }) => {\n const [cy, setCy] = useState<Core | undefined>(defaultInstance)\n useEffect(() => {\n setCy(defaultInstance)\n }, [defaultInstance])\n\n return <CytoscapeInstanceContext.Provider value={{ cy, provided: true, setCy }}>{children}</CytoscapeInstanceContext.Provider>\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { CytoscapeInstanceContext } from './Context'\n\nexport const useCytoscapeInstance = (required = false) => useContextEx(CytoscapeInstanceContext, 'CytoscapeInstance', required)\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { EventUnsubscribeFunction, ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { CytoscapeElements } from '../../Cytoscape'\n\nexport const useCytoscapeElements = (module?: ModuleInstance | null) => {\n const [elements, setElements] = useState<ElementDefinition[]>([])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async () => {\n if (module) {\n const newElements = (await CytoscapeElements.buildElements(module)) ?? []\n setElements(newElements)\n }\n },\n [module],\n )\n\n useEffect(() => {\n let attachedListener: EventUnsubscribeFunction | undefined = undefined\n let detachedListener: EventUnsubscribeFunction | undefined = undefined\n\n if (module && isNodeInstance(module)) {\n attachedListener = module.on('moduleAttached', async () => {\n const newElements = (await CytoscapeElements.buildElements(module)) ?? []\n setElements(newElements)\n })\n detachedListener = module.on('moduleDetached', async () => {\n const newElements = (await CytoscapeElements.buildElements(module)) ?? []\n setElements(newElements)\n })\n }\n\n return () => {\n attachedListener?.()\n detachedListener?.()\n }\n }, [module])\n\n return elements\n}\n","import { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { ElementDefinition } from 'cytoscape'\n\nimport { parseModuleType } from './lib'\n\nexport class CytoscapeElements {\n static MaxNameLength = 20\n\n static buildEdge(rootNode: ElementDefinition, newNode: ElementDefinition) {\n return {\n data: {\n id: `${rootNode.data.id}/${newNode.data.id}`,\n source: rootNode.data.id,\n target: newNode.data.id,\n },\n }\n }\n\n static async buildElements(module: ModuleInstance): Promise<ElementDefinition[]> {\n const newRootNode = CytoscapeElements.buildRootNode(module)\n const newElements: ElementDefinition[] = [newRootNode]\n\n try {\n const childElements = await CytoscapeElements.recurseNodes(module)\n childElements?.forEach((module) => {\n const newNode = CytoscapeElements.buildNode(module, newRootNode.data.id)\n newElements.push(newNode)\n\n const newEdge = CytoscapeElements.buildEdge(newRootNode, newNode)\n newElements.push(newEdge)\n })\n\n return newElements\n } catch (e) {\n console.error('error resolving modules', e)\n return []\n }\n }\n\n static buildNode(module: ModuleInstance, rootNodeId?: string): ElementDefinition {\n const { address, config } = module\n const normalizedName = config.name ?? address.substring(0, 8)\n return {\n data: {\n address,\n id: address,\n name: normalizedName,\n rootNodeId,\n type: parseModuleType(module),\n },\n }\n }\n\n static buildRootNode = (module: ModuleInstance): ElementDefinition => {\n return CytoscapeElements.buildNode(module)\n }\n\n static normalizeName(name?: string) {\n if (!name) return\n if (name.length > this.MaxNameLength) return `${name.substring(0, 20)}...`\n return name\n }\n\n static async recurseNodes(module: ModuleInstance, maxTraversals = 1): Promise<ModuleInstance[]> {\n let localDepth = 0\n const childModules: ModuleInstance[] = []\n\n const traverse = async (nestedNode: ModuleInstance) => {\n if (localDepth < maxTraversals) {\n const modules = await nestedNode.resolve(undefined, { direction: 'down', maxDepth: 2 })\n await Promise.all(\n modules.map(async (child) => {\n if (child !== nestedNode && isNodeInstance(child)) {\n localDepth++\n await traverse(child)\n // don't re add the root module that was passed in\n } else if (child !== module) {\n childModules.push(child)\n }\n }),\n )\n }\n }\n\n await traverse(module)\n\n return childModules\n }\n}\n","import { ReactElement } from 'react'\n// eslint-disable-next-line import/no-internal-modules\nimport { renderToStaticMarkup } from 'react-dom/server'\n\nconst dataUri = 'data:image/svg+xml,'\n\nexport const encodeSvg = (reactElement: ReactElement, color?: string) => {\n const svgString = renderToStaticMarkup(reactElement)\n\n const doc = new DOMParser().parseFromString(svgString, 'text/html')\n const svgElement = doc.getElementsByTagName('svg')[0]\n if (svgElement) {\n svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')\n svgElement.setAttribute('height', '100')\n svgElement.style.fill = color ?? 'black'\n }\n\n return `${dataUri}${window.encodeURIComponent(svgElement.outerHTML)}`\n}\n","import { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const generateIconMap: () => Record<CyNodeModuleTypes, string> = () => ({\n archivist: '',\n bridge: '',\n diviner: '',\n module: '',\n node: '',\n sentinel: '',\n witness: '',\n})\n","export const ColaLayout = {\n centerGraph: false,\n convergenceThreshold: 0.01,\n name: 'cola',\n}\n","import { LayoutOptions } from 'cytoscape'\n\nexport const ConcentricLayout: LayoutOptions = {\n concentric: function (node) {\n return node.degree()\n },\n levelWidth: function () {\n return 2\n },\n minNodeSpacing: 75,\n name: 'concentric',\n}\n","import { isArchivistInstance } from '@xyo-network/archivist-model'\nimport { isBridgeInstance } from '@xyo-network/bridge-model'\nimport { isDivinerInstance } from '@xyo-network/diviner-model'\nimport { ModuleInstance } from '@xyo-network/module'\nimport { isNodeInstance } from '@xyo-network/node-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel'\nimport { isWitnessModule } from '@xyo-network/witness'\n\nimport { CyNodeModuleTypes } from './CyNodeModuleTypes'\n\nexport const parseModuleType = (module?: ModuleInstance): CyNodeModuleTypes => {\n let type: CyNodeModuleTypes = 'module'\n if (module) {\n if (isArchivistInstance(module)) {\n type = 'archivist'\n } else if (isBridgeInstance(module)) {\n type = 'bridge'\n } else if (isDivinerInstance(module)) {\n type = 'diviner'\n } else if (isNodeInstance(module)) {\n type = 'node'\n } else if (isSentinelInstance(module)) {\n type = 'sentinel'\n } else if (isWitnessModule(module)) {\n type = 'witness'\n } else {\n type = 'module'\n }\n }\n return type\n}\n","import {\n BubbleChartRounded as BubbleChartRoundedIcon,\n Hub as HubIcon,\n InsertLinkRounded as InsertLinkRoundedIcon,\n Inventory2Rounded as Inventory2RoundedIcon,\n QuestionMarkRounded as QuestionMarkRoundedIcon,\n TimerRounded as TimerRoundedIcon,\n VisibilityRounded as VisibilityRoundedIcon,\n} from '@mui/icons-material'\nimport { SvgIconTypeMap } from '@mui/material'\nimport { OverridableComponent } from '@mui/material/OverridableComponent'\n\nimport { CyNodeModuleTypes } from './lib'\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport const CyIconSet: Record<CyNodeModuleTypes, OverridableComponent<SvgIconTypeMap<{}, 'svg'>>> = {\n archivist: Inventory2RoundedIcon,\n bridge: InsertLinkRoundedIcon,\n diviner: BubbleChartRoundedIcon,\n module: QuestionMarkRoundedIcon,\n node: HubIcon,\n sentinel: TimerRoundedIcon,\n witness: VisibilityRoundedIcon,\n}\n","import { Stylesheet } from 'cytoscape'\n\nimport { CyNodeModuleTypes } from './lib'\n\nexport const NodeIdStyles = (color?: string, outlineColor?: string): Stylesheet => ({\n selector: 'node[name]',\n style: {\n color,\n 'font-family': 'Lexend Deca, Helvetica, sans-serif',\n 'font-size': 12,\n 'overlay-padding': '6px',\n 'text-halign': 'center',\n 'text-outline-color': outlineColor,\n 'text-outline-width': '1px',\n 'text-valign': 'top',\n },\n})\n\nexport const NodeStyled = (icons: Record<CyNodeModuleTypes, string>, bgColor?: string, hideLabels = false): Stylesheet => ({\n selector: 'node',\n style: {\n 'background-color': bgColor,\n 'background-height': '75%',\n 'background-image': (elem) => icons[elem.data('type') as CyNodeModuleTypes],\n 'background-width': '24',\n label: hideLabels ? undefined : 'data(name)',\n shape: 'round-rectangle',\n },\n})\n\nexport const EdgeStyled = (lineColor?: string, targetArrowColor?: string) => ({\n selector: 'edge',\n style: {\n 'curve-style': 'bezier',\n 'line-color': lineColor,\n 'line-opacity': 0.1,\n 'target-arrow-color': targetArrowColor,\n 'target-arrow-shape': 'triangle',\n width: 3,\n },\n})\n","import { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape'\nimport { useCytoscapeStyle } from './useCytoscapeStyle'\n\nexport const useCytoscapeOptions = (\n elements: CytoscapeOptions['elements'],\n style?: CytoscapeOptions['style'],\n layout?: CytoscapeOptions['layout'],\n) => {\n const defaultStyle = useCytoscapeStyle()\n\n const resolvedLayout = layout ?? ConcentricLayout\n const resolvedStyle = style ?? defaultStyle\n\n const options = useMemo<CytoscapeOptions | undefined>(() => {\n if (elements && resolvedLayout && resolvedStyle) {\n return {\n elements,\n layout: resolvedLayout,\n style: resolvedStyle,\n }\n }\n }, [elements, layout, style])\n\n return options\n}\n","import { useTheme } from '@mui/material'\nimport { CytoscapeOptions } from 'cytoscape'\nimport { useMemo } from 'react'\n\nimport { EdgeStyled, NodeIdStyles, NodeStyled } from '../../Cytoscape'\nimport { useIcons } from './useIcons'\n\nexport const useCytoscapeStyle = (hideLabels = false) => {\n const theme = useTheme()\n const icons = useIcons()\n\n const style: CytoscapeOptions['style'] = useMemo(\n () => [\n NodeIdStyles(theme.palette.text.primary, theme.palette.getContrastText(theme.palette.text.primary)),\n NodeStyled(icons, theme.palette.primary.main, hideLabels),\n EdgeStyled(theme.palette.divider, theme.palette.divider),\n ],\n [icons, hideLabels, theme],\n )\n\n return style\n}\n","import { useTheme } from '@mui/material'\nimport { useMemo } from 'react'\n\nimport { CyIconSet, CyNodeModuleTypes, encodeSvg, generateIconMap } from '../../Cytoscape'\n\nexport const useIcons = () => {\n const theme = useTheme()\n const icons = useMemo(() => {\n const iconMap = generateIconMap()\n return Object.entries(CyIconSet).reduce((acc, [name, IconComponent]) => {\n const icon = <IconComponent fontSize=\"small\" />\n acc[name as CyNodeModuleTypes] = encodeSvg(icon, theme.palette.getContrastText(theme.palette.text.primary))\n return acc\n }, iconMap)\n }, [theme.palette])\n\n return icons\n}\n","import { NodeCollection, NodeSingular } from 'cytoscape'\nimport { useCallback, useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\n\nexport const useHoveredNode = (renderedElements?: NodeCollection) => {\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 node.on('mouseout', () => {\n setHoveredNode(undefined)\n })\n }, [])\n\n useEffect(() => {\n if (renderedElements) {\n renderedElements.nodes().forEach(nodeListener)\n }\n }, [nodeListener, renderedElements])\n\n useEffect(() => {\n cy?.ready(() => {\n cy.nodes().forEach(nodeListener)\n })\n }, [cy, nodeListener])\n\n return hoveredNode\n}\n","import { useModuleFromNode } from '@xyo-network/react-node'\nimport { NodeSingular } from 'cytoscape'\nimport { useEffect } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\nimport { useCytoscapeElements } from './useCytoscapeElements'\n\nexport const useNewElements = (selectedElement?: NodeSingular) => {\n const { cy } = useCytoscapeInstance(true)\n const { address: selectedAddress } = selectedElement?.data() ?? {}\n const [module] = useModuleFromNode(selectedAddress)\n const newElements = useCytoscapeElements(module)\n\n useEffect(() => {\n if (selectedAddress) {\n const element = cy?.$(`node[id=\"${selectedAddress}\"]`)\n if (element?.length) cy?.center(element)\n }\n }, [cy, selectedAddress])\n\n return newElements\n}\n","import { ModuleInstance } from '@xyo-network/module'\nimport { useState } from 'react'\n\nimport { ConcentricLayout } from '../../Cytoscape'\nimport { useCytoscapeElements } from './useCytoscapeElements'\nimport { useCytoscapeOptions } from './useCytoscapeOptions'\nimport { useCytoscapeStyle } from './useCytoscapeStyle'\n\nexport const useRelationalGraphOptions = (module?: ModuleInstance) => {\n const [hideLabels, setHideLabels] = useState(true)\n\n const handleToggleLabels = () => {\n setHideLabels((oldValue) => !oldValue)\n }\n\n const elements = useCytoscapeElements(module)\n const style = useCytoscapeStyle(hideLabels)\n const options = useCytoscapeOptions(elements, style, ConcentricLayout)\n\n return { handleToggleLabels, hideLabels, options }\n}\n","import { CollectionReturnValue, ElementDefinition } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\nimport { ColaLayout } from '../../Cytoscape'\n\nexport const useRenderNewElements = (newElements: ElementDefinition[] = [], hideLabels?: boolean) => {\n const { cy } = useCytoscapeInstance(true)\n const [renderedElements, setRenderedElements] = useState<CollectionReturnValue>()\n\n useEffect(() => {\n if (newElements.length > 1) {\n const renderedElements = cy?.add(newElements)\n setRenderedElements(renderedElements)\n cy?.layout(ColaLayout).run()\n }\n }, [cy, hideLabels, newElements])\n\n return renderedElements\n}\n","import { EventObject, NodeSingular } from 'cytoscape'\nimport { useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../../contexts'\n\nexport const useSelectedElement = () => {\n const { cy } = useCytoscapeInstance(true)\n const [selectedElement, setSelectedElement] = useState<NodeSingular>()\n\n useEffect(() => {\n const listener = (event: EventObject) => {\n const element = event.target[0]\n if (element.isNode()) setSelectedElement(element)\n }\n cy?.on('select', listener)\n\n return () => {\n cy?.off('select', listener)\n }\n }, [cy, setSelectedElement])\n\n return selectedElement\n}\n","import { use } from 'cytoscape'\nimport cola from 'cytoscape-cola'\nimport { PropsWithChildren, useEffect, useState } from 'react'\n\nexport const WithExtensions: React.FC<PropsWithChildren> = ({ children }) => {\n const [initialized, setInitialized] = useState(false)\n useEffect(() => {\n use(cola)\n setInitialized(true)\n }, [])\n\n return <>{initialized ? children : undefined}</>\n}\n","import { Button, ButtonGroup, styled } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { useShareForwardedRef } from '@xyo-network/react-shared'\nimport cytoscape, { Core } from 'cytoscape'\nimport { forwardRef, useEffect, useState } from 'react'\n\nimport { useCytoscapeInstance } from '../contexts'\nimport { NodeRelationalGraphProps } from './lib'\n\nexport const NodeRelationalGraphFlexBox = forwardRef<HTMLDivElement, NodeRelationalGraphProps>(({ actions, children, options, ...props }, ref) => {\n const [cy, setCy] = useState<Core>()\n const { setCy: setCyContext } = useCytoscapeInstance()\n const sharedRef = useShareForwardedRef(ref)\n\n const handleReset = () => {\n cy?.reset()\n cy?.fit(undefined, 20)\n }\n\n useEffect(() => {\n if (sharedRef) {\n const newCy = cytoscape({\n container: sharedRef.current,\n ...options,\n })\n setCy(newCy)\n }\n }, [options, sharedRef])\n\n useEffect(() => {\n setCyContext?.(cy)\n }, [cy, setCyContext])\n\n return (\n <FlexCol {...props}>\n <ActionsContainer>\n <>\n {actions ? (\n <ButtonGroup>\n {actions}\n <Button size={'small'} variant={'contained'} onClick={handleReset}>\n Reset\n </Button>\n </ButtonGroup>\n ) : (\n <Button size={'small'} variant={'contained'} onClick={handleReset}>\n Reset\n </Button>\n )}\n </>\n </ActionsContainer>\n {/* Cytoscape Element */}\n <FlexCol alignItems=\"stretch\" height=\"100%\" position=\"absolute\" ref={sharedRef} width=\"100%\"></FlexCol>\n {children}\n </FlexCol>\n )\n})\n\nNodeRelationalGraphFlexBox.displayName = 'NodeRelationalGraph'\n\nconst ActionsContainer = styled(FlexRow, { name: 'ActionsContainer' })(({ theme }) => ({\n flexWrap: 'wrap',\n gap: theme.spacing(1),\n position: 'absolute',\n right: '10px',\n top: '10px',\n zIndex: 2,\n}))\n\n/** @deprecated */\nexport const NodeRelationalGraph = NodeRelationalGraphFlexBox\n","import { PopperProps } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { NodeSingular } from 'cytoscape'\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nimport { ModuleHoverPopper } from './Popper'\n\nexport interface ModuleHoverProps {\n node?: NodeSingular\n}\n\nexport const ModuleGraphNodeHover: React.FC<ModuleHoverProps> = ({ node }) => {\n const { address, name } = node?.data() ?? {}\n const [boundingBox, setBoundingBox] = useState(node?.renderedBoundingBox())\n const ref = useRef<HTMLDivElement>(null)\n const [currentEl, setCurrentEl] = useState<PopperProps['anchorEl'] | null>(null)\n\n // Ensure first render clears the previous element when node changes to avoid flicker\n useEffect(() => {\n setCurrentEl(null)\n }, [node])\n\n useEffect(() => {\n if (node) {\n setBoundingBox(node.renderedBoundingBox())\n }\n\n const listener = () => {\n setBoundingBox(node?.renderedBoundingBox())\n }\n\n node?.on('position', listener)\n\n return () => {\n node?.off('position', undefined, listener)\n }\n }, [node])\n\n // Once boundingBox state is set and applied to the layout, update the ref\n useLayoutEffect(() => {\n setCurrentEl(ref.current)\n }, [boundingBox])\n\n return (\n <>\n <FlexCol\n ref={ref}\n sx={{\n // For easier debugging of the 'ghost' element that matches the hovered cytoscape node\n // backgroundColor: '#fff',\n // opacity: 0.25,\n cursor: 'pointer',\n height: boundingBox?.h,\n left: boundingBox?.x1,\n pointerEvents: 'none',\n position: 'absolute',\n top: boundingBox?.y1,\n width: boundingBox?.w,\n }}\n />\n {node ? (\n <>\n <ModuleHoverPopper address={address} element={currentEl} name={name} placement={'top'} open />\n </>\n ) : null}\n </>\n )\n}\n","import { alpha, Chip, Popper, PopperProps, Theme, Typography } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { Identicon } from '@xylabs/react-identicon'\n\nexport interface ModuleHoverPopperProps extends PopperProps {\n address?: string\n element?: PopperProps['anchorEl']\n name?: string\n}\n\nexport const ModuleHoverPopper: React.FC<ModuleHoverPopperProps> = ({ address, element, name, ...props }) => {\n return (\n <>\n {element ? (\n <Popper anchorEl={element} {...props}>\n <FlexCol gap={2} p={2} paper sx={{ backgroundColor: (theme: Theme) => alpha(theme.palette.background.paper, 0.95) }}>\n <FlexRow gap={2}>\n <Identicon value={address} size={24} />\n <Typography>{name}</Typography>\n </FlexRow>\n <Chip label={address} color={'primary'} />\n </FlexCol>\n </Popper>\n ) : null}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAAuB;;;ACAvB,0BAAgC;AAIzB,IAAM,+BAA2B,qCAAwC;;;ACFhF,mBAAoC;AAc3B;AANF,IAAM,4BAAsE,CAAC,EAAE,UAAU,gBAAgB,MAAM;AACpH,QAAM,CAAC,IAAI,KAAK,QAAI,uBAA2B,eAAe;AAC9D,8BAAU,MAAM;AACd,UAAM,eAAe;AAAA,EACvB,GAAG,CAAC,eAAe,CAAC;AAEpB,SAAO,4CAAC,yBAAyB,UAAzB,EAAkC,OAAO,EAAE,IAAI,UAAU,MAAM,MAAM,GAAI,UAAS;AAC5F;;;ACjBA,IAAAC,uBAA6B;AAItB,IAAM,uBAAuB,CAAC,WAAW,cAAU,mCAAa,0BAA0B,qBAAqB,QAAQ;;;ACJ9H,gCAA+B;AAE/B,IAAAC,qBAA+B;AAE/B,IAAAC,gBAAoC;;;ACHpC,IAAAC,qBAA+B;;;ACC/B,oBAAqC;AAErC,IAAM,UAAU;AAET,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","import_react_shared","import_node_model","import_react","import_node_model","module","module","Inventory2RoundedIcon","InsertLinkRoundedIcon","BubbleChartRoundedIcon","QuestionMarkRoundedIcon","HubIcon","TimerRoundedIcon","VisibilityRoundedIcon","module","import_react","import_material","import_react","import_react","import_jsx_runtime","import_react","import_react","module","import_react","module","import_react","renderedElements","import_react","import_react","import_jsx_runtime","cola","import_material","import_react_shared","import_cytoscape","import_react","import_jsx_runtime","cytoscape","import_react_flexbox","import_react","import_material","import_react_flexbox","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
|
|
@@ -5,4 +5,5 @@ export interface ModuleGraphFlexBoxProps extends FlexBoxProps {
|
|
|
5
5
|
rootModule?: ModuleInstance | null;
|
|
6
6
|
}
|
|
7
7
|
export declare const ModuleGraphFlexBox: React.FC<ModuleGraphFlexBoxProps>;
|
|
8
|
+
export declare const ModuleGraphFlexBoxWithProvider: React.FC<ModuleGraphFlexBoxProps>;
|
|
8
9
|
//# sourceMappingURL=GraphFlexBox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphFlexBox.d.ts","sourceRoot":"","sources":["../../../../../src/components/module/graph/GraphFlexBox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"GraphFlexBox.d.ts","sourceRoot":"","sources":["../../../../../src/components/module/graph/GraphFlexBox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAQpD,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,UAAU,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CACnC;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAsBhE,CAAA;AAED,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAM5E,CAAA"}
|
|
@@ -5,4 +5,5 @@ export interface ModuleGraphFlexBoxProps extends FlexBoxProps {
|
|
|
5
5
|
rootModule?: ModuleInstance | null;
|
|
6
6
|
}
|
|
7
7
|
export declare const ModuleGraphFlexBox: React.FC<ModuleGraphFlexBoxProps>;
|
|
8
|
+
export declare const ModuleGraphFlexBoxWithProvider: React.FC<ModuleGraphFlexBoxProps>;
|
|
8
9
|
//# sourceMappingURL=GraphFlexBox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphFlexBox.d.ts","sourceRoot":"","sources":["../../../../../src/components/module/graph/GraphFlexBox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"GraphFlexBox.d.ts","sourceRoot":"","sources":["../../../../../src/components/module/graph/GraphFlexBox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAQpD,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,UAAU,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CACnC;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAsBhE,CAAA;AAED,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAM5E,CAAA"}
|
|
@@ -5,4 +5,5 @@ export interface ModuleGraphFlexBoxProps extends FlexBoxProps {
|
|
|
5
5
|
rootModule?: ModuleInstance | null;
|
|
6
6
|
}
|
|
7
7
|
export declare const ModuleGraphFlexBox: React.FC<ModuleGraphFlexBoxProps>;
|
|
8
|
+
export declare const ModuleGraphFlexBoxWithProvider: React.FC<ModuleGraphFlexBoxProps>;
|
|
8
9
|
//# sourceMappingURL=GraphFlexBox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphFlexBox.d.ts","sourceRoot":"","sources":["../../../../../src/components/module/graph/GraphFlexBox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"GraphFlexBox.d.ts","sourceRoot":"","sources":["../../../../../src/components/module/graph/GraphFlexBox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAQpD,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,UAAU,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CACnC;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAsBhE,CAAA;AAED,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAM5E,CAAA"}
|