@teambit/graph 1.0.268 → 1.0.270

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.
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_graph@1.0.268/dist/graph.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_graph@1.0.268/dist/graph.docs.md';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_graph@1.0.270/dist/graph.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_graph@1.0.270/dist/graph.docs.md';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -32,9 +32,9 @@ function _react() {
32
32
  };
33
33
  return data;
34
34
  }
35
- function _reactFlowRenderer() {
36
- const data = _interopRequireWildcard(require("react-flow-renderer"));
37
- _reactFlowRenderer = function () {
35
+ function _reactflow() {
36
+ const data = _interopRequireWildcard(require("reactflow"));
37
+ _reactflow = function () {
38
38
  return data;
39
39
  };
40
40
  return data;
@@ -86,13 +86,12 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
86
86
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
87
87
  function ComponentNodeContainer(props) {
88
88
  const {
89
- sourcePosition = _reactFlowRenderer().Position.Top,
90
- targetPosition = _reactFlowRenderer().Position.Bottom,
89
+ sourcePosition = _reactflow().Position.Top,
90
+ targetPosition = _reactflow().Position.Bottom,
91
91
  data,
92
92
  id
93
93
  } = props;
94
- // @todo - this will be fixed as part of the react-flow-renderer v10 upgrade
95
- const ReactFlowHandle = _reactFlowRenderer().Handle;
94
+ const ReactFlowHandle = _reactflow().Handle;
96
95
  return /*#__PURE__*/_react().default.createElement("div", {
97
96
  key: id
98
97
  }, /*#__PURE__*/_react().default.createElement(ReactFlowHandle, {
@@ -108,10 +107,10 @@ function ComponentNodeContainer(props) {
108
107
  type: data.type
109
108
  }));
110
109
  }
111
- const NodeTypes = {
112
- ComponentNode: ComponentNodeContainer
113
- };
114
110
  function DependenciesCompare() {
111
+ const nodeTypes = _react().default.useMemo(() => ({
112
+ ComponentNode: ComponentNodeContainer
113
+ }), []);
115
114
  const graphRef = (0, _react().useRef)();
116
115
  const componentCompare = (0, _componentUiComponentCompare().useComponentCompare)();
117
116
  const baseId = componentCompare?.base?.model.id;
@@ -133,16 +132,24 @@ function DependenciesCompare() {
133
132
  });
134
133
  (0, _react().useEffect)(() => () => graphRef.current = undefined, []);
135
134
  (0, _react().useEffect)(() => {
136
- graphRef.current?.fitView();
137
- }, [elements]);
135
+ setTimeout(() => {
136
+ if (graph && graph.nodes.length <= 3) return graphRef.current?.fitView({
137
+ padding: 2
138
+ });
139
+ return graphRef.current?.fitView();
140
+ }, 0);
141
+ }, [graph]);
138
142
  const handleLoad = (0, _react().useCallback)(instance => {
139
143
  graphRef.current = instance;
140
144
  if ((graph?.nodes.length ?? 0) <= 3) {
141
145
  graphRef.current?.fitView({
142
- padding: 2
146
+ padding: 2,
147
+ maxZoom: 1
143
148
  });
144
149
  } else {
145
- instance.fitView();
150
+ instance.fitView({
151
+ maxZoom: 1
152
+ });
146
153
  }
147
154
  }, [graph?.nodes.length]);
148
155
  (0, _react().useEffect)(() => {
@@ -156,14 +163,14 @@ function DependenciesCompare() {
156
163
  const onCheckFilter = _isFiltered => {
157
164
  setFilter(_isFiltered ? 'runtimeOnly' : undefined);
158
165
  };
159
- if (!loading && (!baseGraph || !compareGraph)) {
166
+ if (!loading && !graph) {
160
167
  return /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null);
161
168
  }
162
169
  return /*#__PURE__*/_react().default.createElement("div", {
163
170
  className: (0, _classnames().default)([_dependenciesCompareModule().default.page, _graphPage().styles.graph])
164
171
  }, loading && /*#__PURE__*/_react().default.createElement("div", {
165
172
  className: _dependenciesCompareModule().default.loader
166
- }, /*#__PURE__*/_react().default.createElement(_designUi().RoundLoader, null)), /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().ReactFlowProvider, null, /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().default, {
173
+ }, /*#__PURE__*/_react().default.createElement(_designUi().RoundLoader, null)), !loading && /*#__PURE__*/_react().default.createElement(_reactflow().ReactFlowProvider, null, /*#__PURE__*/_react().default.createElement(_reactflow().default, {
167
174
  draggable: false,
168
175
  nodesDraggable: true,
169
176
  selectNodesOnDrag: false,
@@ -173,12 +180,16 @@ function DependenciesCompare() {
173
180
  maxZoom: 100,
174
181
  minZoom: 0,
175
182
  className: _dependenciesGraph().styles.graph,
176
- elements: elements,
177
- nodeTypes: NodeTypes,
178
- onLoad: handleLoad
179
- }, /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().Background, null), /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().Controls, {
183
+ defaultNodes: elements.nodes,
184
+ defaultEdges: elements.edges,
185
+ nodeTypes: nodeTypes,
186
+ onInit: handleLoad,
187
+ proOptions: {
188
+ hideAttribution: true
189
+ }
190
+ }, /*#__PURE__*/_react().default.createElement(_reactflow().Background, null), /*#__PURE__*/_react().default.createElement(_reactflow().Controls, {
180
191
  className: _dependenciesGraph().styles.controls
181
- }), /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().MiniMap, {
192
+ }), /*#__PURE__*/_react().default.createElement(_reactflow().MiniMap, {
182
193
  nodeColor: _dependenciesGraph().calcMinimapColors,
183
194
  className: _dependenciesGraph().styles.minimap
184
195
  }), /*#__PURE__*/_react().default.createElement(_graphPage().GraphFilters, {
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","data","_interopRequireDefault","require","_designUi","_componentUiComponentCompare","_react","_interopRequireWildcard","_reactFlowRenderer","_query","_graphPage","_dependenciesGraph","_dependenciesCompareModule","_dependencyCompareNode","_diffGraph","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","obj","ComponentNodeContainer","props","sourcePosition","Position","Top","targetPosition","Bottom","id","ReactFlowHandle","Handle","createElement","key","type","position","isConnectable","DependencyCompareNode","node","NodeTypes","ComponentNode","DependenciesCompare","graphRef","useRef","componentCompare","useComponentCompare","baseId","base","model","compareId","compare","filter","setFilter","useState","isFiltered","loading","baseLoading","graph","baseGraph","useGraphQuery","toString","compareLoading","compareGraph","diffGraph","undefined","elements","calcElements","rootNode","useEffect","current","fitView","handleLoad","useCallback","instance","nodes","length","padding","setTimeout","onCheckFilter","_isFiltered","Fragment","className","classNames","styles","page","graphPageStyles","loader","RoundLoader","ReactFlowProvider","draggable","nodesDraggable","selectNodesOnDrag","nodesConnectable","zoomOnDoubleClick","elementsSelectable","maxZoom","minZoom","dependenciesGraphStyles","nodeTypes","onLoad","Background","Controls","controls","MiniMap","nodeColor","calcMinimapColors","minimap","GraphFilters","filters","disable","onChangeFilter"],"sources":["dependencies-compare.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { RoundLoader } from '@teambit/design.ui.round-loader';\nimport { useComponentCompare } from '@teambit/component.ui.component-compare.context';\nimport React, { useEffect, useRef, useState, useCallback } from 'react';\nimport ReactFlow, {\n Background,\n Controls,\n Handle,\n MiniMap,\n NodeProps,\n NodeTypesType,\n OnLoadParams,\n Position,\n ReactFlowProvider,\n} from 'react-flow-renderer';\nimport { useGraphQuery } from '../query';\nimport { GraphFilter } from '../../model/graph-filters';\nimport { GraphFilters, styles as graphPageStyles } from '../graph-page';\nimport { calcMinimapColors, calcElements, styles as dependenciesGraphStyles } from '../dependencies-graph';\nimport styles from './dependencies-compare.module.scss';\nimport { DependencyCompareNode } from './dependency-compare-node';\nimport { diffGraph } from './diff-graph';\n\nfunction ComponentNodeContainer(props: NodeProps) {\n const { sourcePosition = Position.Top, targetPosition = Position.Bottom, data, id } = props;\n // @todo - this will be fixed as part of the react-flow-renderer v10 upgrade\n const ReactFlowHandle = Handle as any;\n return (\n <div key={id}>\n <ReactFlowHandle type=\"target\" position={targetPosition} isConnectable={false} />\n <ReactFlowHandle type=\"source\" position={sourcePosition} isConnectable={false} />\n <DependencyCompareNode node={data.node} type={data.type} />\n </div>\n );\n}\n\nconst NodeTypes: NodeTypesType = { ComponentNode: ComponentNodeContainer };\n\nexport function DependenciesCompare() {\n const graphRef = useRef<OnLoadParams>();\n const componentCompare = useComponentCompare();\n\n const baseId = componentCompare?.base?.model.id;\n const compareId = componentCompare?.compare?.model.id;\n\n const [filter, setFilter] = useState<GraphFilter>('runtimeOnly');\n const isFiltered = filter === 'runtimeOnly';\n const { loading: baseLoading, graph: baseGraph } = useGraphQuery(baseId && [baseId.toString()], filter);\n const { loading: compareLoading, graph: compareGraph } = useGraphQuery(compareId && [compareId.toString()], filter);\n const loading = baseLoading || compareLoading;\n const graph = diffGraph(baseGraph, compareGraph, baseId) ?? undefined;\n const elements = calcElements(graph, { rootNode: baseId });\n\n useEffect(() => () => (graphRef.current = undefined), []);\n\n useEffect(() => {\n graphRef.current?.fitView();\n }, [elements]);\n\n const handleLoad = useCallback(\n (instance: OnLoadParams) => {\n graphRef.current = instance;\n if ((graph?.nodes.length ?? 0) <= 3) {\n graphRef.current?.fitView({\n padding: 2,\n });\n } else {\n instance.fitView();\n }\n },\n [graph?.nodes.length]\n );\n\n useEffect(() => {\n setTimeout(() => {\n if ((graph?.nodes.length ?? 0) <= 3)\n return graphRef.current?.fitView({\n padding: 2,\n });\n return graphRef.current?.fitView();\n }, 0);\n }, [compareId?.toString(), baseId?.toString()]);\n\n const onCheckFilter = (_isFiltered: boolean) => {\n setFilter(_isFiltered ? 'runtimeOnly' : undefined);\n };\n\n if (!loading && (!baseGraph || !compareGraph)) {\n return <></>;\n }\n\n return (\n <div className={classNames([styles.page, graphPageStyles.graph])}>\n {loading && (\n <div className={styles.loader}>\n <RoundLoader />\n </div>\n )}\n <ReactFlowProvider>\n <ReactFlow\n draggable={false}\n nodesDraggable={true}\n selectNodesOnDrag={false}\n nodesConnectable={false}\n zoomOnDoubleClick={false}\n elementsSelectable={false}\n maxZoom={100}\n minZoom={0}\n className={dependenciesGraphStyles.graph}\n elements={elements}\n nodeTypes={NodeTypes}\n onLoad={handleLoad}\n >\n <Background />\n <Controls className={dependenciesGraphStyles.controls} />\n <MiniMap nodeColor={calcMinimapColors} className={dependenciesGraphStyles.minimap} />\n <GraphFilters\n className={graphPageStyles.filters}\n disable={loading}\n isFiltered={isFiltered}\n onChangeFilter={onCheckFilter}\n />\n </ReactFlow>\n </ReactFlowProvider>\n </div>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,6BAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,4BAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAM,uBAAA,CAAAJ,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,mBAAA;EAAA,MAAAP,IAAA,GAAAM,uBAAA,CAAAJ,OAAA;EAAAK,kBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAWA,SAAAQ,OAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAA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IAACxB,SAAS,EAAEgB,2BAAuB,CAACS;EAAQ,CAAE,CAAC,eACrFlH,MAAA,GAAAe,OAAA,CAAAyB,aAAA,CAACpC,UAAA,GAAA+G,YAAY;IACX1B,SAAS,EAAEI,mBAAe,CAACuB,OAAQ;IACnCC,OAAO,EAAEtD,OAAQ;IACjBD,UAAU,EAAEA,UAAW;IACvBwD,cAAc,EAAEhC;EAAc,CAC/B,CACQ,CACM,CAChB,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["_classnames","data","_interopRequireDefault","require","_designUi","_componentUiComponentCompare","_react","_interopRequireWildcard","_reactflow","_query","_graphPage","_dependenciesGraph","_dependenciesCompareModule","_dependencyCompareNode","_diffGraph","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","obj","ComponentNodeContainer","props","sourcePosition","Position","Top","targetPosition","Bottom","id","ReactFlowHandle","Handle","createElement","key","type","position","isConnectable","DependencyCompareNode","node","DependenciesCompare","nodeTypes","React","useMemo","ComponentNode","graphRef","useRef","componentCompare","useComponentCompare","baseId","base","model","compareId","compare","filter","setFilter","useState","isFiltered","loading","baseLoading","graph","baseGraph","useGraphQuery","toString","compareLoading","compareGraph","diffGraph","undefined","elements","calcElements","rootNode","useEffect","current","setTimeout","nodes","length","fitView","padding","handleLoad","useCallback","instance","maxZoom","onCheckFilter","_isFiltered","Fragment","className","classNames","styles","page","graphPageStyles","loader","RoundLoader","ReactFlowProvider","draggable","nodesDraggable","selectNodesOnDrag","nodesConnectable","zoomOnDoubleClick","elementsSelectable","minZoom","dependenciesGraphStyles","defaultNodes","defaultEdges","edges","onInit","proOptions","hideAttribution","Background","Controls","controls","MiniMap","nodeColor","calcMinimapColors","minimap","GraphFilters","filters","disable","onChangeFilter"],"sources":["dependencies-compare.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { RoundLoader } from '@teambit/design.ui.round-loader';\nimport { useComponentCompare } from '@teambit/component.ui.component-compare.context';\nimport React, { useEffect, useRef, useState, useCallback } from 'react';\nimport ReactFlow, {\n Background,\n Controls,\n Handle,\n MiniMap,\n NodeProps,\n NodeTypes,\n Position,\n ReactFlowProvider,\n ReactFlowInstance,\n} from 'reactflow';\nimport { useGraphQuery } from '../query';\nimport { GraphFilter } from '../../model/graph-filters';\nimport { GraphFilters, styles as graphPageStyles } from '../graph-page';\nimport { calcMinimapColors, calcElements, styles as dependenciesGraphStyles } from '../dependencies-graph';\nimport styles from './dependencies-compare.module.scss';\nimport { DependencyCompareNode } from './dependency-compare-node';\nimport { diffGraph } from './diff-graph';\n\nfunction ComponentNodeContainer(props: NodeProps) {\n const { sourcePosition = Position.Top, targetPosition = Position.Bottom, data, id } = props;\n const ReactFlowHandle = Handle;\n return (\n <div key={id}>\n <ReactFlowHandle type=\"target\" position={targetPosition} isConnectable={false} />\n <ReactFlowHandle type=\"source\" position={sourcePosition} isConnectable={false} />\n <DependencyCompareNode node={data.node} type={data.type} />\n </div>\n );\n}\n\nexport function DependenciesCompare() {\n const nodeTypes: NodeTypes = React.useMemo(() => ({ ComponentNode: ComponentNodeContainer }), []);\n const graphRef = useRef<ReactFlowInstance>();\n const componentCompare = useComponentCompare();\n\n const baseId = componentCompare?.base?.model.id;\n const compareId = componentCompare?.compare?.model.id;\n\n const [filter, setFilter] = useState<GraphFilter>('runtimeOnly');\n const isFiltered = filter === 'runtimeOnly';\n const { loading: baseLoading, graph: baseGraph } = useGraphQuery(baseId && [baseId.toString()], filter);\n const { loading: compareLoading, graph: compareGraph } = useGraphQuery(compareId && [compareId.toString()], filter);\n const loading = baseLoading || compareLoading;\n const graph = diffGraph(baseGraph, compareGraph, baseId) ?? undefined;\n const elements = calcElements(graph, { rootNode: baseId });\n\n useEffect(() => () => (graphRef.current = undefined), []);\n\n useEffect(() => {\n setTimeout(() => {\n if (graph && graph.nodes.length <= 3)\n return graphRef.current?.fitView({\n padding: 2,\n });\n return graphRef.current?.fitView();\n }, 0);\n }, [graph]);\n\n const handleLoad = useCallback(\n (instance: ReactFlowInstance) => {\n graphRef.current = instance;\n if ((graph?.nodes.length ?? 0) <= 3) {\n graphRef.current?.fitView({\n padding: 2,\n maxZoom: 1,\n });\n } else {\n instance.fitView({\n maxZoom: 1,\n });\n }\n },\n [graph?.nodes.length]\n );\n\n useEffect(() => {\n setTimeout(() => {\n if ((graph?.nodes.length ?? 0) <= 3)\n return graphRef.current?.fitView({\n padding: 2,\n });\n return graphRef.current?.fitView();\n }, 0);\n }, [compareId?.toString(), baseId?.toString()]);\n\n const onCheckFilter = (_isFiltered: boolean) => {\n setFilter(_isFiltered ? 'runtimeOnly' : undefined);\n };\n\n if (!loading && !graph) {\n return <></>;\n }\n\n return (\n <div className={classNames([styles.page, graphPageStyles.graph])}>\n {loading && (\n <div className={styles.loader}>\n <RoundLoader />\n </div>\n )}\n {!loading && (\n <ReactFlowProvider>\n <ReactFlow\n draggable={false}\n nodesDraggable={true}\n selectNodesOnDrag={false}\n nodesConnectable={false}\n zoomOnDoubleClick={false}\n elementsSelectable={false}\n maxZoom={100}\n minZoom={0}\n className={dependenciesGraphStyles.graph}\n defaultNodes={elements.nodes}\n defaultEdges={elements.edges}\n nodeTypes={nodeTypes}\n onInit={handleLoad}\n proOptions={{\n hideAttribution: true,\n }}\n >\n <Background />\n <Controls className={dependenciesGraphStyles.controls} />\n <MiniMap nodeColor={calcMinimapColors} className={dependenciesGraphStyles.minimap} />\n <GraphFilters\n className={graphPageStyles.filters}\n disable={loading}\n isFiltered={isFiltered}\n onChangeFilter={onCheckFilter}\n />\n </ReactFlow>\n </ReactFlowProvider>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GA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AAQ;IACnCC,OAAO,EAAE1D,OAAQ;IACjBD,UAAU,EAAEA,UAAW;IACvB4D,cAAc,EAAEnC;EAAc,CAC/B,CACQ,CACM,CAElB,CAAC;AAEV","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { Edge, Node } from 'react-flow-renderer';
1
+ import { Edge, Node } from 'reactflow';
2
2
  import { ComponentID } from '@teambit/component';
3
3
  import { EdgeModel, GraphModel, NodeModel } from '../query';
4
4
  type ElementsOptions = {
@@ -7,5 +7,8 @@ type ElementsOptions = {
7
7
  /**
8
8
  * generate Nodes and Edges for the ReactFlowRenderer graph renderer
9
9
  */
10
- export declare function calcElements(graph: GraphModel<NodeModel, EdgeModel> | undefined, { rootNode }: ElementsOptions): (Node<any> | Edge<any>)[];
10
+ export declare function calcElements(graph: GraphModel<NodeModel, EdgeModel> | undefined, { rootNode }: ElementsOptions): {
11
+ nodes: Node[];
12
+ edges: Edge[];
13
+ };
11
14
  export {};
@@ -11,9 +11,9 @@ function _react() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _reactFlowRenderer() {
15
- const data = require("react-flow-renderer");
16
- _reactFlowRenderer = function () {
14
+ function _reactflow() {
15
+ const data = require("reactflow");
16
+ _reactflow = function () {
17
17
  return data;
18
18
  };
19
19
  return data;
@@ -39,7 +39,10 @@ function calcElements(graph, {
39
39
  rootNode
40
40
  }) {
41
41
  return (0, _react().useMemo)(() => {
42
- if (!graph) return [];
42
+ if (!graph) return {
43
+ nodes: [],
44
+ edges: []
45
+ };
43
46
  const positions = (0, _calcLayout().calcLayout)(graph);
44
47
  const nodes = Array.from(graph.nodes.values()).map(x => {
45
48
  return {
@@ -65,9 +68,15 @@ function calcElements(graph, {
65
68
  labelBgPadding: [4, 4],
66
69
  type: 'smoothstep',
67
70
  className: (0, _depEdge().depTypeToClass)(e.dependencyLifecycleType),
68
- arrowHeadType: _reactFlowRenderer().ArrowHeadType.Arrow
71
+ arrowHeadType: _reactflow().MarkerType.Arrow,
72
+ markerEnd: {
73
+ type: _reactflow().MarkerType.Arrow
74
+ }
69
75
  }));
70
- return [...nodes, ...edges];
76
+ return {
77
+ nodes,
78
+ edges
79
+ };
71
80
  }, [graph]);
72
81
  }
73
82
 
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","require","_reactFlowRenderer","_calcLayout","_depEdge","calcElements","graph","rootNode","useMemo","positions","calcLayout","nodes","Array","from","values","map","x","id","type","node","component","isEqual","ignoreVersion","undefined","position","get","y","edges","e","sourceId","targetId","source","target","label","depTypeToLabel","dependencyLifecycleType","labelBgPadding","className","depTypeToClass","arrowHeadType","ArrowHeadType","Arrow"],"sources":["calc-elements.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { ArrowHeadType, Edge, Node } from 'react-flow-renderer';\nimport { ComponentID } from '@teambit/component';\nimport { calcLayout } from './calc-layout';\nimport { EdgeModel, GraphModel, NodeModel } from '../query';\n\nimport { depTypeToClass, depTypeToLabel } from './dep-edge';\n\ntype ElementsOptions = {\n rootNode?: ComponentID;\n};\n\n/**\n * generate Nodes and Edges for the ReactFlowRenderer graph renderer\n */\nexport function calcElements(graph: GraphModel<NodeModel, EdgeModel> | undefined, { rootNode }: ElementsOptions) {\n return useMemo(() => {\n if (!graph) return [];\n\n const positions = calcLayout(graph);\n\n const nodes: Node[] = Array.from(graph.nodes.values()).map((x) => {\n return {\n id: x.id,\n type: 'ComponentNode',\n data: {\n node: x,\n type: rootNode && x.component.id.isEqual(rootNode, { ignoreVersion: true }) ? 'root' : undefined,\n },\n position: positions.get(x.id) || { x: 0, y: 0 },\n };\n });\n\n const edges: Edge[] = graph.edges.map((e) => ({\n id: `_${e.sourceId}__${e.targetId}`,\n source: e.sourceId,\n target: e.targetId,\n label: depTypeToLabel(e.dependencyLifecycleType),\n labelBgPadding: [4, 4],\n type: 'smoothstep',\n className: depTypeToClass(e.dependencyLifecycleType),\n arrowHeadType: ArrowHeadType.Arrow,\n }));\n\n return [...nodes, ...edges];\n }, [graph]);\n}\n"],"mappings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AAI;UAAED,CAAC,EAAE,CAAC;UAAEU,CAAC,EAAE;QAAE;MAChD,CAAC;IACH,CAAC,CAAC;IAEF,MAAMC,KAAa,GAAGrB,KAAK,CAACqB,KAAK,CAACZ,GAAG,CAAEa,CAAC,KAAM;MAC5CX,EAAE,EAAG,IAAGW,CAAC,CAACC,QAAS,KAAID,CAAC,CAACE,QAAS,EAAC;MACnCC,MAAM,EAAEH,CAAC,CAACC,QAAQ;MAClBG,MAAM,EAAEJ,CAAC,CAACE,QAAQ;MAClBG,KAAK,EAAE,IAAAC,yBAAc,EAACN,CAAC,CAACO,uBAAuB,CAAC;MAChDC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;MACtBlB,IAAI,EAAE,YAAY;MAClBmB,SAAS,EAAE,IAAAC,yBAAc,EAACV,CAAC,CAACO,uBAAuB,CAAC;MACpDI,aAAa,EAAEC,kCAAa,CAACC;IAC/B,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG9B,KAAK,EAAE,GAAGgB,KAAK,CAAC;EAC7B,CAAC,EAAE,CAACrB,KAAK,CAAC,CAAC;AACb","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","require","_reactflow","_calcLayout","_depEdge","calcElements","graph","rootNode","useMemo","nodes","edges","positions","calcLayout","Array","from","values","map","x","id","type","node","component","isEqual","ignoreVersion","undefined","position","get","y","e","sourceId","targetId","source","target","label","depTypeToLabel","dependencyLifecycleType","labelBgPadding","className","depTypeToClass","arrowHeadType","MarkerType","Arrow","markerEnd"],"sources":["calc-elements.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { MarkerType, Edge, Node } from 'reactflow';\nimport { ComponentID } from '@teambit/component';\nimport { calcLayout } from './calc-layout';\nimport { EdgeModel, GraphModel, NodeModel } from '../query';\n\nimport { depTypeToClass, depTypeToLabel } from './dep-edge';\n\ntype ElementsOptions = {\n rootNode?: ComponentID;\n};\n\n/**\n * generate Nodes and Edges for the ReactFlowRenderer graph renderer\n */\nexport function calcElements(\n graph: GraphModel<NodeModel, EdgeModel> | undefined,\n { rootNode }: ElementsOptions\n): { nodes: Node[]; edges: Edge[] } {\n return useMemo(() => {\n if (!graph) return { nodes: [], edges: [] };\n\n const positions = calcLayout(graph);\n\n const nodes: Node[] = Array.from(graph.nodes.values()).map((x) => {\n return {\n id: x.id,\n type: 'ComponentNode',\n data: {\n node: x,\n type: rootNode && x.component.id.isEqual(rootNode, { ignoreVersion: true }) ? 'root' : undefined,\n },\n position: positions.get(x.id) || { x: 0, y: 0 },\n };\n });\n\n const edges: Edge[] = graph.edges.map((e) => ({\n id: `_${e.sourceId}__${e.targetId}`,\n source: e.sourceId,\n target: e.targetId,\n label: depTypeToLabel(e.dependencyLifecycleType),\n labelBgPadding: [4, 4],\n type: 'smoothstep',\n className: depTypeToClass(e.dependencyLifecycleType),\n arrowHeadType: MarkerType.Arrow,\n markerEnd: {\n type: MarkerType.Arrow,\n },\n }));\n\n return { nodes, edges };\n }, [graph]);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA;AACA;AACA;AACO,SAASK,YAAYA,CAC1BC,KAAmD,EACnD;EAAEC;AAA0B,CAAC,EACK;EAClC,OAA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;MAC/BC,SAAS,EAAE;QACTvB,IAAI,EAAEqB,uBAAU,CAACC;MACnB;IACF,CAAC,CAAC,CAAC;IAEH,OAAO;MAAEhC,KAAK;MAAEC;IAAM,CAAC;EACzB,CAAC,EAAE,CAACJ,KAAK,CAAC,CAAC;AACb","ignoreList":[]}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.calcLayout = calcLayout;
7
7
  function _dagre() {
8
- const data = _interopRequireWildcard(require("dagre"));
8
+ const data = _interopRequireWildcard(require("@dagrejs/dagre"));
9
9
  _dagre = function () {
10
10
  return data;
11
11
  };
@@ -13,9 +13,14 @@ function _dagre() {
13
13
  }
14
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
20
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
21
  const NODE_WIDTH = 260;
17
22
  const NODE_HEIGHT = 90;
18
- const BOTTOM_TO_TOP = 'BT';
23
+ const TOP_TO_BOTTOM = 'TB';
19
24
 
20
25
  /**
21
26
  * calculate the specific location of each node in the graph
@@ -23,19 +28,21 @@ const BOTTOM_TO_TOP = 'BT';
23
28
  function calcLayout(graph) {
24
29
  const g = new (_dagre().graphlib.Graph)();
25
30
  g.setGraph({
26
- rankdir: BOTTOM_TO_TOP
31
+ rankdir: TOP_TO_BOTTOM,
32
+ nodesep: 25,
33
+ ranksep: 100,
34
+ edgesep: 100,
35
+ ranker: 'longest-path',
36
+ acyclicer: 'greedy'
27
37
  });
28
38
  g.setDefaultEdgeLabel(() => ({}));
29
39
 
30
40
  // make a new instance of { width, height } per node, or dagre will get confused and place all nodes in the same spot
31
- graph.nodes.forEach(n => g.setNode(n.id, {
41
+ graph.nodes.forEach(n => g.setNode(n.id, _objectSpread(_objectSpread({}, n), {}, {
32
42
  width: NODE_WIDTH,
33
43
  height: NODE_HEIGHT
34
- }));
35
- graph.edges.forEach(e => g.setEdge({
36
- v: e.sourceId,
37
- w: e.targetId
38
- }));
44
+ })));
45
+ graph.edges.forEach(e => g.setEdge(e.sourceId, e.targetId));
39
46
 
40
47
  // position items in graph
41
48
  _dagre().default.layout(g);
@@ -1 +1 @@
1
- {"version":3,"names":["_dagre","data","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","NODE_WIDTH","NODE_HEIGHT","BOTTOM_TO_TOP","calcLayout","graph","g","graphlib","Graph","setGraph","rankdir","setDefaultEdgeLabel","nodes","forEach","setNode","id","width","height","edges","setEdge","v","sourceId","w","targetId","dagre","layout","positionsArr","map","nodeId","node","pos","x","y","Map"],"sources":["calc-layout.tsx"],"sourcesContent":["import dagre, { graphlib } from 'dagre';\nimport { EdgeModel, GraphModel, NodeModel } from '../query';\n\nconst NODE_WIDTH = 260;\nconst NODE_HEIGHT = 90;\n\nconst BOTTOM_TO_TOP = 'BT';\n\n/**\n * calculate the specific location of each node in the graph\n */\nexport function calcLayout(graph: GraphModel<NodeModel, EdgeModel>) {\n const g = new graphlib.Graph();\n g.setGraph({ rankdir: BOTTOM_TO_TOP });\n g.setDefaultEdgeLabel(() => ({}));\n\n // make a new instance of { width, height } per node, or dagre will get confused and place all nodes in the same spot\n graph.nodes.forEach((n) => g.setNode(n.id, { width: NODE_WIDTH, height: NODE_HEIGHT }));\n graph.edges.forEach((e) => g.setEdge({ v: e.sourceId, w: e.targetId }));\n\n // position items in graph\n dagre.layout(g);\n\n const positionsArr: [string, { x: number; y: number }][] = g.nodes().map((nodeId) => {\n const node = g.node(nodeId);\n\n const pos = {\n x: node.x - node.width / 2,\n y: node.y - node.height / 2,\n };\n\n return [nodeId, pos];\n });\n\n return new Map(positionsArr);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwC,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAA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AAO,EAAEP;EAAc,CAAC,CAAC;EACtCG,CAAC,CAACK,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;;EAEjC;EACAN,KAAK,CAACO,KAAK,CAACC,OAAO,CAAEvB,CAAC,IAAKgB,CAAC,CAACQ,OAAO,CAACxB,CAAC,CAACyB,EAAE,EAAE;IAAEC,KAAK,EAAEf,UAAU;IAAEgB,MAAM,EAAEf;EAAY,CAAC,CAAC,CAAC;EACvFG,KAAK,CAACa,KAAK,CAACL,OAAO,CAAE/B,CAAC,IAAKwB,CAAC,CAACa,OAAO,CAAC;IAAEC,CAAC,EAAEtC,CAAC,CAACuC,QAAQ;IAAEC,CAAC,EAAExC,CAAC,CAACyC;EAAS,CAAC,CAAC,CAAC;;EAEvE;EACAC,gBAAK,CAACC,MAAM,CAACnB,CAAC,CAAC;EAEf,MAAMoB,YAAkD,GAAGpB,CAAC,CAACM,KAAK,CAAC,CAAC,CAACe,GAAG,CAAEC,MAAM,IAAK;IACnF,MAAMC,IAAI,GAAGvB,CAAC,CAACuB,IAAI,CAACD,MAAM,CAAC;IAE3B,MAAME,GAAG,GAAG;MACVC,CAAC,EAAEF,IAAI,CAACE,CAAC,GAAGF,IAAI,CAACb,KAAK,GAAG,CAAC;MAC1BgB,CAAC,EAAEH,IAAI,CAACG,CAAC,GAAGH,IAAI,CAACZ,MAAM,GAAG;IAC5B,CAAC;IAED,OAAO,CAACW,MAAM,EAAEE,GAAG,CAAC;EACtB,CAAC,CAAC;EAEF,OAAO,IAAIG,GAAG,CAACP,YAAY,CAAC;AAC9B","ignoreList":[]}
1
+ {"version":3,"names":["_dagre","data","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","obj","key","value","_toPropertyKey","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","NODE_WIDTH","NODE_HEIGHT","TOP_TO_BOTTOM","calcLayout","graph","g","graphlib","Graph","setGraph","rankdir","nodesep","ranksep","edgesep","ranker","acyclicer","setDefaultEdgeLabel","nodes","setNode","id","width","height","edges","setEdge","sourceId","targetId","dagre","layout","positionsArr","map","nodeId","node","pos","x","y","Map"],"sources":["calc-layout.tsx"],"sourcesContent":["import dagre, { graphlib } from '@dagrejs/dagre';\nimport { EdgeModel, GraphModel, NodeModel } from '../query';\n\nconst NODE_WIDTH = 260;\nconst NODE_HEIGHT = 90;\n\nconst TOP_TO_BOTTOM = 'TB';\n\n/**\n * calculate the specific location of each node in the graph\n */\nexport function calcLayout(graph: GraphModel<NodeModel, EdgeModel>) {\n const g = new graphlib.Graph();\n g.setGraph({\n rankdir: TOP_TO_BOTTOM,\n nodesep: 25,\n ranksep: 100,\n edgesep: 100,\n ranker: 'longest-path',\n acyclicer: 'greedy',\n });\n g.setDefaultEdgeLabel(() => ({}));\n\n // make a new instance of { width, height } per node, or dagre will get confused and place all nodes in the same spot\n graph.nodes.forEach((n) => g.setNode(n.id, { ...n, width: NODE_WIDTH, height: NODE_HEIGHT }));\n graph.edges.forEach((e) => g.setEdge(e.sourceId, e.targetId));\n\n // position items in graph\n dagre.layout(g);\n\n const positionsArr: [string, { x: number; y: number }][] = g.nodes().map((nodeId) => {\n const node = g.node(nodeId);\n\n const pos = {\n x: node.x - node.width / 2,\n y: node.y - node.height / 2,\n };\n\n return [nodeId, pos];\n });\n\n return new Map(positionsArr);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiD,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAA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,CAACW,KAAK,CAAC,CAAC,CAACY,GAAG,CAAEC,MAAM,IAAK;IACnF,MAAMC,IAAI,GAAGzB,CAAC,CAACyB,IAAI,CAACD,MAAM,CAAC;IAE3B,MAAME,GAAG,GAAG;MACVC,CAAC,EAAEF,IAAI,CAACE,CAAC,GAAGF,IAAI,CAACX,KAAK,GAAG,CAAC;MAC1Bc,CAAC,EAAEH,IAAI,CAACG,CAAC,GAAGH,IAAI,CAACV,MAAM,GAAG;IAC5B,CAAC;IAED,OAAO,CAACS,MAAM,EAAEE,GAAG,CAAC;EACtB,CAAC,CAAC;EAEF,OAAO,IAAIG,GAAG,CAACP,YAAY,CAAC;AAC9B","ignoreList":[]}
@@ -1,11 +1,12 @@
1
- import { OnLoadParams, ReactFlowProps } from 'react-flow-renderer';
1
+ import { ReactFlowInstance, ReactFlowProps } from 'reactflow';
2
2
  import { ComponentID } from '@teambit/component';
3
3
  import { ComponentWidgetSlot } from '../../graph.ui.runtime';
4
4
  import { EdgeModel, GraphModel, NodeModel } from '../query';
5
+ import 'reactflow/dist/style.css';
5
6
  export type DependenciesGraphProps = {
6
7
  rootNode: ComponentID;
7
8
  graph: GraphModel<NodeModel, EdgeModel>;
8
9
  componentWidgets: ComponentWidgetSlot;
9
- onLoad?: (instance: OnLoadParams) => void;
10
+ onLoad?: (instance: ReactFlowInstance) => void;
10
11
  } & Omit<ReactFlowProps, 'elements'>;
11
12
  export declare function DependenciesGraph({ graph, rootNode, componentWidgets, className, onLoad, children, ...rest }: DependenciesGraphProps): import("react/jsx-runtime").JSX.Element;
@@ -18,9 +18,9 @@ function _classnames() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _reactFlowRenderer() {
22
- const data = _interopRequireWildcard(require("react-flow-renderer"));
23
- _reactFlowRenderer = function () {
21
+ function _reactflow() {
22
+ const data = _interopRequireWildcard(require("reactflow"));
23
+ _reactflow = function () {
24
24
  return data;
25
25
  };
26
26
  return data;
@@ -53,6 +53,7 @@ function _graphContext() {
53
53
  };
54
54
  return data;
55
55
  }
56
+ require("reactflow/dist/style.css");
56
57
  function _dependenciesGraphModule() {
57
58
  const data = _interopRequireDefault(require("./dependencies-graph.module.scss"));
58
59
  _dependenciesGraphModule = function () {
@@ -69,13 +70,12 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
69
70
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
70
71
  function ComponentNodeContainer(props) {
71
72
  const {
72
- sourcePosition = _reactFlowRenderer().Position.Top,
73
- targetPosition = _reactFlowRenderer().Position.Bottom,
73
+ sourcePosition = _reactflow().Position.Top,
74
+ targetPosition = _reactflow().Position.Bottom,
74
75
  data,
75
76
  id
76
77
  } = props;
77
- // @todo - this will be fixed as part of the react-flow-renderer v10 upgrade
78
- const ReactFlowHandle = _reactFlowRenderer().Handle;
78
+ const ReactFlowHandle = _reactflow().Handle;
79
79
  return /*#__PURE__*/_react().default.createElement("div", {
80
80
  key: id
81
81
  }, /*#__PURE__*/_react().default.createElement(ReactFlowHandle, {
@@ -91,11 +91,6 @@ function ComponentNodeContainer(props) {
91
91
  type: data.type
92
92
  }));
93
93
  }
94
-
95
- // @ts-ignore - incorrect NodeTypes https://github.com/wbkd/react-flow/issues/2101 (#5746)
96
- const NodeTypes = {
97
- ComponentNode: ComponentNodeContainer
98
- };
99
94
  function DependenciesGraph(_ref) {
100
95
  let {
101
96
  graph,
@@ -106,6 +101,9 @@ function DependenciesGraph(_ref) {
106
101
  children
107
102
  } = _ref,
108
103
  rest = _objectWithoutProperties(_ref, _excluded);
104
+ const nodeTypes = _react().default.useMemo(() => ({
105
+ ComponentNode: ComponentNodeContainer
106
+ }), []);
109
107
  const graphRef = (0, _react().useRef)();
110
108
  const elements = (0, _calcElements().calcElements)(graph, {
111
109
  rootNode
@@ -116,10 +114,13 @@ function DependenciesGraph(_ref) {
116
114
  const handleLoad = (0, _react().useCallback)(instance => {
117
115
  if ((graph?.nodes.length ?? 0) <= 3) {
118
116
  instance.fitView({
119
- padding: 2
117
+ padding: 2,
118
+ maxZoom: 1
120
119
  });
121
120
  } else {
122
- instance.fitView();
121
+ instance.fitView({
122
+ maxZoom: 1
123
+ });
123
124
  }
124
125
  onLoad?.(instance);
125
126
  }, [onLoad]);
@@ -136,7 +137,7 @@ function DependenciesGraph(_ref) {
136
137
  }, [graph]);
137
138
  return /*#__PURE__*/_react().default.createElement(_graphContext().ComponentGraphContext.Provider, {
138
139
  value: context
139
- }, /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().ReactFlowProvider, null, /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().default, _extends({
140
+ }, /*#__PURE__*/_react().default.createElement(_reactflow().ReactFlowProvider, null, /*#__PURE__*/_react().default.createElement(_reactflow().default, _extends({
140
141
  draggable: false,
141
142
  nodesDraggable: true,
142
143
  selectNodesOnDrag: false,
@@ -147,12 +148,16 @@ function DependenciesGraph(_ref) {
147
148
  minZoom: 0
148
149
  }, rest, {
149
150
  className: (0, _classnames().default)(_dependenciesGraphModule().default.graph, className),
150
- elements: elements,
151
- nodeTypes: NodeTypes,
152
- onLoad: handleLoad
153
- }), /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().Background, null), /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().Controls, {
151
+ defaultNodes: elements.nodes,
152
+ defaultEdges: elements.edges,
153
+ nodeTypes: nodeTypes,
154
+ onInit: handleLoad,
155
+ proOptions: {
156
+ hideAttribution: true
157
+ }
158
+ }), /*#__PURE__*/_react().default.createElement(_reactflow().Background, null), /*#__PURE__*/_react().default.createElement(_reactflow().Controls, {
154
159
  className: _dependenciesGraphModule().default.controls
155
- }), /*#__PURE__*/_react().default.createElement(_reactFlowRenderer().MiniMap, {
160
+ }), /*#__PURE__*/_react().default.createElement(_reactflow().MiniMap, {
156
161
  nodeColor: _minimap().calcMinimapColors,
157
162
  className: _dependenciesGraphModule().default.minimap
158
163
  }), children)));
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_reactFlowRenderer","_componentNode","_calcElements","_minimap","_graphContext","_dependenciesGraphModule","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","prototype","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","ComponentNodeContainer","props","sourcePosition","Position","Top","targetPosition","Bottom","id","ReactFlowHandle","Handle","createElement","type","position","isConnectable","ComponentNode","node","NodeTypes","DependenciesGraph","_ref","graph","rootNode","componentWidgets","className","onLoad","children","rest","graphRef","useRef","elements","calcElements","context","useMemo","handleLoad","useCallback","instance","nodes","fitView","padding","useEffect","current","undefined","setTimeout","ComponentGraphContext","Provider","value","ReactFlowProvider","draggable","nodesDraggable","selectNodesOnDrag","nodesConnectable","zoomOnDoubleClick","elementsSelectable","maxZoom","minZoom","classnames","styles","nodeTypes","Background","Controls","controls","MiniMap","nodeColor","calcMinimapColors","minimap"],"sources":["dependencies-graph.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef } from 'react';\nimport classnames from 'classnames';\nimport ReactFlow, {\n Background,\n Controls,\n Handle,\n MiniMap,\n NodeProps,\n NodeTypesType,\n OnLoadParams,\n Position,\n ReactFlowProps,\n ReactFlowProvider,\n} from 'react-flow-renderer';\nimport { ComponentID } from '@teambit/component';\n\nimport { ComponentWidgetSlot } from '../../graph.ui.runtime';\nimport { ComponentNode } from '../component-node';\nimport { EdgeModel, GraphModel, NodeModel } from '../query';\nimport { calcElements } from './calc-elements';\nimport { calcMinimapColors } from './minimap';\nimport { ComponentGraphContext } from './graph-context';\n\nimport styles from './dependencies-graph.module.scss';\n\nfunction ComponentNodeContainer(props: NodeProps) {\n const { sourcePosition = Position.Top, targetPosition = Position.Bottom, data, id } = props;\n // @todo - this will be fixed as part of the react-flow-renderer v10 upgrade\n const ReactFlowHandle = Handle as any;\n return (\n <div key={id}>\n <ReactFlowHandle type=\"target\" position={targetPosition} isConnectable={false} />\n <ReactFlowHandle type=\"source\" position={sourcePosition} isConnectable={false} />\n <ComponentNode node={data.node} type={data.type} />\n </div>\n );\n}\n\n// @ts-ignore - incorrect NodeTypes https://github.com/wbkd/react-flow/issues/2101 (#5746)\nconst NodeTypes: NodeTypesType = { ComponentNode: ComponentNodeContainer };\n\nexport type DependenciesGraphProps = {\n rootNode: ComponentID;\n graph: GraphModel<NodeModel, EdgeModel>;\n componentWidgets: ComponentWidgetSlot;\n onLoad?: (instance: OnLoadParams) => void;\n} & Omit<ReactFlowProps, 'elements'>;\n\nexport function DependenciesGraph({\n graph,\n rootNode,\n componentWidgets,\n className,\n onLoad,\n children,\n ...rest\n}: DependenciesGraphProps) {\n const graphRef = useRef<OnLoadParams>();\n const elements = calcElements(graph, { rootNode });\n const context = useMemo(() => ({ componentWidgets }), [componentWidgets]);\n\n const handleLoad = useCallback(\n (instance: OnLoadParams) => {\n if ((graph?.nodes.length ?? 0) <= 3) {\n instance.fitView({\n padding: 2,\n });\n } else {\n instance.fitView();\n }\n onLoad?.(instance);\n },\n [onLoad]\n );\n\n // clear ref on unmount\n useEffect(() => () => (graphRef.current = undefined), []);\n\n useEffect(() => {\n setTimeout(() => {\n if (graph.nodes.length <= 3)\n return graphRef.current?.fitView({\n padding: 2,\n });\n return graphRef.current?.fitView();\n }, 0);\n }, [graph]);\n\n return (\n <ComponentGraphContext.Provider value={context}>\n {/* @ts-ignore - TODO - remove when ReactFlowProvider will be of type `FC<PropsWithChildren<{}>>` instead of `FC` (#5746) */}\n <ReactFlowProvider>\n <ReactFlow\n draggable={false}\n nodesDraggable={true}\n selectNodesOnDrag={false}\n nodesConnectable={false}\n zoomOnDoubleClick={false}\n elementsSelectable={false}\n maxZoom={100}\n minZoom={0}\n {...rest}\n className={classnames(styles.graph, className)}\n elements={elements}\n nodeTypes={NodeTypes}\n onLoad={handleLoad}\n >\n <Background />\n <Controls className={styles.controls} />\n <MiniMap nodeColor={calcMinimapColors} className={styles.minimap} />\n {children}\n </ReactFlow>\n </ReactFlowProvider>\n </ComponentGraphContext.Provider>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,mBAAA;EAAA,MAAAL,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAG,kBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAeA,SAAAM,eAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,cAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,cAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,aAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,SAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,cAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,aAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAU,yBAAA;EAAA,MAAAV,IAAA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KAAM;IACjBC,cAAc,EAAE,IAAK;IACrBC,iBAAiB,EAAE,KAAM;IACzBC,gBAAgB,EAAE,KAAM;IACxBC,iBAAiB,EAAE,KAAM;IACzBC,kBAAkB,EAAE,KAAM;IAC1BC,OAAO,EAAE,GAAI;IACbC,OAAO,EAAE;EAAE,GACP5B,IAAI;IACRH,SAAS,EAAE,IAAAgC,qBAAU,EAACC,kCAAM,CAACpC,KAAK,EAAEG,SAAS,CAAE;IAC/CM,QAAQ,EAAEA,QAAS;IACnB4B,SAAS,EAAExC,SAAU;IACrBO,MAAM,EAAES;EAAW,iBAEnBnF,MAAA,GAAAe,OAAA,CAAA8C,aAAA,CAACvD,kBAAA,GAAAsG,UAAU,MAAE,CAAC,eACd5G,MAAA,GAAAe,OAAA,CAAA8C,aAAA,CAACvD,kBAAA,GAAAuG,QAAQ;IAACpC,SAAS,EAAEiC,kCAAM,CAACI;EAAS,CAAE,CAAC,eACxC9G,MAAA,GAAAe,OAAA,CAAA8C,aAAA,CAACvD,kBAAA,GAAAyG,OAAO;IAACC,SAAS,EAAEC,4BAAkB;IAACxC,SAAS,EAAEiC,kCAAM,CAACQ;EAAQ,CAAE,CAAC,EACnEvC,QACQ,CACM,CACW,CAAC;AAErC","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_reactflow","_componentNode","_calcElements","_minimap","_graphContext","_dependenciesGraphModule","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","prototype","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","ComponentNodeContainer","props","sourcePosition","Position","Top","targetPosition","Bottom","id","ReactFlowHandle","Handle","createElement","type","position","isConnectable","ComponentNode","node","DependenciesGraph","_ref","graph","rootNode","componentWidgets","className","onLoad","children","rest","nodeTypes","React","useMemo","graphRef","useRef","elements","calcElements","context","handleLoad","useCallback","instance","nodes","fitView","padding","maxZoom","useEffect","current","undefined","setTimeout","ComponentGraphContext","Provider","value","ReactFlowProvider","draggable","nodesDraggable","selectNodesOnDrag","nodesConnectable","zoomOnDoubleClick","elementsSelectable","minZoom","classnames","styles","defaultNodes","defaultEdges","edges","onInit","proOptions","hideAttribution","Background","Controls","controls","MiniMap","nodeColor","calcMinimapColors","minimap"],"sources":["dependencies-graph.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef } from 'react';\nimport classnames from 'classnames';\nimport ReactFlow, {\n Background,\n Controls,\n Handle,\n MiniMap,\n NodeProps,\n NodeTypes,\n ReactFlowInstance,\n Position,\n ReactFlowProps,\n ReactFlowProvider,\n} from 'reactflow';\nimport { ComponentID } from '@teambit/component';\nimport { ComponentWidgetSlot } from '../../graph.ui.runtime';\nimport { ComponentNode } from '../component-node';\nimport { EdgeModel, GraphModel, NodeModel } from '../query';\nimport { calcElements } from './calc-elements';\nimport { calcMinimapColors } from './minimap';\nimport { ComponentGraphContext } from './graph-context';\nimport 'reactflow/dist/style.css';\nimport styles from './dependencies-graph.module.scss';\n\nfunction ComponentNodeContainer(props: NodeProps) {\n const { sourcePosition = Position.Top, targetPosition = Position.Bottom, data, id } = props;\n const ReactFlowHandle = Handle;\n return (\n <div key={id}>\n <ReactFlowHandle type=\"target\" position={targetPosition} isConnectable={false} />\n <ReactFlowHandle type=\"source\" position={sourcePosition} isConnectable={false} />\n <ComponentNode node={data.node} type={data.type} />\n </div>\n );\n}\n\nexport type DependenciesGraphProps = {\n rootNode: ComponentID;\n graph: GraphModel<NodeModel, EdgeModel>;\n componentWidgets: ComponentWidgetSlot;\n onLoad?: (instance: ReactFlowInstance) => void;\n} & Omit<ReactFlowProps, 'elements'>;\n\nexport function DependenciesGraph({\n graph,\n rootNode,\n componentWidgets,\n className,\n onLoad,\n children,\n ...rest\n}: DependenciesGraphProps) {\n const nodeTypes: NodeTypes = React.useMemo(() => ({ ComponentNode: ComponentNodeContainer }), []);\n const graphRef = useRef<ReactFlowInstance>();\n const elements = calcElements(graph, { rootNode });\n\n const context = useMemo(() => ({ componentWidgets }), [componentWidgets]);\n\n const handleLoad = useCallback(\n (instance: ReactFlowInstance) => {\n if ((graph?.nodes.length ?? 0) <= 3) {\n instance.fitView({\n padding: 2,\n maxZoom: 1,\n });\n } else {\n instance.fitView({\n maxZoom: 1,\n });\n }\n onLoad?.(instance);\n },\n [onLoad]\n );\n\n // clear ref on unmount\n useEffect(() => () => (graphRef.current = undefined), []);\n\n useEffect(() => {\n setTimeout(() => {\n if (graph.nodes.length <= 3)\n return graphRef.current?.fitView({\n padding: 2,\n });\n return graphRef.current?.fitView();\n }, 0);\n }, [graph]);\n\n return (\n <ComponentGraphContext.Provider value={context}>\n {/* @ts-ignore - TODO - remove when ReactFlowProvider will be of type `FC<PropsWithChildren<{}>>` instead of `FC` (#5746) */}\n <ReactFlowProvider>\n <ReactFlow\n draggable={false}\n nodesDraggable={true}\n selectNodesOnDrag={false}\n nodesConnectable={false}\n zoomOnDoubleClick={false}\n elementsSelectable={false}\n maxZoom={100}\n minZoom={0}\n {...rest}\n className={classnames(styles.graph, className)}\n defaultNodes={elements.nodes}\n defaultEdges={elements.edges}\n nodeTypes={nodeTypes}\n onInit={handleLoad}\n proOptions={{\n hideAttribution: true,\n }}\n >\n <Background />\n <Controls className={styles.controls} />\n <MiniMap nodeColor={calcMinimapColors} className={styles.minimap} />\n {children}\n </ReactFlow>\n </ReactFlowProvider>\n </ComponentGraphContext.Provider>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OA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AY,EAAE5B,QAAQ,CAAC6B,KAAM;IAC7BlC,SAAS,EAAEA,SAAU;IACrBmC,MAAM,EAAE3B,UAAW;IACnB4B,UAAU,EAAE;MACVC,eAAe,EAAE;IACnB;EAAE,iBAEFjH,MAAA,GAAAe,OAAA,CAAA8C,aAAA,CAACvD,UAAA,GAAA4G,UAAU,MAAE,CAAC,eACdlH,MAAA,GAAAe,OAAA,CAAA8C,aAAA,CAACvD,UAAA,GAAA6G,QAAQ;IAAC3C,SAAS,EAAEmC,kCAAM,CAACS;EAAS,CAAE,CAAC,eACxCpH,MAAA,GAAAe,OAAA,CAAA8C,aAAA,CAACvD,UAAA,GAAA+G,OAAO;IAACC,SAAS,EAAEC,4BAAkB;IAAC/C,SAAS,EAAEmC,kCAAM,CAACa;EAAQ,CAAE,CAAC,EACnE9C,QACQ,CACM,CACW,CAAC;AAErC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { Node } from 'react-flow-renderer';
1
+ import { Node } from 'reactflow';
2
2
  export declare function calcMinimapColors(node: Node): string;
@@ -1 +1 @@
1
- {"version":3,"names":["_componentNode","data","require","calcMinimapColors","node","type","rootNodeColor","externalNodeColor","defaultNodeColor"],"sources":["minimap.ts"],"sourcesContent":["import { Node } from 'react-flow-renderer';\nimport { rootNodeColor, defaultNodeColor, externalNodeColor } from '../component-node';\n\nexport function calcMinimapColors(node: Node) {\n const type = node.data?.type;\n\n switch (type) {\n case 'root':\n return rootNodeColor;\n case 'external':\n return externalNodeColor;\n default:\n return defaultNodeColor;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASE,iBAAiBA,CAACC,IAAU,EAAE;EAC5C,MAAMC,IAAI,GAAGD,IAAI,CAACH,IAAI,EAAEI,IAAI;EAE5B,QAAQA,IAAI;IACV,KAAK,MAAM;MACT,OAAOC,8BAAa;IACtB,KAAK,UAAU;MACb,OAAOC,kCAAiB;IAC1B;MACE,OAAOC,iCAAgB;EAC3B;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_componentNode","data","require","calcMinimapColors","node","type","rootNodeColor","externalNodeColor","defaultNodeColor"],"sources":["minimap.ts"],"sourcesContent":["import { Node } from 'reactflow';\nimport { rootNodeColor, defaultNodeColor, externalNodeColor } from '../component-node';\n\nexport function calcMinimapColors(node: Node) {\n const type = node.data?.type;\n\n switch (type) {\n case 'root':\n return rootNodeColor;\n case 'external':\n return externalNodeColor;\n default:\n return defaultNodeColor;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASE,iBAAiBA,CAACC,IAAU,EAAE;EAC5C,MAAMC,IAAI,GAAGD,IAAI,CAACH,IAAI,EAAEI,IAAI;EAE5B,QAAQA,IAAI;IACV,KAAK,MAAM;MACT,OAAOC,8BAAa;IACtB,KAAK,UAAU;MACb,OAAOC,kCAAiB;IAC1B;MACE,OAAOC,iCAAgB;EAC3B;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/graph",
3
- "version": "1.0.268",
3
+ "version": "1.0.270",
4
4
  "homepage": "https://bit.cloud/teambit/component/graph",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "graph",
9
- "version": "1.0.268"
9
+ "version": "1.0.270"
10
10
  },
11
11
  "dependencies": {
12
12
  "graphlib": "2.1.8",
@@ -14,8 +14,8 @@
14
14
  "chalk": "2.4.2",
15
15
  "graphql-tag": "2.12.1",
16
16
  "classnames": "2.2.6",
17
- "react-flow-renderer": "8.3.7",
18
- "dagre": "0.8.5",
17
+ "reactflow": "^11.11.3",
18
+ "@dagrejs/dagre": "^1.1.2",
19
19
  "semver": "7.5.2",
20
20
  "@teambit/component-id": "1.2.0",
21
21
  "@teambit/graph.cleargraph": "0.0.8",
@@ -35,14 +35,14 @@
35
35
  "@teambit/component.ui.component-compare.status-resolver": "0.0.9",
36
36
  "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.505",
37
37
  "@teambit/ui-foundation.ui.react-router.use-query": "0.0.501",
38
- "@teambit/component": "1.0.268",
38
+ "@teambit/component": "1.0.270",
39
39
  "@teambit/cli": "0.0.865",
40
40
  "@teambit/toolbox.string.random": "0.0.1",
41
41
  "@teambit/component.ui.component-compare.models.component-compare-props": "0.0.109",
42
- "@teambit/graphql": "1.0.268",
42
+ "@teambit/graphql": "1.0.270",
43
43
  "@teambit/logger": "0.0.958",
44
- "@teambit/component-compare": "1.0.268",
45
- "@teambit/ui": "1.0.268",
44
+ "@teambit/component-compare": "1.0.270",
45
+ "@teambit/ui": "1.0.270",
46
46
  "@teambit/component.modules.component-url": "0.0.167",
47
47
  "@teambit/envs.ui.env-icon": "0.0.505",
48
48
  "@teambit/component.ui.component-compare.context": "0.0.118"
@@ -51,7 +51,6 @@
51
51
  "@types/graphlib": "2.1.7",
52
52
  "@types/lodash": "4.14.165",
53
53
  "@types/classnames": "2.2.11",
54
- "@types/dagre": "0.7.44",
55
54
  "@types/semver": "7.3.4",
56
55
  "@types/mocha": "9.1.0",
57
56
  "chai": "4.3.0",