@teambit/graph 1.0.667 → 1.0.668

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 (76) hide show
  1. package/component-graph/component-graph.ts +6 -4
  2. package/dist/component-graph/component-graph.d.ts +4 -3
  3. package/dist/component-graph/component-graph.js.map +1 -1
  4. package/dist/component-id-graph.d.ts +2 -1
  5. package/dist/component-id-graph.js.map +1 -1
  6. package/dist/graph-builder.d.ts +1 -1
  7. package/dist/graph-builder.js.map +1 -1
  8. package/dist/graph-cmd.d.ts +3 -3
  9. package/dist/graph-cmd.js.map +1 -1
  10. package/dist/graph.compare.section.d.ts +1 -1
  11. package/dist/graph.compare.section.js.map +1 -1
  12. package/dist/graph.graphql.d.ts +3 -3
  13. package/dist/graph.graphql.js.map +1 -1
  14. package/dist/graph.main.runtime.d.ts +8 -8
  15. package/dist/graph.main.runtime.js.map +1 -1
  16. package/dist/graph.ui.runtime.d.ts +4 -4
  17. package/dist/graph.ui.runtime.js.map +1 -1
  18. package/dist/{preview-1753809186996.js → preview-1753833698619.js} +2 -2
  19. package/dist/ui/component-node/component-node.d.ts +2 -2
  20. package/dist/ui/component-node/component-node.js.map +1 -1
  21. package/dist/ui/dependencies-compare/compare-graph-model.d.ts +3 -2
  22. package/dist/ui/dependencies-compare/compare-graph-model.js.map +1 -1
  23. package/dist/ui/dependencies-compare/compare-node-model.d.ts +1 -1
  24. package/dist/ui/dependencies-compare/compare-node-model.js.map +1 -1
  25. package/dist/ui/dependencies-compare/dependencies-compare.js.map +1 -1
  26. package/dist/ui/dependencies-compare/dependency-compare-node.d.ts +1 -1
  27. package/dist/ui/dependencies-compare/dependency-compare-node.js.map +1 -1
  28. package/dist/ui/dependencies-compare/diff-graph.d.ts +2 -2
  29. package/dist/ui/dependencies-compare/diff-graph.js.map +1 -1
  30. package/dist/ui/dependencies-graph/calc-elements.d.ts +3 -3
  31. package/dist/ui/dependencies-graph/calc-elements.js.map +1 -1
  32. package/dist/ui/dependencies-graph/calc-layout.d.ts +1 -1
  33. package/dist/ui/dependencies-graph/calc-layout.js.map +1 -1
  34. package/dist/ui/dependencies-graph/dependencies-graph.d.ts +4 -4
  35. package/dist/ui/dependencies-graph/dependencies-graph.js.map +1 -1
  36. package/dist/ui/dependencies-graph/graph-context.d.ts +1 -1
  37. package/dist/ui/dependencies-graph/graph-context.js.map +1 -1
  38. package/dist/ui/dependencies-graph/minimap.d.ts +1 -1
  39. package/dist/ui/dependencies-graph/minimap.js.map +1 -1
  40. package/dist/ui/graph-page/graph-filters.d.ts +1 -1
  41. package/dist/ui/graph-page/graph-filters.js.map +1 -1
  42. package/dist/ui/graph-page/graph-page.d.ts +1 -1
  43. package/dist/ui/graph-page/graph-page.js.map +1 -1
  44. package/dist/ui/graph.section.d.ts +2 -2
  45. package/dist/ui/graph.section.js.map +1 -1
  46. package/dist/ui/query/edge-model.d.ts +2 -2
  47. package/dist/ui/query/edge-model.js.map +1 -1
  48. package/dist/ui/query/get-graph.query.d.ts +1 -1
  49. package/dist/ui/query/get-graph.query.js.map +1 -1
  50. package/dist/ui/query/graph-model.d.ts +1 -1
  51. package/dist/ui/query/graph-model.js.map +1 -1
  52. package/dist/ui/query/node-model.d.ts +1 -1
  53. package/dist/ui/query/node-model.js.map +1 -1
  54. package/dist/ui/query/use-graph-query.js.map +1 -1
  55. package/graph.compare.section.tsx +1 -1
  56. package/graph.ui.runtime.tsx +7 -4
  57. package/package.json +15 -15
  58. package/ui/component-node/component-node.tsx +4 -3
  59. package/ui/dependencies-compare/compare-graph-model.ts +3 -2
  60. package/ui/dependencies-compare/compare-node-model.ts +1 -1
  61. package/ui/dependencies-compare/dependencies-compare.tsx +3 -12
  62. package/ui/dependencies-compare/dependency-compare-node.tsx +1 -1
  63. package/ui/dependencies-compare/diff-graph.ts +3 -3
  64. package/ui/dependencies-graph/calc-elements.tsx +4 -3
  65. package/ui/dependencies-graph/calc-layout.tsx +1 -1
  66. package/ui/dependencies-graph/dependencies-graph.tsx +4 -7
  67. package/ui/dependencies-graph/graph-context.ts +1 -1
  68. package/ui/dependencies-graph/minimap.ts +1 -1
  69. package/ui/graph-page/graph-filters.tsx +2 -1
  70. package/ui/graph-page/graph-page.tsx +1 -1
  71. package/ui/graph.section.tsx +2 -2
  72. package/ui/query/edge-model.ts +2 -2
  73. package/ui/query/get-graph.query.ts +1 -1
  74. package/ui/query/graph-model.ts +1 -1
  75. package/ui/query/node-model.ts +1 -1
  76. package/ui/query/use-graph-query.ts +2 -1
