@xyo-network/react-node-renderer 7.4.1 → 7.5.0

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.
Files changed (33) hide show
  1. package/dist/browser/components/lib/RelationalGraphProps.d.ts +1 -1
  2. package/dist/browser/components/lib/RelationalGraphProps.d.ts.map +1 -1
  3. package/dist/browser/components/module/graph/GraphFlexBox.stories.d.ts +3 -3
  4. package/dist/browser/components/module/graph/GraphFlexBox.stories.d.ts.map +1 -1
  5. package/dist/browser/components/module/graph/Popper.d.ts +2 -2
  6. package/dist/browser/components/module/graph/Popper.d.ts.map +1 -1
  7. package/dist/browser/components/module/graph/node/hooks/useNodeElement.d.ts +1 -1
  8. package/dist/browser/components/relational/graph/Graph.d.ts.map +1 -1
  9. package/dist/browser/components/relational/graph/Graph.stories.d.ts +6 -6
  10. package/dist/browser/components/relational/graph/Graph.stories.d.ts.map +1 -1
  11. package/dist/browser/components/relational/graph/GraphCola.stories.d.ts +6 -6
  12. package/dist/browser/components/relational/graph/GraphCola.stories.d.ts.map +1 -1
  13. package/dist/browser/components/relational/graph/GraphCoseBilkent.stories.d.ts +6 -6
  14. package/dist/browser/components/relational/graph/GraphCoseBilkent.stories.d.ts.map +1 -1
  15. package/dist/browser/components/relational/graph/GraphDagre.stories.d.ts +6 -6
  16. package/dist/browser/components/relational/graph/GraphDagre.stories.d.ts.map +1 -1
  17. package/dist/browser/components/relational/graph/GraphEuler.stories.d.ts +6 -6
  18. package/dist/browser/components/relational/graph/GraphEuler.stories.d.ts.map +1 -1
  19. package/dist/browser/components/relational/graph/GraphEvents.stories.d.ts +1 -1
  20. package/dist/browser/components/relational/graph/GraphEvents.stories.d.ts.map +1 -1
  21. package/dist/browser/index.mjs +423 -364
  22. package/dist/browser/index.mjs.map +1 -1
  23. package/package.json +46 -46
  24. package/src/Cytoscape/CytoscapeElements.ts +1 -1
  25. package/src/Cytoscape/lib/encodeSvg.ts +1 -1
  26. package/src/components/lib/RelationalGraphProps.ts +1 -1
  27. package/src/components/relational/graph/Graph.stories.tsx +3 -2
  28. package/src/components/relational/graph/Graph.tsx +2 -3
  29. package/src/components/relational/graph/GraphCola.stories.tsx +3 -2
  30. package/src/components/relational/graph/GraphCoseBilkent.stories.tsx +3 -2
  31. package/src/components/relational/graph/GraphEuler.stories.tsx +3 -2
  32. package/src/hooks/cytoscape/useCytoscapeOptions.ts +1 -1
  33. package/src/hooks/cytoscape/useModuleDetails.tsx +1 -1
@@ -1,47 +1,60 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/components/module/CardParser.tsx
2
5
  import { asArchivistInstance, isArchivistInstance } from "@xyo-network/archivist-model";
3
6
  import { asDivinerInstance, isDivinerInstance } from "@xyo-network/diviner-model";
4
7
  import { ArchivistCard } from "@xyo-network/react-archivist";
5
8
  import { DivinerCard, ModuleCard } from "@xyo-network/react-module";
6
- import { jsx } from "react/jsx-runtime";
7
- var ModuleCardParser = ({ mod }) => {
9
+ import React from "react";
10
+ var ModuleCardParser = /* @__PURE__ */ __name(({ mod }) => {
8
11
  switch (true) {
9
12
  case isArchivistInstance(mod): {
10
- return /* @__PURE__ */ jsx(ArchivistCard, { mod: asArchivistInstance(mod) });
13
+ return /* @__PURE__ */ React.createElement(ArchivistCard, {
14
+ mod: asArchivistInstance(mod)
15
+ });
11
16
  }
12
17
  case isDivinerInstance(mod): {
13
- return /* @__PURE__ */ jsx(DivinerCard, { mod: asDivinerInstance(mod) });
18
+ return /* @__PURE__ */ React.createElement(DivinerCard, {
19
+ mod: asDivinerInstance(mod)
20
+ });
14
21
  }
15
22
  default: {
16
- return /* @__PURE__ */ jsx(ModuleCard, { mod });
23
+ return /* @__PURE__ */ React.createElement(ModuleCard, {
24
+ mod
25
+ });
17
26
  }
18
27
  }
19
- };
28
+ }, "ModuleCardParser");
20
29
 
21
30
  // src/components/module/graph/GraphFlexBox.tsx
22
31
  import { Button as Button3 } from "@mui/material";
23
- import { useRef as useRef3 } from "react";
32
+ import React10, { useRef as useRef3 } from "react";
24
33
 
25
34
  // src/contexts/CytoscapeInstance/Context.ts
26
35
  import { createContextEx } from "@xylabs/react-shared";
27
36
  var CytoscapeInstanceContext = createContextEx();
28
37
 
29
38
  // src/contexts/CytoscapeInstance/Provider.tsx
30
- import { useMemo, useState } from "react";
31
- import { jsx as jsx2 } from "react/jsx-runtime";
32
- var CytoscapeInstanceProvider = ({ children, defaultInstance }) => {
39
+ import React2, { useMemo, useState } from "react";
40
+ var CytoscapeInstanceProvider = /* @__PURE__ */ __name(({ children, defaultInstance }) => {
33
41
  const [cy, setCy] = useState(() => defaultInstance);
34
42
  const value = useMemo(() => ({
35
43
  cy,
36
44
  provided: true,
37
45
  setCy
38
- }), [cy, setCy]);
39
- return /* @__PURE__ */ jsx2(CytoscapeInstanceContext, { value, children });
40
- };
46
+ }), [
47
+ cy,
48
+ setCy
49
+ ]);
50
+ return /* @__PURE__ */ React2.createElement(CytoscapeInstanceContext, {
51
+ value
52
+ }, children);
53
+ }, "CytoscapeInstanceProvider");
41
54
 
42
55
  // src/contexts/CytoscapeInstance/use.ts
43
56
  import { useContextEx } from "@xylabs/react-shared";
44
- var useCytoscapeInstance = (required = false) => useContextEx(CytoscapeInstanceContext, "CytoscapeInstance", required);
57
+ var useCytoscapeInstance = /* @__PURE__ */ __name((required = false) => useContextEx(CytoscapeInstanceContext, "CytoscapeInstance", required), "useCytoscapeInstance");
45
58
 
46
59
  // src/hooks/cytoscape/elements/useCytoscapeElements.ts
47
60
  import { useAsyncEffect } from "@xylabs/react-async-effect";
@@ -50,13 +63,13 @@ import { useEffect, useState as useState2 } from "react";
50
63
 
51
64
  // src/Cytoscape/CytoscapeElements.ts
52
65
  import { exists } from "@xylabs/exists";
53
- import { isFalsy } from "@xylabs/typeof";
66
+ import { isFalsy } from "@xylabs/sdk-js";
54
67
 
55
68
  // src/Cytoscape/lib/encodeSvg.ts
56
- import { isDefined } from "@xylabs/typeof";
69
+ import { isDefined } from "@xylabs/sdk-js";
57
70
  import { renderToStaticMarkup } from "react-dom/server";
58
71
  var dataUri = "data:image/svg+xml,";
