@xyo-network/react-node-renderer 7.5.8 → 7.5.12

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 (77) hide show
  1. package/dist/browser/Cytoscape/CytoscapeElements.d.ts +2 -6
  2. package/dist/browser/Cytoscape/CytoscapeElements.d.ts.map +1 -1
  3. package/dist/browser/components/module/graph/Popper.d.ts +3 -2
  4. package/dist/browser/components/module/graph/Popper.d.ts.map +1 -1
  5. package/dist/browser/components/module/graph/node/hooks/useNodeElement.d.ts +8 -5
  6. package/dist/browser/components/module/graph/node/hooks/useNodeElement.d.ts.map +1 -1
  7. package/dist/browser/components/relational/graph/Graph.d.ts.map +1 -1
  8. package/dist/browser/hooks/cytoscape/elements/useRenderNewElements.d.ts +1 -1
  9. package/dist/browser/hooks/cytoscape/elements/useRenderNewElements.d.ts.map +1 -1
  10. package/dist/browser/index.mjs +362 -423
  11. package/dist/browser/index.mjs.map +1 -1
  12. package/package.json +188 -59
  13. package/src/Cytoscape/CytoscapeElements.ts +0 -96
  14. package/src/Cytoscape/CytoscapeIcons.tsx +0 -23
  15. package/src/Cytoscape/CytoscapeStyles.ts +0 -46
  16. package/src/Cytoscape/index.ts +0 -4
  17. package/src/Cytoscape/lib/CyNodeModuleTypes.ts +0 -1
  18. package/src/Cytoscape/lib/encodeSvg.ts +0 -19
  19. package/src/Cytoscape/lib/iconMap.ts +0 -12
  20. package/src/Cytoscape/lib/index.ts +0 -5
  21. package/src/Cytoscape/lib/layout/ColaLayout.ts +0 -5
  22. package/src/Cytoscape/lib/layout/ConcentricLayout.ts +0 -12
  23. package/src/Cytoscape/lib/layout/index.ts +0 -2
  24. package/src/Cytoscape/lib/parseModuleType.ts +0 -29
  25. package/src/components/cytoscape-extensions/WithExtensions.tsx +0 -16
  26. package/src/components/cytoscape-extensions/index.ts +0 -1
  27. package/src/components/index.ts +0 -3
  28. package/src/components/lib/RelationalGraphProps.ts +0 -16
  29. package/src/components/lib/index.ts +0 -1
  30. package/src/components/module/CardParser.stories.tsx +0 -36
  31. package/src/components/module/CardParser.tsx +0 -24
  32. package/src/components/module/graph/DetailsFlexbox.tsx +0 -22
  33. package/src/components/module/graph/GraphFlexBox.stories.tsx +0 -118
  34. package/src/components/module/graph/GraphFlexBox.tsx +0 -84
  35. package/src/components/module/graph/Popper.tsx +0 -77
  36. package/src/components/module/graph/index.ts +0 -1
  37. package/src/components/module/graph/node/Hover.tsx +0 -38
  38. package/src/components/module/graph/node/hooks/index.ts +0 -1
  39. package/src/components/module/graph/node/hooks/useNodeElement.tsx +0 -41
  40. package/src/components/module/graph/node/index.ts +0 -1
  41. package/src/components/module/index.ts +0 -2
  42. package/src/components/relational/graph/Graph.stories.tsx +0 -201
  43. package/src/components/relational/graph/Graph.tsx +0 -200
  44. package/src/components/relational/graph/GraphCola.stories.tsx +0 -187
  45. package/src/components/relational/graph/GraphCoseBilkent.stories.tsx +0 -186
  46. package/src/components/relational/graph/GraphDagre.stories.tsx +0 -186
  47. package/src/components/relational/graph/GraphEuler.stories.tsx +0 -187
  48. package/src/components/relational/graph/GraphEvents.stories.tsx +0 -82
  49. package/src/components/relational/graph/ProvidedNodeRenderer.tsx +0 -23
  50. package/src/components/relational/graph/index.ts +0 -2
  51. package/src/components/relational/graph/story/TestData.tsx +0 -51
  52. package/src/components/relational/graph/story/index.ts +0 -1
  53. package/src/components/relational/index.ts +0 -1
  54. package/src/contexts/CytoscapeInstance/Context.ts +0 -5
  55. package/src/contexts/CytoscapeInstance/Provider.tsx +0 -24
  56. package/src/contexts/CytoscapeInstance/State.ts +0 -8
  57. package/src/contexts/CytoscapeInstance/index.ts +0 -4
  58. package/src/contexts/CytoscapeInstance/use.ts +0 -5
  59. package/src/contexts/index.ts +0 -1
  60. package/src/hooks/cytoscape/elements/index.ts +0 -2
  61. package/src/hooks/cytoscape/elements/useCytoscapeElements.ts +0 -47
  62. package/src/hooks/cytoscape/elements/useElements.tsx +0 -15
  63. package/src/hooks/cytoscape/elements/useHoveredNode.tsx +0 -34
  64. package/src/hooks/cytoscape/elements/useNewElements.tsx +0 -17
  65. package/src/hooks/cytoscape/elements/useRenderNewElements.tsx +0 -17
  66. package/src/hooks/cytoscape/elements/useSelectedElement.tsx +0 -25
  67. package/src/hooks/cytoscape/index.ts +0 -4
  68. package/src/hooks/cytoscape/useCytoscapeOptions.ts +0 -29
  69. package/src/hooks/cytoscape/useCytoscapeStyle.tsx +0 -34
  70. package/src/hooks/cytoscape/useIcons.tsx +0 -22
  71. package/src/hooks/cytoscape/useModuleDetails.tsx +0 -83
  72. package/src/hooks/cytoscape/useRelationalGraphOptions.tsx +0 -23
  73. package/src/hooks/index.ts +0 -1
  74. package/src/index.ts +0 -4
  75. package/src/types/global.d.ts +0 -19
  76. package/src/types/images.d.ts +0 -5
  77. package/src/types/theme.d.ts +0 -1
