@eventcatalog/core 2.24.2 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/catalog-to-astro-content-directory.cjs +0 -1
  6. package/dist/catalog-to-astro-content-directory.js +1 -1
  7. package/dist/{chunk-VOOF34RB.js → chunk-7674GE3M.js} +1 -1
  8. package/dist/{chunk-AMO6QDAS.js → chunk-H6PSWK2Z.js} +1 -1
  9. package/dist/{chunk-Q77NQ43U.js → chunk-JENKAK6L.js} +1 -1
  10. package/dist/{chunk-CXKIF3EI.js → chunk-VCR3LHZR.js} +0 -1
  11. package/dist/constants.cjs +1 -1
  12. package/dist/constants.js +1 -1
  13. package/dist/eventcatalog.cjs +1 -2
  14. package/dist/eventcatalog.config.d.cts +1 -0
  15. package/dist/eventcatalog.config.d.ts +1 -0
  16. package/dist/eventcatalog.js +4 -4
  17. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +3 -2
  18. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +82 -54
  19. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +44 -41
  20. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +43 -41
  21. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/MessageContextMenu.tsx +54 -0
  22. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +45 -43
  23. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +112 -42
  24. package/eventcatalog/src/components/SideNav/TreeView/getTreeView.ts +1 -1
  25. package/eventcatalog/src/enterprise/ai-assistant/components/ChatSidebar.tsx +1 -9
  26. package/eventcatalog/src/enterprise/ai-assistant/components/ChatWindow.tsx +240 -118
  27. package/eventcatalog/src/enterprise/ai-assistant/components/hooks/ChatProvider.tsx +13 -13
  28. package/eventcatalog/src/enterprise/ai-assistant/components/workers/document-importer.ts +4 -2
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/index.astro +0 -1
  30. package/eventcatalog/src/pages/docs/_default-docs.mdx +24 -0
  31. package/eventcatalog/src/pages/docs/index.astro +13 -18
  32. package/package.json +3 -2
  33. package/default-files-for-collections/pages.md +0 -7
  34. package/eventcatalog/src/components/DocsNavigation.astro +0 -145
  35. package/eventcatalog/src/layouts/CustomDocsPageLayout.astro +0 -131
  36. package/eventcatalog/src/layouts/PlainPage.astro +0 -29
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.24.2";
40
+ var version = "2.25.0";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-Q77NQ43U.js";
4
- import "../chunk-AMO6QDAS.js";
3
+ } from "../chunk-JENKAK6L.js";
4
+ import "../chunk-H6PSWK2Z.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.24.2";
109
+ var version = "2.25.0";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-VOOF34RB.js";
4
- import "../chunk-Q77NQ43U.js";
5
- import "../chunk-AMO6QDAS.js";
3
+ } from "../chunk-7674GE3M.js";
4
+ import "../chunk-JENKAK6L.js";
5
+ import "../chunk-H6PSWK2Z.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -247,7 +247,6 @@ var ensureAstroCollectionNotEmpty = async (astroDir) => {
247
247
  "teams",
248
248
  "domains",
249
249
  "flows",
250
- "pages",
251
250
  "changelogs",
252
251
  "queries",
253
252
  "channels",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  catalogToAstro
3
- } from "./chunk-CXKIF3EI.js";
3
+ } from "./chunk-VCR3LHZR.js";
4
4
  import "./chunk-E7TXTI7G.js";
5
5
  import "./chunk-7JDTB3U5.js";
6
6
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-Q77NQ43U.js";
3
+ } from "./chunk-JENKAK6L.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.24.2";
2
+ var version = "2.25.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-AMO6QDAS.js";
3
+ } from "./chunk-H6PSWK2Z.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -47,7 +47,6 @@ var ensureAstroCollectionNotEmpty = async (astroDir) => {
47
47
  "teams",
48
48
  "domains",
49
49
  "flows",
50
- "pages",
51
50
  "changelogs",