59
- var encodeSvg = (reactElement, color) => {
72
+ var encodeSvg = /* @__PURE__ */ __name((reactElement, color) => {
60
73
  const svgString = renderToStaticMarkup(reactElement);
61
74
  const doc = new DOMParser().parseFromString(svgString, "text/html");
62
75
  const svgElement = doc.querySelectorAll("svg")[0];
@@ -66,10 +79,10 @@ var encodeSvg = (reactElement, color) => {
66
79
  svgElement.style.fill = color ?? "black";
67
80
  }
68
81
  return `${dataUri}${globalThis.encodeURIComponent(svgElement.outerHTML)}`;
69
- };
82
+ }, "encodeSvg");
70
83
 
71
84
  // src/Cytoscape/lib/iconMap.ts
72
- var generateIconMap = () => ({
85
+ var generateIconMap = /* @__PURE__ */ __name(() => ({
73
86
  archivist: "",
74
87
  bridge: "",
75
88
  diviner: "",
@@ -77,7 +90,7 @@ var generateIconMap = () => ({
77
90
  node: "",
78
91
  sentinel: "",
79
92
  witness: ""
80
- });
93
+ }), "generateIconMap");
81
94
 
82
95
  // src/Cytoscape/lib/layout/ColaLayout.ts
83
96
  var ColaLayout = {
@@ -88,12 +101,12 @@ var ColaLayout = {
88
101
 
89
102
  // src/Cytoscape/lib/layout/ConcentricLayout.ts
90
103
  var ConcentricLayout = {
91
- concentric: function(node) {
104
+ concentric: /* @__PURE__ */ __name(function(node) {
92
105
  return node.degree(false);
93
- },
94
- levelWidth: function() {
106
+ }, "concentric"),
107
+ levelWidth: /* @__PURE__ */ __name(function() {
95
108
  return 2;
96
- },
109
+ }, "levelWidth"),
97
110
  minNodeSpacing: 75,
98
111
  name: "concentric"
99
112
  };
@@ -105,7 +118,7 @@ import { isDivinerInstance as isDivinerInstance2 } from "@xyo-network/diviner-mo
105
118
  import { isNodeInstance } from "@xyo-network/node-model";
106
119
  import { isSentinelInstance } from "@xyo-network/sentinel-model";
107
120
  import { isWitnessModule } from "@xyo-network/witness-model";
108
- var parseModuleType = (mod) => {
121
+ var parseModuleType = /* @__PURE__ */ __name((mod) => {
109
122
  let type = "module";
110
123
  if (mod) {
111
124
  if (isArchivistInstance2(mod)) {
@@ -123,7 +136,7 @@ var parseModuleType = (mod) => {
123
136
  }
124
137
  }
125
138
  return type;
126
- };
139
+ }, "parseModuleType");
127
140
 
128
141
  // src/Cytoscape/CytoscapeElements.ts
129
142
  var CytoscapeElements = {
@@ -140,13 +153,23 @@ var CytoscapeElements = {
140
153
  },
141
154
  async buildElements(mod) {
142
155
  const info = await CytoscapeElements.recurseNodes(mod);
143
- const newElements = await this.buildElementsFromInfo(info, void 0, ["activeNode"]);
156
+ const newElements = await this.buildElementsFromInfo(info, void 0, [
157
+ "activeNode"
158
+ ]);
144
159
  return newElements;
145
160
  },
146
161
  async buildElementsFromInfo(info, root, classes = []) {
147
- const newNode = CytoscapeElements.buildNode(info.mod, { childCount: info.children.length, depth: info.depth }, classes);
148
- const newEdge = root ? CytoscapeElements.buildEdge(root, newNode, { depth: info.depth, siblingCount: info.children.length }) : void 0;
149
- const newElements = [newNode];
162
+ const newNode = CytoscapeElements.buildNode(info.mod, {
163
+ childCount: info.children.length,
164
+ depth: info.depth
165
+ }, classes);
166
+ const newEdge = root ? CytoscapeElements.buildEdge(root, newNode, {
167
+ depth: info.depth,
168
+ siblingCount: info.children.length
169
+ }) : void 0;
170
+ const newElements = [
171
+ newNode
172
+ ];
150
173
  if (newEdge) {
151
174
  newElements.push(newEdge);
152
175
  }
@@ -168,9 +191,11 @@ var CytoscapeElements = {
168
191
  }
169
192
  };
170
193
  },
171
- buildRootNode: (mod) => {
172
- return CytoscapeElements.buildNode(mod, {}, ["activeNode"]);
173
- },
194
+ buildRootNode: /* @__PURE__ */ __name((mod) => {
195
+ return CytoscapeElements.buildNode(mod, {}, [
196
+ "activeNode"
197
+ ]);
198
+ }, "buildRootNode"),
174
199
  normalizeName(name) {
175
200
  if (isFalsy(name)) return;
176
201
  if (name.length > this.MaxNameLength) return `${name.slice(0, 20)}...`;
@@ -183,29 +208,22 @@ var CytoscapeElements = {
183
208
  mod: root
184
209
  };
185
210
  if (maxDepth > 0) {
186
- const children = await root.resolve("*", { direction: "down", maxDepth: 1 });
187
- info.children = (await Promise.all(
188
- children.map(async (child) => {
189
- if (child.address !== root.address) {
190
- return await this.recurseNodes(child, maxDepth - 1, depth + 1);
191
- }
192
- })
193
- )).filter(exists);
211
+ const children = await root.resolve("*", {
212
+ direction: "down",
213
+ maxDepth: 1
214
+ });
215
+ info.children = (await Promise.all(children.map(async (child) => {
216
+ if (child.address !== root.address) {
217
+ return await this.recurseNodes(child, maxDepth - 1, depth + 1);
218
+ }
219
+ }))).filter(exists);
194
220
  }
195
221
  return info;
196
222
  }
197
223
  };
198
224
 
199
225
  // src/Cytoscape/CytoscapeIcons.tsx
200
- import {
201
- BubbleChartRounded as BubbleChartRoundedIcon,
202
- Hub as HubIcon,
203
- InsertLinkRounded as InsertLinkRoundedIcon,
204
- Inventory2Rounded as Inventory2RoundedIcon,
205
- QuestionMarkRounded as QuestionMarkRoundedIcon,
206
- TimerRounded as TimerRoundedIcon,
207
- VisibilityRounded as VisibilityRoundedIcon
208
- } from "@mui/icons-material";
226
+ import { BubbleChartRounded as BubbleChartRoundedIcon, Hub as HubIcon, InsertLinkRounded as InsertLinkRoundedIcon, Inventory2Rounded as Inventory2RoundedIcon, QuestionMarkRounded as QuestionMarkRoundedIcon, TimerRounded as TimerRoundedIcon, VisibilityRounded as VisibilityRoundedIcon } from "@mui/icons-material";
209
227
  var CyIconSet = {
210
228
  archivist: Inventory2RoundedIcon,
211
229
  bridge: InsertLinkRoundedIcon,
@@ -217,7 +235,7 @@ var CyIconSet = {
217
235
  };
218
236
 
219
237
  // src/Cytoscape/CytoscapeStyles.ts
220
- var NodeWithName = (color, outlineColor) => ({
238
+ var NodeWithName = /* @__PURE__ */ __name((color, outlineColor) => ({
221
239
  selector: "node[name]",
222
240
  css: {
223
241
  color,
@@ -229,23 +247,25 @@ var NodeWithName = (color, outlineColor) => ({
229
247
  "text-outline-width": "1px",
230
248
  "text-valign": "top"
231
249
  }
232
- });
233
- var Node = (icons, bgColor, hideLabels = false) => ({
250
+ }), "NodeWithName");
251
+ var Node = /* @__PURE__ */ __name((icons, bgColor, hideLabels = false) => ({
234
252
  selector: "node",
235
253
  css: {
236
254
  "background-color": bgColor,
237
255
  "background-height": "75%",
238
- "background-image": (elem) => icons[elem.data("type")],
256
+ "background-image": /* @__PURE__ */ __name((elem) => icons[elem.data("type")], "background-image"),
239
257
  "background-width": "24",
240
258
  "label": hideLabels ? void 0 : "data(name)",
241
259
  "shape": "round-rectangle"
242
260
  }
243
- });
244
- var NodeAsRoot = (bgColor) => ({
261
+ }), "Node");
262
+ var NodeAsRoot = /* @__PURE__ */ __name((bgColor) => ({
245
263
  selector: ".activeNode",
246
- css: { "background-color": bgColor }
247
- });
248
- var EdgeStyled = (lineColor, targetArrowColor) => ({
264
+ css: {
265
+ "background-color": bgColor
266
+ }
267
+ }), "NodeAsRoot");
268
+ var EdgeStyled = /* @__PURE__ */ __name((lineColor, targetArrowColor) => ({
249
269
  selector: "edge",
250
270
  css: {
251
271
  "curve-style": "bezier",
@@ -255,21 +275,20 @@ var EdgeStyled = (lineColor, targetArrowColor) => ({
255
275
  "target-arrow-shape": "triangle",
256
276
  "width": 3
257
277
  }
258
- });
278
+ }), "EdgeStyled");
259
279
 
260
280
  // src/hooks/cytoscape/elements/useCytoscapeElements.ts
261
- var useCytoscapeElements = (mod) => {
281
+ var useCytoscapeElements = /* @__PURE__ */ __name((mod) => {
262
282
  const [elements, setElements] = useState2([]);
263
- useAsyncEffect(
264
- async () => {
265
- const moduleInstance = mod?.deref();
266
- if (moduleInstance) {
267
- const newElements = await CytoscapeElements.buildElements(moduleInstance) ?? [];
268
- setElements(newElements);
269
- }
270
- },
271
- [mod]
272
- );
283
+ useAsyncEffect(async () => {
284
+ const moduleInstance = mod?.deref();
285
+ if (moduleInstance) {
286
+ const newElements = await CytoscapeElements.buildElements(moduleInstance) ?? [];
287
+ setElements(newElements);
288
+ }
289
+ }, [
290
+ mod
291
+ ]);
273
292
  useEffect(() => {
274
293
  let attachedListener;
275
294
  let detachedListener;
@@ -287,17 +306,15 @@ var useCytoscapeElements = (mod) => {
287
306
  attachedListener?.();
288
307
  detachedListener?.();
289
308
  };
290
- }, [mod]);
309
+ }, [
310
+ mod
311
+ ]);
291
312
  return elements;
292
- };
313
+ }, "useCytoscapeElements");
293
314
 
294
315
  // src/hooks/cytoscape/elements/useHoveredNode.tsx
295
- import {
296
- useCallback,
297
- useEffect as useEffect2,
298
- useState as useState3
299
- } from "react";
300
- var useHoveredNode = (renderedElements) => {
316
+ import { useCallback, useEffect as useEffect2, useState as useState3 } from "react";
317
+ var useHoveredNode = /* @__PURE__ */ __name((renderedElements) => {
301
318
  const { cy } = useCytoscapeInstance(true);
302
319
  const [hoveredNode, setHoveredNode] = useState3();
303
320
  const nodeListener = useCallback((node) => {
@@ -309,31 +326,42 @@ var useHoveredNode = (renderedElements) => {
309
326
  if (renderedElements) {
310
327
  renderedElements.nodes().forEach(nodeListener);
311
328
  }
312
- }, [nodeListener, renderedElements]);
329
+ }, [
330
+ nodeListener,
331
+ renderedElements
332
+ ]);
313
333
  useEffect2(() => {
314
334
  cy?.deref()?.ready(() => {
315
335
  cy?.deref()?.nodes().forEach(nodeListener);
316
336
  });
317
- }, [cy, nodeListener]);
318
- return [hoveredNode, setHoveredNode];
319
- };
337
+ }, [
338
+ cy,
339
+ nodeListener
340
+ ]);
341
+ return [
342
+ hoveredNode,
343
+ setHoveredNode
344
+ ];
345
+ }, "useHoveredNode");
320
346
 
321
347
  // src/hooks/cytoscape/elements/useNewElements.tsx
322
348
  import { useWeakModuleFromNode } from "@xyo-network/react-node";
323
349
  import { useMemo as useMemo2 } from "react";
324
- var useNewElements = (selectedElement) => {
350
+ var useNewElements = /* @__PURE__ */ __name((selectedElement) => {
325
351
  const selectedAddress = useMemo2(() => {
326
352
  const { address: selectedAddress2 } = selectedElement?.data() ?? {};
327
353
  return selectedAddress2;
328
- }, [selectedElement]);
354
+ }, [
355
+ selectedElement
356
+ ]);
329
357
  const [mod] = useWeakModuleFromNode(selectedAddress);
330
358
  const newElements = useCytoscapeElements(mod);
331
359
  return newElements;
332
- };
360
+ }, "useNewElements");
333
361
 
334
362
  // src/hooks/cytoscape/elements/useRenderNewElements.tsx
335
363
  import { useMemo as useMemo3 } from "react";
336
- var useRenderNewElements = (newElements = [], hideLabels) => {
364
+ var useRenderNewElements = /* @__PURE__ */ __name((newElements = [], hideLabels) => {
337
365
  const { cy } = useCytoscapeInstance(true);
338
366
  return useMemo3(() => {
339
367
  if (newElements.length > 1) {
@@ -341,31 +369,38 @@ var useRenderNewElements = (newElements = [], hideLabels) => {
341
369
  cy?.deref()?.layout(ColaLayout).run();
342
370
  return renderedElements;
343
371
  }
344
- }, [cy, hideLabels, newElements]);
345
- };
372
+ }, [
373
+ cy,
374
+ hideLabels,
375
+ newElements
376
+ ]);
377
+ }, "useRenderNewElements");
346
378
 
347
379
  // src/hooks/cytoscape/elements/useSelectedElement.tsx
348
380
  import { useState as useState4 } from "react";
349
- var useSelectedElement = () => {
381
+ var useSelectedElement = /* @__PURE__ */ __name(() => {
350
382
  const [selectedElement, setSelectedElement] = useState4();
351
383
  const { cy } = useCytoscapeInstance(true);
352
- const updateStyles = (element) => {
384
+ const updateStyles = /* @__PURE__ */ __name((element) => {
353
385
  const nodes = cy?.deref()?.nodes();
354
386
  nodes?.toggleClass("activeNode", false);
355
387
  element.toggleClass("activeNode", true);
356
- };
357
- const toggleSelectedElement = (address) => {
388
+ }, "updateStyles");
389
+ const toggleSelectedElement = /* @__PURE__ */ __name((address) => {
358
390
  const selectedNode = cy?.deref()?.nodes(`[id="${address}"]`)?.[0];
359
391
  if (selectedNode) {
360
392
  setSelectedElement(selectedNode);
361
393
  updateStyles(selectedNode);
362
394
  }
395
+ }, "toggleSelectedElement");
396
+ return {
397
+ selectedElement,
398
+ toggleSelectedElement
363
399
  };
364
- return { selectedElement, toggleSelectedElement };
365
- };
400
+ }, "useSelectedElement");
366
401
 
367
402
  // src/hooks/cytoscape/elements/useElements.tsx
368
- var useElements = (hideLabels) => {
403
+ var useElements = /* @__PURE__ */ __name((hideLabels) => {
369
404
  const { selectedElement, toggleSelectedElement } = useSelectedElement();
370
405
  const newElements = useNewElements(selectedElement);
371
406
  const renderedElements = useRenderNewElements(newElements, hideLabels);
@@ -375,10 +410,10 @@ var useElements = (hideLabels) => {
375
410
  setHoveredNode,
376
411
  toggleSelectedElement
377
412
  };
378
- };
413
+ }, "useElements");
379
414
 
380
415
  // src/hooks/cytoscape/useCytoscapeOptions.ts
381
- import { isDefined as isDefined2 } from "@xylabs/typeof";
416
+ import { isDefined as isDefined2 } from "@xylabs/sdk-js";
382
417
  import { useMemo as useMemo6 } from "react";
383
418
 
384
419
  // src/hooks/cytoscape/useCytoscapeStyle.tsx
@@ -388,23 +423,26 @@ import { useMemo as useMemo5 } from "react";
388
423
 
389
424
  // src/hooks/cytoscape/useIcons.tsx
390
425
  import { useTheme } from "@mui/material";
391
- import { useMemo as useMemo4 } from "react";
392
- import { jsx as jsx3 } from "react/jsx-runtime";
393
- var useIcons = () => {
426
+ import React3, { useMemo as useMemo4 } from "react";
427
+ var useIcons = /* @__PURE__ */ __name(() => {
394
428
  const theme = useTheme();
395
429
  const icons = useMemo4(() => {
396
430
  const iconMap = generateIconMap();
397
431
  return Object.entries(CyIconSet).reduce((acc, [name, IconComponent]) => {
398
- const icon = /* @__PURE__ */ jsx3(IconComponent, { fontSize: "small" });
432
+ const icon = /* @__PURE__ */ React3.createElement(IconComponent, {
433
+ fontSize: "small"
434
+ });
399
435
  acc[name] = encodeSvg(icon, theme.vars.palette.primary.contrastText);
400
436
  return acc;
401
437
  }, iconMap);
402
- }, [theme.palette]);
438
+ }, [
439
+ theme.palette
440
+ ]);
403
441
  return icons;
404
- };
442
+ }, "useIcons");
405
443
 
