@eventcatalog/core 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @eventcatalog/core
2
2
 
3
+ ## 2.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 16c6a28: feat(core): added api path and http verb in openapi viewer
8
+ - c8118b7: fix(core): downloading images in visualizer now shows the whole diagram
9
+
3
10
  ## 2.8.0
4
11
 
5
12
  ### Minor Changes
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.8.0",
9
+ "version": "2.8.1",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -1,4 +1,4 @@
1
- import { Panel, useReactFlow, getRectOfNodes } from 'reactflow';
1
+ import { Panel, useReactFlow, getNodesBounds, getViewportForBounds } from 'reactflow';
2
2
  import { toPng } from 'html-to-image';
3
3
  import { DocumentArrowDownIcon } from '@heroicons/react/24/outline';
4
4
 
@@ -16,7 +16,10 @@ const imageHeight = 768;
16
16
  function DownloadButton({ filename, addPadding = true }: { filename?: string; addPadding?: boolean }) {
17
17
  const { getNodes } = useReactFlow();
18
18
  const onClick = () => {
19
- const nodesBounds = getRectOfNodes(getNodes());
19
+ const nodesBounds = getNodesBounds(getNodes());
20
+ const width = imageWidth > nodesBounds.width ? imageWidth : nodesBounds.width;
21
+ const height = imageHeight > nodesBounds.height ? imageHeight : nodesBounds.height;
22
+ const viewport = getViewportForBounds(nodesBounds, width, height, 0.5, 2);
20
23
 
21
24
  // Hide the button
22
25
  // @ts-ignore
@@ -25,13 +28,14 @@ function DownloadButton({ filename, addPadding = true }: { filename?: string; ad
25
28
  document.querySelector('.react-flow__controls').style.display = 'none';
26
29
 
27
30
  // @ts-ignore
28
- toPng(document.querySelector('.react-flow'), {
31
+ toPng(document.querySelector('.react-flow__viewport'), {
29
32
  backgroundColor: '#f1f1f1',
30
- width: imageWidth * 1.2,
31
- height: imageHeight,
33
+ width,
34
+ height,
32
35
  style: {
33
- width: imageWidth * 1.2,
34
- height: imageHeight,
36
+ width,
37
+ height,
38
+ transform: `translate(${viewport.x}px, ${viewport.y}px) scale(${viewport.zoom})`,
35
39
  },
36
40
  }).then((dataUrl: string) => {
37
41
  downloadImage(dataUrl, filename);
@@ -53,24 +53,26 @@ const fileExists = fs.existsSync(pathOnDisk);
53
53
  ) : (
54
54
  <rapi-doc
55
55
  spec-url={buildUrl(pathToSpec, true)}
56
+ render-style="read"
56
57
  show-header="false"
57
58
  allow-authentication="true"
58
59
  allow-try="true"
60
+ default-schema-tab="schema"
61
+ show-curl-before-try="true"
62
+ use-path-in-nav-bar="true"
63
+ show-method-in-nav-bar="as-colored-block"
64
+ theme="light"
65
+ schema-style="table"
59
66
  class="relative top-0"
60
67
  style={{ height: '100vh', width: '100%', zIndex: 100 }}
61
68
  regular-font="ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji"
62
- schema-style="table"
63
- default-schema-tab="schema"
64
69
  bg-color="#ffffff"
65
- text-color=""
70
+ primary-color="#6b21a8"
66
71
  nav-bg-color="#fff"
67
72
  nav-text-color=""
68
73
  nav-hover-bg-color="#fff"
69
74
  nav-hover-text-color="#6b21a8"
70
75
  nav-accent-color=""
71
- primary-color="#6b21a8"
72
- theme="light"
73
- render-style="read"
74
76
  />
75
77
  )
76
78
  }