@@ -1,83 +0,0 @@
1
- import { usePromise } from '@xylabs/react-promise'
2
- import {
3
- isDefined, isDefinedNotNull, isTruthy,
4
- } from '@xylabs/sdk-js'
5
- import type { ModuleInstance } from '@xyo-network/module-model'
6
- import {
7
- useCallback, useEffect, useState,
8
- } from 'react'
9
-
10
- import { useCytoscapeInstance } from '../../contexts/index.ts'
11
-
12
- export const useModuleDetails = (rootModule?: WeakRef<ModuleInstance> | null, onFoundModule?: () => void) => {
13
- const { cy } = useCytoscapeInstance()
14
- const [moduleAddress, setModuleAddress] = useState<string | null>()
15
-
16
- const [foundModule] = usePromise(async () => {
17
- if (moduleAddress === null) return null
18
- const rootModuleInstance = rootModule?.deref()
19
- if (isDefined(moduleAddress) && isDefined(rootModuleInstance)) {
20
- const foundModule = await rootModuleInstance.resolve(moduleAddress)
21
- return foundModule ?? null
22
- }
23
- }, [moduleAddress, rootModule])
24
-
25
- const createObserver = useCallback(() => {
26
- return new ResizeObserver(() => {
27
- if (moduleAddress === null) {
28
- // cytoscape tries to center prematurely without it :(
29
- setTimeout(() => {
30
- cy?.deref()?.center()
31
- }, 100)
32
- } else if (foundModule && cy) {
33
- const node = cy?.deref()?.nodes(`[id="${moduleAddress}"]`)?.[0]
34
- // cy.pan(newPan)
35
- // cytoscape tries to center prematurely without it :(
36
- setTimeout(() => {
37
- cy?.deref()?.center(node)
38
- }, 100)
39
- }
40
- })
41
- }, [cy, moduleAddress, foundModule])
42
-
43
- useEffect(() => {
44
- const resizeObserver = createObserver()
45
-
46
- const container = cy?.deref()?.container()
47
- if (container) {
48
- resizeObserver.observe(container)
49
- }
50
-
51
- return () => {
52
- if (container) resizeObserver.unobserve(container)
53
- }
54
- }, [cy, moduleAddress, foundModule, rootModule])
55
-
56
- useEffect(() => {
57
- if (foundModule) {
58
- onFoundModule?.()
59
- }
60
- }, [cy, moduleAddress, foundModule, onFoundModule, createObserver])
61
-
62
- // eslint-disable-next-line complexity
63
- const onModuleDetails = (address?: string | null) => {
64
- const moduleNode = cy?.deref()?.nodes(`[id="${address}"]`)
65
- const rootModuleNode = cy?.deref()?.nodes(`[id="${rootModule?.deref()?.address}"]`)
66
- const foundModuleNode = cy?.deref()?.nodes(`[id="${foundModule?.address}"]`)
67
- const notModuleNode = cy?.deref()?.nodes(`[id != "${address}"]`)
68
-
69
- if (isTruthy(address)) {
70
- // address was passed so we set the node to active styles
71
- moduleNode?.toggleClass('activeNode', true)
72
- notModuleNode?.toggleClass('activeNode', false)
73
- } else {
74
- // no address was passes so we reset the state
75
- notModuleNode?.toggleClass('activeNode', false)
76
- const activeNode = isDefinedNotNull(foundModuleNode) && foundModuleNode.length > 0 ? foundModuleNode : rootModuleNode
77
- activeNode?.toggleClass('activeNode', true)
78
- }
79
- setModuleAddress(address)
80
- }
81
-
82
- return { mod: foundModule, onModuleDetails }
83
- }
@@ -1,23 +0,0 @@
1
- import type { ModuleInstance } from '@xyo-network/module-model'
2
- import { useState } from 'react'
3
-
4
- import { ConcentricLayout } from '../../Cytoscape/index.ts'
5
- import { useCytoscapeElements } from './elements/index.ts'
6
- import { useCytoscapeOptions } from './useCytoscapeOptions.ts'
7
- import { useCytoscapeStyle } from './useCytoscapeStyle.tsx'
8
-
9
- export const useRelationalGraphOptions = (mod?: WeakRef<ModuleInstance>) => {
10
- const [hideLabels, setHideLabels] = useState(true)
11
-
12
- const handleToggleLabels = () => {
13
- setHideLabels(oldValue => !oldValue)
14
- }
15
-
16
- const elements = useCytoscapeElements(mod)
17
- const style = useCytoscapeStyle(hideLabels)
18
- const options = useCytoscapeOptions(elements, style, ConcentricLayout)
19
-
20
- return {
21
- handleToggleLabels, hideLabels, options,
22
- }
23
- }
@@ -1 +0,0 @@
1
- export * from './cytoscape/index.ts'
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './components/index.ts'
2
- export * from './contexts/index.ts'
3
- export * from './Cytoscape/index.ts'
4
- export * from './hooks/index.ts'
@@ -1,19 +0,0 @@
1
- declare module 'cytoscape-cola' {
2
- const ext: cytoscape.Ext
3
- export = ext
4
- }
5
-
6
- declare module 'cytoscape-cose-bilkent' {
7
- const ext: cytoscape.Ext
8
- export = ext
9
- }
10
-
11
- declare module 'cytoscape-euler' {
12
- const ext: cytoscape.Ext
13
- export = ext
14
- }
15
-
16
- declare module 'cytoscape-dagre' {
17
- const ext: cytoscape.Ext
18
- export = ext
19
- }
@@ -1,5 +0,0 @@
1
- declare module '*.png'
2
- declare module '*.jpg'
3
- declare module '*.svg'
4
- declare module '*.gif'
5
- declare module '*.webp'
@@ -1 +0,0 @@
1
- import '@mui/material/themeCssVarsAugmentation'