406
444
  // src/hooks/cytoscape/useCytoscapeStyle.tsx
407
- var useCytoscapeStyle = (hideLabels = false) => {
445
+ var useCytoscapeStyle = /* @__PURE__ */ __name((hideLabels = false) => {
408
446
  const theme = useTheme2();
409
447
  const dark = useIsDark();
410
448
  const icons = useIcons();
@@ -412,23 +450,21 @@ var useCytoscapeStyle = (hideLabels = false) => {
412
450
  // eslint-disable-next-line complexity
413
451
  () => [
414
452
  Node(icons, dark ? theme.colorSchemes.dark?.palette.primary.main : theme.colorSchemes.light?.palette.primary.main, hideLabels),
415
- NodeWithName(
416
- dark ? theme.colorSchemes.dark?.palette.primary.contrastText : theme.colorSchemes.light?.palette.primary.contrastText,
417
- dark ? theme.colorSchemes.dark?.palette.text.primary : theme.colorSchemes.light?.palette.text.primary
418
- ),
453
+ NodeWithName(dark ? theme.colorSchemes.dark?.palette.primary.contrastText : theme.colorSchemes.light?.palette.primary.contrastText, dark ? theme.colorSchemes.dark?.palette.text.primary : theme.colorSchemes.light?.palette.text.primary),
419
454
  NodeAsRoot(dark ? theme.colorSchemes.dark?.palette.secondary.main : theme.colorSchemes.light?.palette.secondary.main),
420
- EdgeStyled(
421
- dark ? theme.colorSchemes.dark?.palette.divider : theme.colorSchemes.light?.palette.divider,
422
- dark ? theme.colorSchemes.dark?.palette.divider : theme.colorSchemes.light?.palette.divider
423
- )
455
+ EdgeStyled(dark ? theme.colorSchemes.dark?.palette.divider : theme.colorSchemes.light?.palette.divider, dark ? theme.colorSchemes.dark?.palette.divider : theme.colorSchemes.light?.palette.divider)
424
456
  ],
425
- [icons, hideLabels, theme]
457
+ [
458
+ icons,
459
+ hideLabels,
460
+ theme
461
+ ]
426
462
  );
427
463
  return style;
428
- };
464
+ }, "useCytoscapeStyle");
429
465
 