52
51
  "queries",
53
52
  "channels",
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.24.2";
28
+ var version = "2.25.0";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-AMO6QDAS.js";
3
+ } from "./chunk-H6PSWK2Z.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -161,7 +161,7 @@ var import_axios = __toESM(require("axios"), 1);
161
161
  var import_os = __toESM(require("os"), 1);
162
162
 
163
163
  // package.json
164
- var version = "2.24.2";
164
+ var version = "2.25.0";
165
165
 
166
166
  // src/constants.ts
167
167
  var VERSION = version;
@@ -435,7 +435,6 @@ var ensureAstroCollectionNotEmpty = async (astroDir) => {
435
435
  "teams",
436
436
  "domains",
437
437
  "flows",
438
- "pages",
439
438
  "changelogs",
440
439
  "queries",
441
440
  "channels",
@@ -58,6 +58,7 @@ interface Config {
58
58
  enabled: boolean;
59
59
  model?: string;
60
60
  max_tokens?: number;
61
+ similarityResults?: number;
61
62
  };
62
63
  }
63
64
 
@@ -58,6 +58,7 @@ interface Config {
58
58
  enabled: boolean;
59
59
  model?: string;
60
60
  max_tokens?: number;
61
+ similarityResults?: number;
61
62
  };
62
63
  }
63
64
 
@@ -6,14 +6,14 @@ import {
6
6
  } from "./chunk-OW2FQPYP.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-VOOF34RB.js";
10
- import "./chunk-Q77NQ43U.js";
9
+ } from "./chunk-7674GE3M.js";
10
+ import "./chunk-JENKAK6L.js";
11
11
  import {
12
12
  catalogToAstro
13
- } from "./chunk-CXKIF3EI.js";
13
+ } from "./chunk-VCR3LHZR.js";
14
14
  import {
15
15
  VERSION
16
- } from "./chunk-AMO6QDAS.js";
16
+ } from "./chunk-H6PSWK2Z.js";
17
17
  import {
18
18
  isBackstagePluginEnabled
19
19
  } from "./chunk-XMDPVKIJ.js";
@@ -427,8 +427,9 @@ const NodeGraph = ({
427
427
  )}
428
428
 