@@ -1,5 +1,5 @@
1
1
  import { ComponentID, ComponentModel } from '@teambit/component';
2
- import { RawNode } from './get-graph.query';
2
+ import type { RawNode } from './get-graph.query';
3
3
  export declare class NodeModel {
4
4
  id: string;
5
5
  component?: ComponentModel;
@@ -1 +1 @@
1
- {"version":3,"names":["_component","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","NodeModel","constructor","from","rawNode","node","id","component","ComponentModel","undefined","componentId","ComponentID","fromString","exports"],"sources":["node-model.ts"],"sourcesContent":["import { ComponentID, ComponentModel } from '@teambit/component';\nimport { RawNode } from './get-graph.query';\n\nexport class NodeModel {\n id: string;\n component?: ComponentModel;\n componentId: ComponentID;\n\n static from(rawNode: RawNode) {\n const node = new NodeModel();\n node.id = rawNode.id;\n // @TODO - component model should not expect all fields to have values\n // @ts-ignore\n node.component = rawNode.component ? ComponentModel.from(rawNode.component) : undefined;\n node.componentId = node.component ? node.component.id : ComponentID.fromString(rawNode.id);\n return node;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiE,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAA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","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","NodeModel","constructor","from","rawNode","node","id","component","ComponentModel","undefined","componentId","ComponentID","fromString","exports"],"sources":["node-model.ts"],"sourcesContent":["import { ComponentID, ComponentModel } from '@teambit/component';\nimport type { RawNode } from './get-graph.query';\n\nexport class NodeModel {\n id: string;\n component?: ComponentModel;\n componentId: ComponentID;\n\n static from(rawNode: RawNode) {\n const node = new NodeModel();\n node.id = rawNode.id;\n // @TODO - component model should not expect all fields to have values\n // @ts-ignore\n node.component = rawNode.component ? ComponentModel.from(rawNode.component) : undefined;\n node.componentId = node.component ? node.component.id : ComponentID.fromString(rawNode.id);\n return node;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiE,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAG1D,MAAMgB,SAAS,CAAC;EAAAC,YAAA;IAAApB,eAAA;IAAAA,eAAA;IAAAA,eAAA;EAAA;EAKrB,OAAOqB,IAAIA,CAACC,OAAgB,EAAE;IAC5B,MAAMC,IAAI,GAAG,IAAIJ,SAAS,CAAC,CAAC;IAC5BI,IAAI,CAACC,EAAE,GAAGF,OAAO,CAACE,EAAE;IACpB;IACA;IACAD,IAAI,CAACE,SAAS,GAAGH,OAAO,CAACG,SAAS,GAAGC,2BAAc,CAACL,IAAI,CAACC,OAAO,CAACG,SAAS,CAAC,GAAGE,SAAS;IACvFJ,IAAI,CAACK,WAAW,GAAGL,IAAI,CAACE,SAAS,GAAGF,IAAI,CAACE,SAAS,CAACD,EAAE,GAAGK,wBAAW,CAACC,UAAU,CAACR,OAAO,CAACE,EAAE,CAAC;IAC1F,OAAOD,IAAI;EACb;AACF;AAACQ,OAAA,CAAAZ,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","require","_client","_graphql","_getGraph","_graphModel","useGraphQuery","componentId","filter","idsData","error","idsError","loading","idsLoading","useQuery","GET_GRAPH_IDS","variables","ids","skip","getGraph","graphData","graphError","graphLoading","useLazyQuery","GET_GRAPH","fetchError","setFetchError","useState","undefined","shouldRefetchGraph","setShouldRefetchGraph","useEffect","graph","nodes","length","catch","GraphQlError","message","rawGraph","clientError","serverError","useMemo","GraphModel","from"],"sources":["use-graph-query.ts"],"sourcesContent":["import { useMemo, useEffect, useState } from 'react';\nimport { useQuery, useLazyQuery } from '@apollo/client';\nimport { GraphQlError } from '@teambit/graphql';\nimport { GET_GRAPH, RawGraphQuery, GET_GRAPH_IDS } from './get-graph.query';\nimport { GraphModel } from './graph-model';\n\ntype QueryVariables = {\n ids?: string[];\n filter?: string;\n};\n\nexport function useGraphQuery(componentId?: string[], filter?: string) {\n // Eagerly fetch GET_GRAPH_IDS\n const {\n data: idsData,\n error: idsError,\n loading: idsLoading,\n } = useQuery<RawGraphQuery, QueryVariables>(GET_GRAPH_IDS, {\n variables: { ids: componentId, filter },\n skip: !componentId || !filter,\n });\n\n // Lazily fetch GET_GRAPH\n const [getGraph, { data: graphData, error: graphError, loading: graphLoading }] = useLazyQuery<\n RawGraphQuery,\n QueryVariables\n >(GET_GRAPH);\n\n const [fetchError, setFetchError] = useState<GraphQlError | undefined>(undefined);\n\n const [shouldRefetchGraph, setShouldRefetchGraph] = useState(false);\n\n useEffect(() => {\n if (idsData?.graph.nodes.length || !filter) {\n setShouldRefetchGraph(true);\n }\n }, [idsData?.graph.nodes.length, filter]);\n\n useEffect(() => {\n if (shouldRefetchGraph) {\n setShouldRefetchGraph(false);\n void getGraph({ variables: { ids: componentId, filter } }).catch((error) => {\n setFetchError(new GraphQlError(500, error.message));\n });\n }\n }, [componentId, filter, getGraph, shouldRefetchGraph]);\n\n const rawGraph = idsLoading\n ? undefined\n : (idsData?.graph &&\n graphData?.graph &&\n idsData?.graph.nodes.length === graphData?.graph.nodes.length &&\n graphData?.graph) ||\n idsData?.graph ||\n graphData?.graph;\n\n const clientError = !rawGraph && !idsLoading && !graphLoading ? new GraphQlError(404) : undefined;\n const serverError =\n graphError?.message || idsError?.message\n ? new GraphQlError(500, graphError?.message || idsError?.message)\n : fetchError;\n\n return useMemo(() => {\n return {\n graph: rawGraph ? GraphModel.from(rawGraph) : undefined,\n error: serverError || clientError,\n loading: idsLoading || graphLoading,\n idsLoading,\n graphLoading,\n };\n }, [rawGraph, serverError, clientError, idsLoading, graphLoading]);\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,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,Y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MACLT,KAAK,EAAEM,QAAQ,GAAGI,wBAAU,CAACC,IAAI,CAACL,QAAQ,CAAC,GAAGV,SAAS;MACvDlB,KAAK,EAAE8B,WAAW,IAAID,WAAW;MACjC3B,OAAO,EAAEC,UAAU,IAAIS,YAAY;MACnCT,UAAU;MACVS;IACF,CAAC;EACH,CAAC,EAAE,CAACgB,QAAQ,EAAEE,WAAW,EAAED,WAAW,EAAE1B,UAAU,EAAES,YAAY,CAAC,CAAC;AACpE","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","require","_client","_graphql","_getGraph","_graphModel","useGraphQuery","componentId","filter","idsData","error","idsError","loading","idsLoading","useQuery","GET_GRAPH_IDS","variables","ids","skip","getGraph","graphData","graphError","graphLoading","useLazyQuery","GET_GRAPH","fetchError","setFetchError","useState","undefined","shouldRefetchGraph","setShouldRefetchGraph","useEffect","graph","nodes","length","catch","GraphQlError","message","rawGraph","clientError","serverError","useMemo","GraphModel","from"],"sources":["use-graph-query.ts"],"sourcesContent":["import { useMemo, useEffect, useState } from 'react';\nimport { useQuery, useLazyQuery } from '@apollo/client';\nimport { GraphQlError } from '@teambit/graphql';\nimport type { RawGraphQuery } from './get-graph.query';\nimport { GET_GRAPH, GET_GRAPH_IDS } from './get-graph.query';\nimport { GraphModel } from './graph-model';\n\ntype QueryVariables = {\n ids?: string[];\n filter?: string;\n};\n\nexport function useGraphQuery(componentId?: string[], filter?: string) {\n // Eagerly fetch GET_GRAPH_IDS\n const {\n data: idsData,\n error: idsError,\n loading: idsLoading,\n } = useQuery<RawGraphQuery, QueryVariables>(GET_GRAPH_IDS, {\n variables: { ids: componentId, filter },\n skip: !componentId || !filter,\n });\n\n // Lazily fetch GET_GRAPH\n const [getGraph, { data: graphData, error: graphError, loading: graphLoading }] = useLazyQuery<\n RawGraphQuery,\n QueryVariables\n >(GET_GRAPH);\n\n const [fetchError, setFetchError] = useState<GraphQlError | undefined>(undefined);\n\n const [shouldRefetchGraph, setShouldRefetchGraph] = useState(false);\n\n useEffect(() => {\n if (idsData?.graph.nodes.length || !filter) {\n setShouldRefetchGraph(true);\n }\n }, [idsData?.graph.nodes.length, filter]);\n\n useEffect(() => {\n if (shouldRefetchGraph) {\n setShouldRefetchGraph(false);\n void getGraph({ variables: { ids: componentId, filter } }).catch((error) => {\n setFetchError(new GraphQlError(500, error.message));\n });\n }\n }, [componentId, filter, getGraph, shouldRefetchGraph]);\n\n const rawGraph = idsLoading\n ? undefined\n : (idsData?.graph &&\n graphData?.graph &&\n idsData?.graph.nodes.length === graphData?.graph.nodes.length &&\n graphData?.graph) ||\n idsData?.graph ||\n graphData?.graph;\n\n const clientError = !rawGraph && !idsLoading && !graphLoading ? new GraphQlError(404) : undefined;\n const serverError =\n graphError?.message || idsError?.message\n ? new GraphQlError(500, graphError?.message || idsError?.message)\n : fetchError;\n\n return useMemo(() => {\n return {\n graph: rawGraph ? GraphModel.from(rawGraph) : undefined,\n error: serverError || clientError,\n loading: idsLoading || graphLoading,\n idsLoading,\n graphLoading,\n };\n }, [rawGraph, serverError, clientError, idsLoading, graphLoading]);\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,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,YAAA;EAAA,MAAAL,IAA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from '@teambit/component';
2
+ import type { Section } from '@teambit/component';
3
3
  import { ChangeType } from '@teambit/component.ui.component-compare.models.component-compare-change-type';
4
4
  import type { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
5
5
  import { DependenciesCompare } from './ui/dependencies-compare';
@@ -1,8 +1,11 @@
1
- import { ComponentType } from 'react';
1
+ import type { ComponentType } from 'react';
2
2
  import { UIRuntime } from '@teambit/ui';
3
- import { Slot, SlotRegistry } from '@teambit/harmony';
4
- import { ComponentCompareUI, ComponentCompareAspect } from '@teambit/component-compare';
5
- import { ComponentAspect, ComponentUI, ComponentModel } from '@teambit/component';
3
+ import type { SlotRegistry } from '@teambit/harmony';
4
+ import { Slot } from '@teambit/harmony';
5
+ import type { ComponentCompareUI } from '@teambit/component-compare';
6
+ import { ComponentCompareAspect } from '@teambit/component-compare';
7
+ import type { ComponentUI, ComponentModel } from '@teambit/component';
8
+ import { ComponentAspect } from '@teambit/component';
6
9
  import { GraphAspect } from './graph.aspect';
7
10
  import { GraphSection } from './ui/graph.section';
8
11
  import { GraphCompareSection } from './graph.compare.section';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/graph",
3
- "version": "1.0.667",
3
+ "version": "1.0.668",
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.667"
9
+ "version": "1.0.668"
10
10
  },
11
11
  "dependencies": {
12
12
  "graphlib": "2.1.8",
@@ -15,37 +15,37 @@
15
15
  "graphql-tag": "2.12.1",
16
16
  "classnames": "2.2.6",
17
17
  "reactflow": "^11.11.3",
18
- "@dagrejs/dagre": "^1.1.2",
19
18
  "semver": "7.7.1",
19
+ "@dagrejs/dagre": "^1.1.2",
20
20
  "@teambit/component-id": "1.2.4",
21
21
  "@teambit/graph.cleargraph": "0.0.11",
22
- "@teambit/legacy.dependency-graph": "0.0.60",
23
- "@teambit/scope.remotes": "0.0.57",
24
22
  "@teambit/harmony": "0.4.7",
25
23
  "@teambit/component.ui.component-compare.models.component-compare-change-type": "0.0.7",
26
24
  "@teambit/component.ui.component-compare.models.component-compare-props": "0.0.121",
27
25
  "@teambit/base-ui.routing.nav-link": "1.0.4",
28
26
  "@teambit/base-ui.surfaces.card": "1.0.1",
29
27
  "@teambit/base-ui.text.muted-text": "1.0.1",
30
- "@teambit/component.modules.component-url": "0.0.177",
31
28
  "@teambit/component.ui.deprecation-icon": "0.0.509",
32
29
  "@teambit/design.ui.styles.ellipsis": "0.0.357",
33
- "@teambit/envs.ui.env-icon": "0.0.506",
34
30
  "@teambit/component.ui.component-compare.context": "0.0.123",
35
31
  "@teambit/design.ui.round-loader": "0.0.355",
36
32
  "@teambit/component.ui.component-compare.status-resolver": "0.0.9",
33
+ "@teambit/ui-foundation.ui.react-router.use-query": "0.0.505",
37
34
  "@teambit/evangelist.input.checkbox.label": "1.1.0",
38
35
  "@teambit/design.skeletons.base-skeleton": "0.0.2",
39
36
  "@teambit/design.ui.pages.not-found": "0.0.371",
40
37
  "@teambit/design.ui.pages.server-error": "0.0.368",
41
- "@teambit/ui-foundation.ui.react-router.use-query": "0.0.505",
42
- "@teambit/component": "1.0.667",
43
- "@teambit/cli": "0.0.1244",
44
- "@teambit/workspace": "1.0.667",
45
- "@teambit/graphql": "1.0.667",
46
- "@teambit/logger": "0.0.1337",
47
- "@teambit/component-compare": "1.0.667",
48
- "@teambit/ui": "1.0.667"
38
+ "@teambit/legacy.dependency-graph": "0.0.61",
39
+ "@teambit/component": "1.0.668",
40
+ "@teambit/cli": "0.0.1245",
41
+ "@teambit/scope.remotes": "0.0.58",
42
+ "@teambit/workspace": "1.0.668",
43
+ "@teambit/graphql": "1.0.668",
44
+ "@teambit/logger": "0.0.1338",
45
+ "@teambit/component-compare": "1.0.668",
46
+ "@teambit/ui": "1.0.668",
47
+ "@teambit/component.modules.component-url": "0.0.178",
48
+ "@teambit/envs.ui.env-icon": "0.0.507"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/graphlib": "2.1.7",
@@ -1,14 +1,15 @@
1
1
  import React, { useContext } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import { mutedText } from '@teambit/base-ui.text.muted-text';
4
- import { ComponentID } from '@teambit/component';
4
+ import type { ComponentID } from '@teambit/component';
5
5
  import { DeprecationIcon } from '@teambit/component.ui.deprecation-icon';
6
6
  import { EnvIcon } from '@teambit/envs.ui.env-icon';
7
7
  import { ellipsis } from '@teambit/design.ui.styles.ellipsis';
8
- import { Card, CardProps } from '@teambit/base-ui.surfaces.card';
8
+ import type { CardProps } from '@teambit/base-ui.surfaces.card';
9
+ import { Card } from '@teambit/base-ui.surfaces.card';
9
10
  import { NavLink } from '@teambit/base-ui.routing.nav-link';
10
11
  import { ComponentUrl } from '@teambit/component.modules.component-url';
11
- import { NodeModel } from '../query/node-model';
12
+ import type { NodeModel } from '../query/node-model';
12
13
  import { ComponentGraphContext } from '../dependencies-graph/';
13
14
 
14
15
  // keep order: styles, then variants
@@ -1,5 +1,6 @@
1
- import { EdgeModel, GraphModel } from '../query';
2
- import { CompareNodeModel } from './compare-node-model';
1
+ import type { EdgeModel } from '../query';
2
+ import { GraphModel } from '../query';
3
+ import type { CompareNodeModel } from './compare-node-model';
3
4
 
4
5
  export class CompareGraphModel extends GraphModel<CompareNodeModel, EdgeModel> {
5
6
  constructor(
@@ -1,4 +1,4 @@
1
- import { ComponentModel } from '@teambit/component';
1
+ import type { ComponentModel } from '@teambit/component';
2
2
  import { NodeModel } from '../query';
3
3
 
4
4
  export type CompareStatus = 'modified' | 'new' | 'deleted' | undefined;
@@ -2,19 +2,10 @@ import classNames from 'classnames';
2
2
  import { RoundLoader } from '@teambit/design.ui.round-loader';
3
3
  import { useComponentCompare } from '@teambit/component.ui.component-compare.context';
4
4
  import React, { useEffect, useRef, useState, useCallback } from 'react';
5
- import ReactFlow, {
6
- Background,
7
- Controls,
8
- Handle,
9
- MiniMap,
10
- NodeProps,
11
- NodeTypes,
12
- Position,
13
- ReactFlowProvider,
14
- ReactFlowInstance,
15
- } from 'reactflow';
5
+ import type { NodeProps, NodeTypes, ReactFlowInstance } from 'reactflow';
6
+ import ReactFlow, { Background, Controls, Handle, MiniMap, Position, ReactFlowProvider } from 'reactflow';
16
7
  import { useGraphQuery } from '../query';
17
- import { GraphFilter } from '../../model/graph-filters';
8
+ import type { GraphFilter } from '../../model/graph-filters';
18
9
  import { GraphFilters, styles as graphPageStyles } from '../graph-page';
19
10
  import { calcMinimapColors, calcElements, styles as dependenciesGraphStyles } from '../dependencies-graph';
20
11
  import styles from './dependencies-compare.module.scss';
@@ -12,7 +12,7 @@ import React, { useMemo } from 'react';
12
12
  import { compare, valid } from 'semver';
13
13
  import { defaultNode, external } from '../../ui/component-node/variants';
14
14
  import { styles as componentNodeStyles } from '../../ui/component-node';
15
- import { CompareNodeModel } from './compare-node-model';
15
+ import type { CompareNodeModel } from './compare-node-model';
16
16
  import styles from './dependency-compare-node.module.scss';
17
17
  import variants from './dependency-compare-variants.module.scss';
18
18
 
@@ -1,7 +1,7 @@
1
- import { ComponentID } from '@teambit/component';
2
- import { EdgeModel, GraphModel, NodeModel } from '../query';
1
+ import type { ComponentID } from '@teambit/component';
2
+ import type { EdgeModel, GraphModel, NodeModel } from '../query';
3
3
  import { CompareGraphModel } from './compare-graph-model';
4
- import { CompareNodeModel } from './compare-node-model';
4
+ import type { CompareNodeModel } from './compare-node-model';
5
5
 
6
6
  const toShortId = (node: NodeModel) => node.componentId.toStringWithoutVersion();
7
7
 
@@ -1,8 +1,9 @@
1
1
  import { useMemo } from 'react';
2
- import { MarkerType, Edge, Node } from 'reactflow';
3
- import { ComponentID } from '@teambit/component';
2
+ import type { Edge, Node } from 'reactflow';
3
+ import { MarkerType } from 'reactflow';
4
+ import type { ComponentID } from '@teambit/component';
4
5
  import { calcLayout } from './calc-layout';
5
- import { EdgeModel, GraphModel, NodeModel } from '../query';
6
+ import type { EdgeModel, GraphModel, NodeModel } from '../query';
6
7
 
7
8
  import { depTypeToClass, depTypeToLabel } from './dep-edge';
8
9
 
@@ -1,5 +1,5 @@
1
1
  import dagre, { graphlib } from '@dagrejs/dagre';
2
- import { EdgeModel, GraphModel, NodeModel } from '../query';
2
+ import type { EdgeModel, GraphModel, NodeModel } from '../query';
3
3
 
4
4
  const NODE_WIDTH = 260;
5
5
  const NODE_HEIGHT = 90;
@@ -1,22 +1,19 @@
1
1
  import React, { useCallback, useMemo, useRef, useEffect } from 'react';
2
2
  import classnames from 'classnames';
3
+ import type { NodeProps, NodeTypes, ReactFlowInstance, ReactFlowProps } from 'reactflow';
3
4
  import ReactFlow, {
4
5
  Background,
5
6
  Controls,
6
7
  Handle,
7
8
  MiniMap,
8
- NodeProps,
9
- NodeTypes,
10
- ReactFlowInstance,
11
9
  Position,
12
- ReactFlowProps,
13
10
  ReactFlowProvider,
14
11
  useNodesState,
15
12
  } from 'reactflow';
16
- import { ComponentID } from '@teambit/component';
17
- import { ComponentWidgetSlot } from '../../graph.ui.runtime';
13
+ import type { ComponentID } from '@teambit/component';
14
+ import type { ComponentWidgetSlot } from '../../graph.ui.runtime';
18
15
  import { ComponentNode } from '../component-node';
19
- import { EdgeModel, GraphModel, NodeModel } from '../query';
16
+ import type { EdgeModel, GraphModel, NodeModel } from '../query';
20
17
  import { calcElements } from './calc-elements';
21
18
  import { calcMinimapColors } from './minimap';
22
19
  import { ComponentGraphContext } from './graph-context';
@@ -1,5 +1,5 @@
1
1
  import { createContext } from 'react';
2
- import { ComponentWidgetSlot } from '../../graph.ui.runtime';
2
+ import type { ComponentWidgetSlot } from '../../graph.ui.runtime';
3
3
 
4
4
  /** internal context, to pass shared information to all nodes */
5
5
  export type ComponentGraph = {
@@ -1,4 +1,4 @@
1
- import { Node } from 'reactflow';
1
+ import type { Node } from 'reactflow';
2
2
  import { rootNodeColor, defaultNodeColor, externalNodeColor } from '../component-node';
3
3
 
4
4
  export function calcMinimapColors(node: Node) {
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { Card, CardProps } from '@teambit/base-ui.surfaces.card';
2
+ import type { CardProps } from '@teambit/base-ui.surfaces.card';
3
+ import { Card } from '@teambit/base-ui.surfaces.card';
3
4
  import { CheckboxLabel } from '@teambit/evangelist.input.checkbox.label';
4
5
 
5
6
  type GraphFiltersType = {
@@ -7,7 +7,7 @@ import classNames from 'classnames';
7
7
 
8
8
  import { useGraphQuery } from '../query';
9
9
  import { DependenciesGraph } from '../dependencies-graph';
10
- import { ComponentWidgetSlot } from '../../graph.ui.runtime';
10
+ import type { ComponentWidgetSlot } from '../../graph.ui.runtime';
11
11
  import type { GraphFilter } from '../../model/graph-filters';
12
12
 
13
13
  import { GraphFilters } from './graph-filters';
@@ -1,8 +1,8 @@
1
- import { Section } from '@teambit/component';
1
+ import type { Section } from '@teambit/component';
2
2
  import React from 'react';
3
3
 
4
4
  import { GraphPage } from './graph-page';
5
- import { ComponentWidgetSlot } from '../graph.ui.runtime';
5
+ import type { ComponentWidgetSlot } from '../graph.ui.runtime';
6
6
 
7
7
  export class GraphSection implements Section {
8
8
  constructor(private componentWidgetSlot: ComponentWidgetSlot) {}
@@ -1,5 +1,5 @@
1
- import { EdgeType } from '../../edge-type';
2
- import { RawEdge } from './get-graph.query';
1
+ import type { EdgeType } from '../../edge-type';
2
+ import type { RawEdge } from './get-graph.query';
3
3
 
4
4
  export class EdgeModel {
5
5
  sourceId: string;
@@ -1,5 +1,5 @@
1
1
  import { gql } from '@apollo/client';
2
- import { EdgeType } from '../../edge-type';
2
+ import type { EdgeType } from '../../edge-type';
3
3
 
4
4
  export const GET_GRAPH_IDS = gql`
5
5
  query graph($ids: [String], $filter: String) {
@@ -1,4 +1,4 @@
1
- import { RawGraph } from './get-graph.query';
1
+ import type { RawGraph } from './get-graph.query';
2
2
  import { NodeModel } from './node-model';
3
3
  import { EdgeModel } from './edge-model';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { ComponentID, ComponentModel } from '@teambit/component';
2
- import { RawNode } from './get-graph.query';
2
+ import type { RawNode } from './get-graph.query';
3
3
 
4
4
  export class NodeModel {
5
5
  id: string;
@@ -1,7 +1,8 @@
1
1
  import { useMemo, useEffect, useState } from 'react';
2
2
  import { useQuery, useLazyQuery } from '@apollo/client';
3
3
  import { GraphQlError } from '@teambit/graphql';
4
- import { GET_GRAPH, RawGraphQuery, GET_GRAPH_IDS } from './get-graph.query';
4
+ import type { RawGraphQuery } from './get-graph.query';
5
+ import { GET_GRAPH, GET_GRAPH_IDS } from './get-graph.query';
5
6
  import { GraphModel } from './graph-model';
6
7
 
7
8
  type QueryVariables = {