430
466
  // src/hooks/cytoscape/useCytoscapeOptions.ts
431
- var useCytoscapeOptions = (elements, style, layout) => {
467
+ var useCytoscapeOptions = /* @__PURE__ */ __name((elements, style, layout) => {
432
468
  const defaultStyle = useCytoscapeStyle();
433
469
  const resolvedLayout = layout ?? ConcentricLayout;
434
470
  const resolvedStyle = style ?? defaultStyle;
@@ -440,23 +476,19 @@ var useCytoscapeOptions = (elements, style, layout) => {
440
476
  style: resolvedStyle
441
477
  };
442
478
  }
443
- }, [elements, layout, style]);
479
+ }, [
480
+ elements,
481
+ layout,
482
+ style
483
+ ]);
444
484
  return options;
445
- };
485
+ }, "useCytoscapeOptions");
446
486
 
447
487
  // src/hooks/cytoscape/useModuleDetails.tsx
448
488
  import { usePromise } from "@xylabs/react-promise";
449
- import {
450
- isDefined as isDefined3,
451
- isDefinedNotNull,
452
- isTruthy
453
- } from "@xylabs/typeof";
454
- import {
455
- useCallback as useCallback2,
456
- useEffect as useEffect3,
457
- useState as useState5
458
- } from "react";
459
- var useModuleDetails = (rootModule, onFoundModule) => {
489
+ import { isDefined as isDefined3, isDefinedNotNull, isTruthy } from "@xylabs/sdk-js";
490
+ import { useCallback as useCallback2, useEffect as useEffect3, useState as useState5 } from "react";
491
+ var useModuleDetails = /* @__PURE__ */ __name((rootModule, onFoundModule) => {
460
492
  const { cy } = useCytoscapeInstance();
461
493
  const [moduleAddress, setModuleAddress] = useState5();
462
494
  const [foundModule] = usePromise(async () => {
@@ -466,7 +498,10 @@ var useModuleDetails = (rootModule, onFoundModule) => {
466
498
  const foundModule2 = await rootModuleInstance.resolve(moduleAddress);
467
499
  return foundModule2 ?? null;
468
500
  }
469
- }, [moduleAddress, rootModule]);
501
+ }, [
502
+ moduleAddress,
503
+ rootModule
504
+ ]);
470
505
  const createObserver = useCallback2(() => {
471
506
  return new ResizeObserver(() => {
472
507
  if (moduleAddress === null) {
@@ -480,7 +515,11 @@ var useModuleDetails = (rootModule, onFoundModule) => {
480
515
  }, 100);
481
516
  }
482
517
  });
483
- }, [cy, moduleAddress, foundModule]);
518
+ }, [
519
+ cy,
520
+ moduleAddress,
521
+ foundModule
522
+ ]);
484
523
  useEffect3(() => {
485
524
  const resizeObserver = createObserver();
486
525
  const container = cy?.deref()?.container();
@@ -490,13 +529,24 @@ var useModuleDetails = (rootModule, onFoundModule) => {
490
529
  return () => {
491
530
  if (container) resizeObserver.unobserve(container);
492
531
  };
493
- }, [cy, moduleAddress, foundModule, rootModule]);
532
+ }, [
533
+ cy,
534
+ moduleAddress,
535
+ foundModule,
536
+ rootModule
537
+ ]);
494
538
  useEffect3(() => {
495
539
  if (foundModule) {
496
540
  onFoundModule?.();
497
541
  }
498
- }, [cy, moduleAddress, foundModule, onFoundModule, createObserver]);
499
- const onModuleDetails = (address) => {
542
+ }, [
543
+ cy,
544
+ moduleAddress,
545
+ foundModule,
546
+ onFoundModule,
547
+ createObserver
548
+ ]);
549
+ const onModuleDetails = /* @__PURE__ */ __name((address) => {
500
550
  const moduleNode = cy?.deref()?.nodes(`[id="${address}"]`);
501
551
  const rootModuleNode = cy?.deref()?.nodes(`[id="${rootModule?.deref()?.address}"]`);
502
552
  const foundModuleNode = cy?.deref()?.nodes(`[id="${foundModule?.address}"]`);
@@ -510,17 +560,20 @@ var useModuleDetails = (rootModule, onFoundModule) => {
510
560
  activeNode?.toggleClass("activeNode", true);
511
561
  }
512
562
  setModuleAddress(address);
563
+ }, "onModuleDetails");
564
+ return {
565
+ mod: foundModule,
566
+ onModuleDetails
513
567
  };