429
429
  {href && (
430
- <div className="py-2 w-full text-right">
431
- <a className=" text-sm no-underline py-2 text-gray-800 hover:text-primary" href={href}>
430
+ <div className="py-2 w-full text-right flex justify-between">
431
+ <span className="text-sm text-gray-500 italic">Right click a node to access documentation</span>
432
+ <a className=" text-sm underline text-gray-800 hover:text-primary" href={href}>
432
433
  {hrefLabel} &rarr;
433
434
  </a>
434
435
  </div>
@@ -3,6 +3,8 @@ import { ArrowsRightLeftIcon } from '@heroicons/react/20/solid';
3
3
  import type { CollectionMessageTypes, CollectionTypes } from '@types';
4
4
  import type { CollectionEntry } from 'astro:content';
5
5
  import { Handle } from '@xyflow/react';
6
+ import * as ContextMenu from '@radix-ui/react-context-menu';
7
+ import { buildUrl } from '@utils/url-builder';
6
8
 
7
9
  interface Data {
8
10
  title: string;
@@ -67,67 +69,93 @@ export default function ChannelNode({ data, sourcePosition, targetPosition }: an
67
69
  };
68
70
 
69
71
  return (
70
- <div
71
- className={classNames(
72
- mode === 'simple' ? 'min-h-[3em]' : 'min-h-[6.5em]',
73
- 'w-full rounded-md border flex justify-start bg-white text-black border-gray-400 transform '
74
- )}
75
- >
76
- <div
77
- className={classNames(
78
- 'bg-gradient-to-b from-gray-500 to-gray-700 relative flex items-center w-5 justify-center rounded-l-sm text-gray-100-500',
79
- `border-r-[1px] border-gray-500`
80
- )}
81
- >
82
- <ArrowsRightLeftIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
83
- {mode === 'full' && (
84
- <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
85
- Channel
86
- </span>
87
- )}
88
- </div>
89
- <div className="p-1 min-w-60 max-w-[min-content]">
90
- {targetPosition && <Handle type="target" position={targetPosition} />}
91
- {sourcePosition && <Handle type="source" position={sourcePosition} />}
92
- <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
93
- <div className="flex justify-between items-center">
94
- <span className="text-xs font-bold block pb-0.5">{name}</span>
95
- {Icon && <Icon className="w-5 h-5 opacity-60 p-0.5" />}
96
- </div>
97
- <div className="flex justify-between">
98
- <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
99
- {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Channel</span>}
72
+ <ContextMenu.Root>
73
+ <ContextMenu.Trigger>
74
+ <div
75
+ className={classNames(
76
+ mode === 'simple' ? 'min-h-[3em]' : 'min-h-[6.5em]',
77
+ 'w-full rounded-md border flex justify-start bg-white text-black border-gray-400 transform '
78
+ )}
79
+ >
80
+ <div
81
+ className={classNames(
82
+ 'bg-gradient-to-b from-gray-500 to-gray-700 relative flex items-center w-5 justify-center rounded-l-sm text-gray-100-500',
83
+ `border-r-[1px] border-gray-500`
84
+ )}
85
+ >
86
+ <ArrowsRightLeftIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
87
+ {mode === 'full' && (
88
+ <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
89
+ Channel
90
+ </span>
91
+ )}
100
92
  </div>
101
- </div>
102
- {mode === 'full' && (
103
- <div className="divide-y divide-gray-200 ">
104
- <div className="leading-[10px] py-1 ">
105
- <span className="text-[8px] font-light">{summary}</span>
93
+ <div className="p-1 min-w-60 max-w-[min-content]">
94
+ {targetPosition && <Handle type="target" position={targetPosition} />}
95
+ {sourcePosition && <Handle type="source" position={sourcePosition} />}
96
+ <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
97
+ <div className="flex justify-between items-center">
98
+ <span className="text-xs font-bold block pb-0.5">{name}</span>
99
+ {Icon && <Icon className="w-5 h-5 opacity-60 p-0.5" />}
100
+ </div>
101
+ <div className="flex justify-between">
102
+ <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
103
+ {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Channel</span>}
104
+ </div>
106
105
  </div>
107
- {address && (
108
- <div className="leading-3 py-1 flex flex-col items-start space-y-0.5">
109
- <div className="text-[6px] flex items-center space-x-0.5 ">
110
- <LinkIcon className="w-2 h-2 opacity-60" />
111
- <span className="block font-normal ">{getAddress()}</span>
106
+ {mode === 'full' && (
107
+ <div className="divide-y divide-gray-200 ">
108
+ <div className="leading-[10px] py-1 ">
109
+ <span className="text-[8px] font-light">{summary}</span>
112
110
  </div>
113
- {protocols.length > 0 && (
114
- <div className="text-[6px] font-semibold flex space-x-2 items-center ">
115
- {[...protocols].map((protocol, index) => {
116
- const ProtoColIcon = getIconForProtocol(protocol);
117
- return (
118
- <span key={index} className="font-normal flex items-center -ml-[1px] space-x-0.5">
119
- {ProtoColIcon && <ProtoColIcon className="w-2 h-2 opacity-60 inline-block" />}
120
- <span>{protocol}</span>
121
- </span>
122
- );
123
- })}
111
+ {address && (
112
+ <div className="leading-3 py-1 flex flex-col items-start space-y-0.5">
113
+ <div className="text-[6px] flex items-center space-x-0.5 ">
114
+ <LinkIcon className="w-2 h-2 opacity-60" />
115
+ <span className="block font-normal ">{getAddress()}</span>
116
+ </div>
117
+ {protocols.length > 0 && (
118
+ <div className="text-[6px] font-semibold flex space-x-2 items-center ">
119
+ {[...protocols].map((protocol, index) => {
120
+ const ProtoColIcon = getIconForProtocol(protocol);
121
+ return (
122
+ <span key={index} className="font-normal flex items-center -ml-[1px] space-x-0.5">
123
+ {ProtoColIcon && <ProtoColIcon className="w-2 h-2 opacity-60 inline-block" />}
124
+ <span>{protocol}</span>
125
+ </span>
126
+ );
127
+ })}
128
+ </div>
129
+ )}
124
130
  </div>
125
131
  )}
126
132
  </div>
127
133
  )}
128
134
  </div>
129
- )}
130
- </div>
131
- </div>
135
+ </div>
136
+ </ContextMenu.Trigger>
137
+ <ContextMenu.Portal>
138
+ <ContextMenu.Content className="min-w-[220px] bg-white rounded-md p-1 shadow-md border border-gray-200">
139
+ <ContextMenu.Item
140
+ asChild
141
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
142
+ >
143
+ <a href={buildUrl(`/docs/channels/${id}/${version}`)}>Read documentation</a>
144
+ </ContextMenu.Item>
145
+ <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
146
+
147
+ <ContextMenu.Item asChild>
148
+ <a
149
+ href={buildUrl(`/docs/channels/${id}/${version}/changelog`)}
150
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
151
+ target="_blank"
152
+ rel="noopener noreferrer"
153
+ >
154
+ Read changelog
155
+ </a>
156
+ </ContextMenu.Item>
157
+ </ContextMenu.Content>
158
+ </ContextMenu.Portal>
159
+ </ContextMenu.Root>
132
160
  );
133
161
  }
@@ -1,6 +1,7 @@
1
1
  import { ChatBubbleLeftIcon } from '@heroicons/react/16/solid';
2
2
  import type { CollectionEntry } from 'astro:content';
3
3
  import { Handle } from '@xyflow/react';
4
+ import MessageContextMenu from './MessageContextMenu';
4
5
 
5
6
  interface Data {
6
7
  title: string;
@@ -20,52 +21,54 @@ function classNames(...classes: any) {
20
21
  export default function CommandNode({ data, sourcePosition, targetPosition }: any) {
21
22
  const { mode, message } = data as Data;
22
23
 
23
- const { name, version, summary, owners = [], producers = [], consumers = [] } = message.data;
24
+ const { id, name, version, summary, owners = [], producers = [], consumers = [], schemaPath } = message.data;
24
25
 
25
26
  return (
26
- <div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-blue-400')}>
27
- <div
28
- className={classNames(
29
- 'bg-gradient-to-b from-blue-500 to-blue-700 relative flex items-center w-5 justify-center rounded-l-sm text-blue-100-500',
30
- `border-r-[1px] border-blue-500`
31
- )}
32
- >
33
- <ChatBubbleLeftIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
34
- {mode === 'full' && (
35
- <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
36
- Command
37
- </span>
38
- )}
39
- </div>
40
- <div className="p-1 min-w-60 max-w-[min-content]">
41
- {targetPosition && <Handle type="target" position={targetPosition} />}
42
- {sourcePosition && <Handle type="source" position={sourcePosition} />}
43
- <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
44
- <span className="text-xs font-bold block pb-0.5">{name}</span>
45
- <div className="flex justify-between">
46
- <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
47
- {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Command</span>}
48
- </div>
27
+ <MessageContextMenu message={message} messageType="commands">
28
+ <div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-blue-400')}>
29
+ <div
30
+ className={classNames(
31
+ 'bg-gradient-to-b from-blue-500 to-blue-700 relative flex items-center w-5 justify-center rounded-l-sm text-blue-100-500',
32
+ `border-r-[1px] border-blue-500`
33
+ )}
34
+ >
35
+ <ChatBubbleLeftIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
36
+ {mode === 'full' && (
37
+ <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
38
+ Command
39
+ </span>
40
+ )}
49
41
  </div>
50
- {mode === 'full' && (
51
- <div className="divide-y divide-gray-200 ">
52
- <div className="leading-3 py-1">
53
- <span className="text-[8px] font-light">{summary}</span>
54
- </div>
55
- <div className="grid grid-cols-2 gap-x-4 py-1">
56
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
57
- Producers: {producers.length}
58
- </span>
59
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
60
- Consumers: {consumers.length}
61
- </span>
62
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
63
- Owners: {owners.length}
64
- </span>
42
+ <div className="p-1 min-w-60 max-w-[min-content]">
43
+ {targetPosition && <Handle type="target" position={targetPosition} />}
44
+ {sourcePosition && <Handle type="source" position={sourcePosition} />}
45
+ <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
46
+ <span className="text-xs font-bold block pb-0.5">{name}</span>
47
+ <div className="flex justify-between">
48
+ <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
49
+ {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Command</span>}
65
50
  </div>
66
51
  </div>
67
- )}
52
+ {mode === 'full' && (
53
+ <div className="divide-y divide-gray-200 ">
54
+ <div className="leading-3 py-1">
55
+ <span className="text-[8px] font-light">{summary}</span>
56
+ </div>
57
+ <div className="grid grid-cols-2 gap-x-4 py-1">
58
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
59
+ Producers: {producers.length}
60
+ </span>
61
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
62
+ Consumers: {consumers.length}
63
+ </span>
64
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
65
+ Owners: {owners.length}
66
+ </span>
67
+ </div>
68
+ </div>
69
+ )}
70
+ </div>
68
71
  </div>
69
- </div>
72
+ </MessageContextMenu>
70
73
  );
71
74
  }
@@ -1,6 +1,7 @@
1
1
  import { BoltIcon } from '@heroicons/react/16/solid';
2
2
  import type { CollectionEntry } from 'astro:content';
3
3
  import { Handle } from '@xyflow/react';
4
+ import MessageContextMenu from './MessageContextMenu';
4
5
 
5
6
  interface Data {
6
7
  title: string;
@@ -19,53 +20,54 @@ function classNames(...classes: any) {
19
20
 
20
21
  export default function EventNode({ data, sourcePosition, targetPosition }: any) {
21
22
  const { mode, message } = data as Data;
22
-
23
23
  const { name, version, summary, owners = [], producers = [], consumers = [] } = message.data;
24
24
 
25
25
  return (
26
- <div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-orange-400')}>
27
- <div
28
- className={classNames(
29
- 'bg-gradient-to-b from-orange-500 to-orange-700 relative flex items-center w-5 justify-center rounded-l-sm text-orange-100-500',
30
- `border-r-[1px] border-orange-500`
31
- )}
32
- >
33
- <BoltIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
34
- {mode === 'full' && (
35
- <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
36
- Event
37
- </span>
38
- )}
39
- </div>
40
- <div className="p-1 min-w-60 max-w-[min-content]">
41
- {targetPosition && <Handle type="target" position={targetPosition} />}
42
- {sourcePosition && <Handle type="source" position={sourcePosition} />}
43
- <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
44
- <span className="text-xs font-bold block pb-0.5">{name}</span>
45
- <div className="flex justify-between">
46
- <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
47
- {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Event</span>}
48
- </div>
26
+ <MessageContextMenu message={message} messageType="events">
27
+ <div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-orange-400')}>
28
+ <div
29
+ className={classNames(
30
+ 'bg-gradient-to-b from-orange-500 to-orange-700 relative flex items-center w-5 justify-center rounded-l-sm text-orange-100-500',
31
+ `border-r-[1px] border-orange-500`
32
+ )}
33
+ >
34
+ <BoltIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
35
+ {mode === 'full' && (
36
+ <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
37
+ Event
38
+ </span>
39
+ )}
49
40
  </div>
50
- {mode === 'full' && (
51
- <div className="divide-y divide-gray-200 ">
52
- <div className="leading-3 py-1">
53
- <span className="text-[8px] font-light">{summary}</span>
54
- </div>
55
- <div className="grid grid-cols-2 gap-x-4 py-1">
56
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
57
- Producers: {producers.length}
58
- </span>
59
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
60
- Consumers: {consumers.length}
61
- </span>
62
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
63
- Owners: {owners.length}
64
- </span>
41
+ <div className="p-1 min-w-60 max-w-[min-content]">
42
+ {targetPosition && <Handle type="target" position={targetPosition} />}
43
+ {sourcePosition && <Handle type="source" position={sourcePosition} />}
44
+ <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
45
+ <span className="text-xs font-bold block pb-0.5">{name}</span>
46
+ <div className="flex justify-between">
47
+ <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
48
+ {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Event</span>}
65
49
  </div>
66
50
  </div>
67
- )}
51
+ {mode === 'full' && (
52
+ <div className="divide-y divide-gray-200 ">
53
+ <div className="leading-3 py-1">
54
+ <span className="text-[8px] font-light">{summary}</span>
55
+ </div>
56
+ <div className="grid grid-cols-2 gap-x-4 py-1">
57
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
58
+ Producers: {producers.length}
59
+ </span>
60
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
61
+ Consumers: {consumers.length}
62
+ </span>
63
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
64
+ Owners: {owners.length}
65
+ </span>
66
+ </div>
67
+ </div>
68
+ )}
69
+ </div>
68
70
  </div>
69
- </div>
71
+ </MessageContextMenu>
70
72
  );
71
73
  }
@@ -0,0 +1,54 @@
1
+ import * as ContextMenu from '@radix-ui/react-context-menu';
2
+ import { buildUrl } from '@utils/url-builder';
3
+ import type { CollectionEntry } from 'astro:content';
4
+ import type { CollectionMessageTypes } from '@types';
5
+ interface Data {
6
+ message: CollectionEntry<CollectionMessageTypes>;
7
+ messageType: CollectionMessageTypes;
8
+ children: React.ReactNode;
9
+ }
10
+
11
+ export default function MessageContextMenu(data: Data) {
12
+ const { message, messageType, children } = data;
13
+ const { id, version, name, schemaPath } = message.data;
14
+
15
+ return (
16
+ <ContextMenu.Root>
17
+ <ContextMenu.Trigger>{children}</ContextMenu.Trigger>
18
+ <ContextMenu.Portal>
19
+ <ContextMenu.Content className="min-w-[220px] bg-white rounded-md p-1 shadow-md border border-gray-200">
20
+ <ContextMenu.Item
21
+ asChild
22
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
23
+ >
24
+ <a href={buildUrl(`/docs/${messageType}/${id}/${version}`)}>Read documentation</a>
25
+ </ContextMenu.Item>
26
+ <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
27
+ {schemaPath && (
28
+ <ContextMenu.Item asChild>
29
+ <a
30
+ href={buildUrl(`/generated/${messageType}/${id}/schema.json`)}
31
+ download={`${name}(${version})-${schemaPath}`}
32
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
33
+ target="_blank"
34
+ rel="noopener noreferrer"
35
+ >
36
+ Download schema
37
+ </a>
38
+ </ContextMenu.Item>
39
+ )}
40
+ <ContextMenu.Item asChild>
41
+ <a
42
+ href={buildUrl(`/docs/${messageType}/${id}/${version}/changelog`)}
43
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
44
+ target="_blank"
45
+ rel="noopener noreferrer"
46
+ >
47
+ Read changelog
48
+ </a>
49
+ </ContextMenu.Item>
50
+ </ContextMenu.Content>
51
+ </ContextMenu.Portal>
52
+ </ContextMenu.Root>
53
+ );
54
+ }