514
- return { mod: foundModule, onModuleDetails };
515
- };
568
+ }, "useModuleDetails");
516
569
 
517
570
  // src/hooks/cytoscape/useRelationalGraphOptions.tsx
518
571
  import { useState as useState6 } from "react";
519
- var useRelationalGraphOptions = (mod) => {
572
+ var useRelationalGraphOptions = /* @__PURE__ */ __name((mod) => {
520
573
  const [hideLabels, setHideLabels] = useState6(true);
521
- const handleToggleLabels = () => {
574
+ const handleToggleLabels = /* @__PURE__ */ __name(() => {
522
575
  setHideLabels((oldValue) => !oldValue);
523
- };
576
+ }, "handleToggleLabels");
524
577
  const elements = useCytoscapeElements(mod);
525
578
  const style = useCytoscapeStyle(hideLabels);
526
579
  const options = useCytoscapeOptions(elements, style, ConcentricLayout);
@@ -529,57 +582,41 @@ var useRelationalGraphOptions = (mod) => {
529
582
  hideLabels,
530
583
  options
531
584
  };
532
- };
585
+ }, "useRelationalGraphOptions");
533
586
 
534
587
  // src/components/cytoscape-extensions/WithExtensions.tsx
535
588
  import cytoscape from "cytoscape";
536
589
  import cola from "cytoscape-cola";
537
590
  import coseBilkent from "cytoscape-cose-bilkent";
538
- import { useMemo as useMemo7 } from "react";
539
- import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
540
- var WithExtensions = ({ children }) => {
591
+ import React4, { useMemo as useMemo7 } from "react";
592
+ var WithExtensions = /* @__PURE__ */ __name(({ children }) => {
541
593
  const initialized = useMemo7(() => {
542
594
  cytoscape.use(cola);
543
595
  cytoscape.use(coseBilkent);
544
596
  return true;
545
597
  }, []);
546
- return /* @__PURE__ */ jsx4(Fragment, { children: initialized ? children : void 0 });
547
- };
598
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, initialized ? children : void 0);
599
+ }, "WithExtensions");
548
600
 
549
601
  // src/components/relational/graph/Graph.tsx
550
- import {
551
- Box,
552
- Button,
553
- ButtonGroup,
554
- Card,
555
- CardHeader,
556
- Paper,
557
- useTheme as useTheme3
558
- } from "@mui/material";
559
- import { asAddress } from "@xylabs/hex";
560
- import {
561
- FlexCol,
562
- FlexGrowRow,
563
- FlexRow
564
- } from "@xylabs/react-flexbox";
602
+ import { Box, Button, ButtonGroup, Card, CardHeader, Paper, useTheme as useTheme3 } from "@mui/material";
603
+ import { FlexCol, FlexGrowRow, FlexRow } from "@xylabs/react-flexbox";
565
604
  import { Identicon } from "@xylabs/react-identicon";
566
- import { isDefined as isDefined4 } from "@xylabs/typeof";
605
+ import { asAddress, isDefined as isDefined4 } from "@xylabs/sdk-js";
567
606
  import { useWeakModuleFromNode as useWeakModuleFromNode2 } from "@xyo-network/react-node";
568
607
  import cytoscape2 from "cytoscape";
569
608
  import cola2 from "cytoscape-cola";
570
609
  import coseBilkentLayout from "cytoscape-cose-bilkent";
571
610
  import dagre from "cytoscape-dagre";
572
611
  import euler from "cytoscape-euler";
573
- import {
574
- useEffect as useEffect4,
575
- useRef,
576
- useState as useState7
577
- } from "react";
578
- import { jsx as jsx5, jsxs } from "react/jsx-runtime";
579
- var applyLayout = (cy, name = "cola", options) => {
580
- cy?.layout({ name, ...options }).run();
581
- };
582
- var loadLayout = (layout = "cola") => {
612
+ import React5, { useEffect as useEffect4, useRef, useState as useState7 } from "react";
613
+ var applyLayout = /* @__PURE__ */ __name((cy, name = "cola", options) => {
614
+ cy?.layout({
615
+ name,
616
+ ...options
617
+ }).run();
618
+ }, "applyLayout");
619
+ var loadLayout = /* @__PURE__ */ __name((layout = "cola") => {
583
620
  switch (layout) {
584
621
  case "cose-bilkent": {
585
622
  cytoscape2.use(coseBilkentLayout);
@@ -602,48 +639,37 @@ var loadLayout = (layout = "cola") => {
602
639
  break;
603
640
  }
604
641
  }
605
- };
606
- var ModuleHoverDetails = ({
607
- name,
608
- address,
609
- ...props
610
- }) => {
611
- return /* @__PURE__ */ jsx5(Card, { elevation: 3, ...props, children: /* @__PURE__ */ jsx5(
612
- CardHeader,
613
- {
614
- avatar: /* @__PURE__ */ jsx5(
615
- Paper,
616
- {
617
- elevation: 6,
618
- sx: { bgcolor: "#fff", p: 1 },
619
- children: /* @__PURE__ */ jsx5(Identicon, { value: address, size: 24 })
620
- }
621
- ),
622
- title: name,
623
- subheader: address
624
- }
625
- ) });
626
- };
627
- var NodeRelationalGraphFlexBox = ({
628
- actions,
629
- children,
630
- node,
631
- layout,
632
- layoutOptions,
633
- showDetails,
634
- detail,
635
- options,
636
- onHover,
637
- ...props
638
- }) => {
642
+ }, "loadLayout");
643
+ var ModuleHoverDetails = /* @__PURE__ */ __name(({ name, address, ...props }) => {
644
+ return /* @__PURE__ */ React5.createElement(Card, {
645
+ elevation: 3,
646
+ ...props
647
+ }, /* @__PURE__ */ React5.createElement(CardHeader, {
648
+ avatar: /* @__PURE__ */ React5.createElement(Paper, {
649
+ elevation: 6,
650
+ sx: {
651
+ bgcolor: "#fff",
652
+ p: 1
653
+ }
654
+ }, /* @__PURE__ */ React5.createElement(Identicon, {
655
+ value: address,
656
+ size: 24
657
+ })),
658
+ title: name,
659
+ subheader: address
660
+ }));
661
+ }, "ModuleHoverDetails");
662
+ var NodeRelationalGraphFlexBox = /* @__PURE__ */ __name(({ actions, children, node, layout, layoutOptions, showDetails, detail, options, onHover, ...props }) => {
639
663
  const theme = useTheme3();
640
664
  const [cy, setCy] = useState7();
641
665
  const cytoscapeRef = useRef(null);
642
666
  const [hoverPosition, setHoverBoundingBox] = useState7();
643
667
  const [hoverAddress, setHoverAddress] = useState7();
644
- const [moduleInstance] = useWeakModuleFromNode2(hoverAddress, { node });
668
+ const [moduleInstance] = useWeakModuleFromNode2(hoverAddress, {
669
+ node
670
+ });
645
671
  useEffect4(() => {
646
- const listener = ({ target }) => {
672
+ const listener = /* @__PURE__ */ __name(({ target }) => {
647
673
  const cyNode = target;
648
674
  const bb = cyNode?.renderedBoundingBox?.();
649
675
  setHoverBoundingBox(bb);
@@ -657,16 +683,19 @@ var NodeRelationalGraphFlexBox = ({
657
683
  onHover?.(asAddress(id));
658
684
  }
659
685
  }
660
- };
686
+ }, "listener");
661
687
  cy?.on("mouseover tap", listener);
662
688
  return () => {
663
689
  cy?.off("mouseover tap", listener);
664
690
  };
665
- }, [onHover, cy]);
666
- const handleReset = () => {
691
+ }, [
692
+ onHover,
693
+ cy
694
+ ]);
695
+ const handleReset = /* @__PURE__ */ __name(() => {
667
696
  cy?.reset();
668
697
  applyLayout(cy, layout ?? "euler", layoutOptions);
669
- };
698
+ }, "handleReset");
670
699
  useEffect4(() => {
671
700
  let newCy;
672
701
  const container = cytoscapeRef.current;
@@ -684,117 +713,161 @@ var NodeRelationalGraphFlexBox = ({
684
713
  newCy?.destroy();
685
714
  setCy(void 0);
686
715
  };
687
- }, [options, cytoscapeRef, layoutOptions]);
716
+ }, [
717
+ options,
718
+ cytoscapeRef,
719
+ layoutOptions
720
+ ]);
688
721
  useEffect4(() => {
689
722
  if (cy) {
690
723
  loadLayout(layout);
691
724
  applyLayout(cy, layout ?? "cola", layoutOptions);
692
725
  }
693
- }, [cy, layoutOptions, layout]);
694
- return /* @__PURE__ */ jsxs(FlexCol, { id: "relational-graph-wrapper", ...props, children: [
695
- 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,
696
- /* @__PURE__ */ jsx5(FlexRow, { justifyContent: "start", width: "100%", children: actions === null ? null : isDefined4(actions) ? /* @__PURE__ */ jsxs(ButtonGroup, { children: [
697
- actions,
698
- /* @__PURE__ */ jsx5(Button, { size: "small", variant: "contained", onClick: handleReset, children: "Reset View" })
699
- ] }) : /* @__PURE__ */ jsx5(Button, { size: "small", variant: "contained", onClick: handleReset, children: "Reset" }) }),
700
- /* @__PURE__ */ jsxs(FlexGrowRow, { width: "100%", alignItems: "start", children: [
701
- showDetails ? /* @__PURE__ */ jsx5(FlexCol, { height: "100%", width: "85%", children: detail }) : null,
702
- /* @__PURE__ */ jsxs(
703
- FlexCol,
704
- {
705
- justifyContent: "start",
706
- classes: "cytoscape-wrap",
707
- width: showDetails ? "15%" : "100%",
708
- height: showDetails ? "50%" : "100%",
709
- border: showDetails ? `1px solid ${theme.vars.palette.divider}` : void 0,
710
- children: [
711
- /* @__PURE__ */ jsx5(FlexCol, { alignItems: "stretch", position: "absolute", width: "100%", height: "100%", ref: cytoscapeRef }),
712
- children
713
- ]
714
- }
715
- )
716
- ] })
717
- ] });
718
- };
726
+ }, [
727
+ cy,
728
+ layoutOptions,
729
+ layout
730
+ ]);
731
+ return /* @__PURE__ */ React5.createElement(FlexCol, {
732
+ id: "relational-graph-wrapper",
733
+ ...props
734
+ }, hoverAddress && hoverPosition ? /* @__PURE__ */ React5.createElement(Box, {
735
+ position: "absolute",
736
+ top: hoverPosition.y1,
737
+ left: hoverPosition.x1,
738
+ zIndex: 100
739
+ }, /* @__PURE__ */ React5.createElement(ModuleHoverDetails, {
740
+ address: hoverAddress,
741
+ name: moduleInstance?.deref()?.id ?? "Unknown"
742
+ })) : null, /* @__PURE__ */ React5.createElement(FlexRow, {
743
+ justifyContent: "start",
744
+ width: "100%"
745
+ }, actions === null ? null : isDefined4(actions) ? /* @__PURE__ */ React5.createElement(ButtonGroup, null, actions, /* @__PURE__ */ React5.createElement(Button, {
746
+ size: "small",
747
+ variant: "contained",
748
+ onClick: handleReset
749
+ }, "Reset View")) : /* @__PURE__ */ React5.createElement(Button, {
750
+ size: "small",
751
+ variant: "contained",
752
+ onClick: handleReset
753
+ }, "Reset")), /* @__PURE__ */ React5.createElement(FlexGrowRow, {
754
+ width: "100%",
755
+ alignItems: "start"
756
+ }, showDetails ? /* @__PURE__ */ React5.createElement(FlexCol, {
757
+ height: "100%",
758
+ width: "85%"
759
+ }, detail) : null, /* @__PURE__ */ React5.createElement(FlexCol, {
760
+ justifyContent: "start",
761
+ classes: "cytoscape-wrap",
762
+ width: showDetails ? "15%" : "100%",
763
+ height: showDetails ? "50%" : "100%",
764
+ border: showDetails ? `1px solid ${theme.vars.palette.divider}` : void 0
765
+ }, /* @__PURE__ */ React5.createElement(FlexCol, {
766
+ alignItems: "stretch",
767
+ position: "absolute",
768
+ width: "100%",
769
+ height: "100%",
770
+ ref: cytoscapeRef
771
+ }), children)));
772
+ }, "NodeRelationalGraphFlexBox");
719
773
  NodeRelationalGraphFlexBox.displayName = "NodeRelationalGraph";
720
774
  var NodeRelationalGraph = NodeRelationalGraphFlexBox;
721
775
 
722
776
  // src/components/relational/graph/ProvidedNodeRenderer.tsx
723
777
  import { useWeakProvidedNode } from "@xyo-network/react-node";
724
- import { jsx as jsx6 } from "react/jsx-runtime";
725
- var ProvidedNodeRenderer = ({ node, ...props }) => {
778
+ import React6 from "react";
779
+ var ProvidedNodeRenderer = /* @__PURE__ */ __name(({ node, ...props }) => {
726
780
  const [providedNode] = useWeakProvidedNode();
727
781
  const elements = useCytoscapeElements(node ?? providedNode);
728
782
  const options = useCytoscapeOptions(elements);
729
- return /* @__PURE__ */ jsx6(NodeRelationalGraphFlexBox, { alignItems: "stretch", flexGrow: 1, height: "100%", options, ...props });
730
- };
783
+ return /* @__PURE__ */ React6.createElement(NodeRelationalGraphFlexBox, {
784
+ alignItems: "stretch",
785
+ flexGrow: 1,
786
+ height: "100%",
787
+ options,
788
+ ...props
789
+ });
790
+ }, "ProvidedNodeRenderer");
731
791
 
732
792
  // src/components/module/graph/DetailsFlexbox.tsx
733
793
  import { CancelRounded } from "@mui/icons-material";
734
794
  import { IconButton } from "@mui/material";
735
795
  import { FlexGrowCol, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
736
- import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
737
- var DetailsFlexbox = ({ children, onClose }) => {
738
- return /* @__PURE__ */ jsxs2(FlexGrowCol, { alignItems: "end", justifyContent: "start", id: "module-detail", width: "100%", p: 2, gap: 2, children: [
739
- /* @__PURE__ */ jsx7(FlexRow2, { justifyContent: "end", children: /* @__PURE__ */ jsx7(IconButton, { onClick: onClose, size: "small", children: /* @__PURE__ */ jsx7(CancelRounded, {}) }) }),
740
- children
741
- ] });
742
- };
796
+ import React7 from "react";
797
+ var DetailsFlexbox = /* @__PURE__ */ __name(({ children, onClose }) => {
798
+ return /* @__PURE__ */ React7.createElement(FlexGrowCol, {
799
+ alignItems: "end",
800
+ justifyContent: "start",
801
+ id: "module-detail",
802
+ width: "100%",
803
+ p: 2,
804
+ gap: 2
805
+ }, /* @__PURE__ */ React7.createElement(FlexRow2, {
806
+ justifyContent: "end"
807
+ }, /* @__PURE__ */ React7.createElement(IconButton, {
808
+ onClick: onClose,
809
+ size: "small"
810
+ }, /* @__PURE__ */ React7.createElement(CancelRounded, null))), children);
811
+ }, "DetailsFlexbox");
743
812
 
744
813
  // src/components/module/graph/node/Hover.tsx
745
814
  import { styled } from "@mui/material";
746
815
  import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
816
+ import React8 from "react";
747
817
 
748
818
  // src/components/module/graph/node/hooks/useNodeElement.tsx
749
- import {
750
- useEffect as useEffect5,
751
- useMemo as useMemo8,
752
- useRef as useRef2,
753
- useState as useState8
754
- } from "react";
755
- var useNodeElement = (node) => {
819
+ import { useEffect as useEffect5, useMemo as useMemo8, useRef as useRef2, useState as useState8 } from "react";
820
+ var useNodeElement = /* @__PURE__ */ __name((node) => {
756
821
  const ref = useRef2(null);
757
822
  const [currentElement, setCurrentElement] = useState8(null);
758
823
  const [boundingBox, setBoundingBox] = useState8(node?.renderedBoundingBox());
759
824
  useMemo8(() => {
760
825
  setCurrentElement(null);
761
- }, [node]);
826
+ }, [
827
+ node
828
+ ]);
762
829
  useMemo8(() => {
763
830
  setBoundingBox(node?.renderedBoundingBox());
764
- }, [node]);
831
+ }, [
832
+ node
833
+ ]);
765
834
  useEffect5(() => {
766
- const listener = () => {
835
+ const listener = /* @__PURE__ */ __name(() => {
767
836
  setBoundingBox(node?.renderedBoundingBox());
768
- };
837
+ }, "listener");
769
838
  node?.on("position", listener);
770
839
  return () => {
771
840
  node?.off("position", void 0, listener);
772
841
  };
773
- }, [node]);
842
+ }, [
843
+ node
844
+ ]);
774
845
  useMemo8(() => {
775
846
  setCurrentElement(ref.current);
776
- }, [boundingBox]);
847
+ }, [
848
+ boundingBox
849
+ ]);
777
850
  return {
778
851
  boundingBox,
779
852
  currentElement,
780
853
  ref
781
854
  };
782
- };
855
+ }, "useNodeElement");
783
856
 
784
857
  // src/components/module/graph/node/Hover.tsx
785
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
786
- var ModuleGraphNodeHover = ({ children, node }) => {
787
- const {
788
- boundingBox,
858
+ var ModuleGraphNodeHover = /* @__PURE__ */ __name(({ children, node }) => {
859
+ const { boundingBox, ref, currentElement } = useNodeElement(node);
860
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(StyledNodeGhostElementFlexCol, {
789
861
  ref,
790
- currentElement
791
- } = useNodeElement(node);
792
- return /* @__PURE__ */ jsxs3(Fragment2, { children: [
793
- /* @__PURE__ */ jsx8(StyledNodeGhostElementFlexCol, { ref, left: boundingBox?.x1, height: boundingBox?.h, top: boundingBox?.y1, width: boundingBox?.w }),
794
- node ? /* @__PURE__ */ jsx8(Fragment2, { children: children?.(currentElement) }) : null
795
- ] });
796
- };
797
- var StyledNodeGhostElementFlexCol = styled(FlexCol2, { name: "StyledNodeGhostElementFlexCol" })(() => ({
862
+ left: boundingBox?.x1,
863
+ height: boundingBox?.h,
864
+ top: boundingBox?.y1,
865
+ width: boundingBox?.w
866
+ }), node ? /* @__PURE__ */ React8.createElement(React8.Fragment, null, children?.(currentElement)) : null);
867
+ }, "ModuleGraphNodeHover");
868
+ var StyledNodeGhostElementFlexCol = styled(FlexCol2, {
869
+ name: "StyledNodeGhostElementFlexCol"
870
+ })(() => ({
798
871
  // For easier debugging of the 'ghost' element that matches the hovered cytoscape node
799
872
  // backgroundColor: '#fff',
800
873
  // opacity: 0.25,
@@ -805,105 +878,91 @@ var StyledNodeGhostElementFlexCol = styled(FlexCol2, { name: "StyledNodeGhostEle
805
878
 
806
879
  // src/components/module/graph/Popper.tsx
807
880
  import { CancelRounded as CancelRounded2 } from "@mui/icons-material";
808
- import {
809
- Button as Button2,
810
- Card as Card2,
811
- CardActions,
812
- CardHeader as CardHeader2,
813
- IconButton as IconButton2,
814
- Paper as Paper2,
815
- Popper,
816
- styled as styled2
817
- } from "@mui/material";
881
+ import { Button as Button2, Card as Card2, CardActions, CardHeader as CardHeader2, IconButton as IconButton2, Paper as Paper2, Popper, styled as styled2 } from "@mui/material";
818
882
  import { Identicon as Identicon2 } from "@xylabs/react-identicon";
819
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
820
- var ModuleHoverPopper = ({
821
- anchorEl,
822
- onClose,
823
- onModuleDetails,
824
- onModuleExplore,
825
- node,
826
- ...props
827
- }) => {
883
+ import React9 from "react";
884
+ var ModuleHoverPopper = /* @__PURE__ */ __name(({ anchorEl, onClose, onModuleDetails, onModuleExplore, node, ...props }) => {
828
885
  const { address, name } = node?.data() ?? {};
829
- return /* @__PURE__ */ jsx9(Fragment3, { children: anchorEl ? /* @__PURE__ */ jsx9(Popper, { anchorEl, ...props, children: /* @__PURE__ */ jsxs4(Card2, { elevation: 3, children: [
830
- /* @__PURE__ */ jsx9(
831
- CardHeader2,
832
- {
833
- action: onClose ? /* @__PURE__ */ jsx9(IconButton2, { size: "small", onClick: onClose, children: /* @__PURE__ */ jsx9(CancelRounded2, {}) }) : null,
834
- avatar: /* @__PURE__ */ jsx9(
835
- Paper2,
836
- {
837
- elevation: 6,
838
- sx: { bgcolor: "#fff", p: 1 },
839
- children: /* @__PURE__ */ jsx9(Identicon2, { value: address, size: 24 })
840
- }
841
- ),
842
- title: name,
843
- subheader: address
886
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, anchorEl ? /* @__PURE__ */ React9.createElement(Popper, {
887
+ anchorEl,
888
+ ...props
889
+ }, /* @__PURE__ */ React9.createElement(Card2, {
890
+ elevation: 3
891
+ }, /* @__PURE__ */ React9.createElement(CardHeader2, {
892
+ action: onClose ? /* @__PURE__ */ React9.createElement(IconButton2, {
893
+ size: "small",
894
+ onClick: onClose
895
+ }, /* @__PURE__ */ React9.createElement(CancelRounded2, null)) : null,
896
+ avatar: /* @__PURE__ */ React9.createElement(Paper2, {
897
+ elevation: 6,
898
+ sx: {
899
+ bgcolor: "#fff",
900
+ p: 1
844
901
  }
845
- ),
846
- /* @__PURE__ */ jsxs4(StyledCardActions, { children: [
847
- onModuleDetails ? /* @__PURE__ */ jsx9(Button2, { onClick: () => onModuleDetails?.(address), size: "small", variant: "contained", children: "Details" }) : null,
848
- onModuleExplore ? /* @__PURE__ */ jsx9(Button2, { onClick: () => onModuleExplore?.(address), size: "small", variant: "contained", children: "Explore" }) : null
849
- ] })
850
- ] }) }) : null });
851
- };
852
- var StyledModuleHoverPopper = styled2(ModuleHoverPopper, { name: "StyledComponents" })(() => ({ zIndex: 2 }));
853
- var StyledCardActions = styled2(CardActions, { name: "StyledCardActions" })(() => ({
902
+ }, /* @__PURE__ */ React9.createElement(Identicon2, {
903
+ value: address,
904
+ size: 24
905
+ })),
906
+ title: name,
907
+ subheader: address
908
+ }), /* @__PURE__ */ React9.createElement(StyledCardActions, null, onModuleDetails ? /* @__PURE__ */ React9.createElement(Button2, {
909
+ onClick: /* @__PURE__ */ __name(() => onModuleDetails?.(address), "onClick"),
910
+ size: "small",
911
+ variant: "contained"
912
+ }, "Details") : null, onModuleExplore ? /* @__PURE__ */ React9.createElement(Button2, {
913
+ onClick: /* @__PURE__ */ __name(() => onModuleExplore?.(address), "onClick"),
914
+ size: "small",
915
+ variant: "contained"
916
+ }, "Explore") : null))) : null);
917
+ }, "ModuleHoverPopper");
918
+ var StyledModuleHoverPopper = styled2(ModuleHoverPopper, {
919
+ name: "StyledComponents"
920
+ })(() => ({
921
+ zIndex: 2
922
+ }));
923
+ var StyledCardActions = styled2(CardActions, {
924
+ name: "StyledCardActions"
925
+ })(() => ({
854
926
  display: "flex",
855
927
  justifyContent: "center"
856
928
  }));
857
929
 
858
930
  // src/components/module/graph/GraphFlexBox.tsx
859
- import { jsx as jsx10 } from "react/jsx-runtime";
860
- var ModuleGraphFlexBox = ({
861
- hideActions,
862
- rootModule,
863
- disableModuleDetails,
864
- ...props
865
- }) => {
931
+ var ModuleGraphFlexBox = /* @__PURE__ */ __name(({ hideActions, rootModule, disableModuleDetails, ...props }) => {
866
932
  const cytoscapeRef = useRef3(null);
867
- const {
868
- handleToggleLabels,
869
- hideLabels,
870
- options
871
- } = useRelationalGraphOptions(rootModule ?? void 0);
872
- const {
873
- hoveredNode,
874
- setHoveredNode,
875
- toggleSelectedElement
876
- } = useElements(hideLabels);
933
+ const { handleToggleLabels, hideLabels, options } = useRelationalGraphOptions(rootModule ?? void 0);
934
+ const { hoveredNode, setHoveredNode, toggleSelectedElement } = useElements(hideLabels);
877
935
  const { mod, onModuleDetails } = useModuleDetails(rootModule, () => setHoveredNode(void 0));
878
- return /* @__PURE__ */ jsx10(WithExtensions, { children: /* @__PURE__ */ jsx10(
879
- NodeRelationalGraphFlexBox,
880
- {
881
- actions: mod ? null : hideActions ? null : /* @__PURE__ */ jsx10(Button3, { size: "small", onClick: handleToggleLabels, variant: "contained", children: "Toggle Labels" }),
882
- showDetails: !!mod,
883
- detail: /* @__PURE__ */ jsx10(DetailsFlexbox, { onClose: () => onModuleDetails(null) }),
884
- options,
885
- ref: cytoscapeRef,
886
- width: "100%",
887
- ...props,
888
- children: /* @__PURE__ */ jsx10(ModuleGraphNodeHover, { node: hoveredNode, children: (element) => /* @__PURE__ */ jsx10(
889
- StyledModuleHoverPopper,
890
- {
891
- anchorEl: element,
892
- container: cytoscapeRef.current,
893
- node: hoveredNode,
894
- onClose: () => setHoveredNode(void 0),
895
- onModuleExplore: toggleSelectedElement,
896
- onModuleDetails: disableModuleDetails ? void 0 : onModuleDetails,
897
- placement: "top",
898
- open: true
899
- }
900
- ) })
901
- }
902
- ) });
903
- };
904
- var ModuleGraphFlexBoxWithProvider = (props) => {
905
- return /* @__PURE__ */ jsx10(CytoscapeInstanceProvider, { children: /* @__PURE__ */ jsx10(ModuleGraphFlexBox, { ...props }) });
906
- };
936
+ return /* @__PURE__ */ React10.createElement(WithExtensions, null, /* @__PURE__ */ React10.createElement(NodeRelationalGraphFlexBox, {
937
+ actions: mod ? null : hideActions ? null : /* @__PURE__ */ React10.createElement(Button3, {
938
+ size: "small",
939
+ onClick: handleToggleLabels,
940
+ variant: "contained"
941
+ }, "Toggle Labels"),
942
+ showDetails: !!mod,
943
+ detail: /* @__PURE__ */ React10.createElement(DetailsFlexbox, {
944
+ onClose: /* @__PURE__ */ __name(() => onModuleDetails(null), "onClose")
945
+ }),
946
+ options,
947
+ ref: cytoscapeRef,
948
+ width: "100%",
949
+ ...props
950
+ }, /* @__PURE__ */ React10.createElement(ModuleGraphNodeHover, {
951
+ node: hoveredNode
952
+ }, (element) => /* @__PURE__ */ React10.createElement(StyledModuleHoverPopper, {
953
+ anchorEl: element,
954
+ container: cytoscapeRef.current,
955
+ node: hoveredNode,
956
+ onClose: /* @__PURE__ */ __name(() => setHoveredNode(void 0), "onClose"),
957
+ onModuleExplore: toggleSelectedElement,
958
+ onModuleDetails: disableModuleDetails ? void 0 : onModuleDetails,
959
+ placement: "top",
960
+ open: true
961
+ }))));
962
+ }, "ModuleGraphFlexBox");
963
+ var ModuleGraphFlexBoxWithProvider = /* @__PURE__ */ __name((props) => {
964
+ return /* @__PURE__ */ React10.createElement(CytoscapeInstanceProvider, null, /* @__PURE__ */ React10.createElement(ModuleGraphFlexBox, props));
965
+ }, "ModuleGraphFlexBoxWithProvider");
907
966
  export {
908
967
  ColaLayout,
909
968
  ConcentricLayout,