@eventcatalog/core 2.15.0 → 2.16.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/default-files-for-collections/ubiquitousLanguages.md +7 -0
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/catalog-to-astro-content-directory.cjs +12 -3
- package/dist/catalog-to-astro-content-directory.js +2 -2
- package/dist/{chunk-O6BGVVOW.js → chunk-55YPRY5U.js} +3 -2
- package/dist/{chunk-PK2EQVPD.js → chunk-5RNDOKYT.js} +10 -2
- package/dist/{chunk-KI4KAUWW.js → chunk-A3QFF66M.js} +1 -1
- package/dist/{chunk-TGOUSS6C.js → chunk-GEPV3ACK.js} +1 -1
- package/dist/{chunk-65VQIGAP.js → chunk-J5H7ICLD.js} +1 -1
- package/dist/{chunk-7HYM3M5I.js → chunk-NTCYOR4N.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +13 -4
- package/dist/eventcatalog.js +6 -6
- package/dist/map-catalog-to-astro.cjs +10 -2
- package/dist/map-catalog-to-astro.js +1 -1
- package/dist/watcher.cjs +10 -2
- package/dist/watcher.js +2 -2
- package/eventcatalog/src/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +1 -1
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +1 -0
- package/eventcatalog/src/components/MDX/SchemaViewer/SchemaViewer.astro +6 -1
- package/eventcatalog/src/components/SideBars/CatalogResourcesSideBar/index.tsx +29 -2
- package/eventcatalog/src/components/SideBars/DomainSideBar.astro +23 -0
- package/eventcatalog/src/components/Tables/Table.tsx +11 -1
- package/eventcatalog/src/components/Tables/columns/DomainTableColumns.tsx +4 -10
- package/eventcatalog/src/components/Tables/columns/FlowTableColumns.tsx +3 -3
- package/eventcatalog/src/components/Tables/columns/MessageTableColumns.tsx +5 -2
- package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +89 -63
- package/eventcatalog/src/components/Tables/columns/SharedColumns.tsx +44 -0
- package/eventcatalog/src/components/Tables/filters/custom-filters.ts +5 -0
- package/eventcatalog/src/content/config.ts +18 -0
- package/eventcatalog/src/layouts/DiscoverLayout.astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language.astro +301 -0
- package/eventcatalog/src/utils/collections/domains.ts +14 -2
- package/eventcatalog/src/utils/collections/icons.ts +3 -0
- package/package.json +3 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ServerIcon, BoltIcon, ChatBubbleLeftIcon } from '@heroicons/react/24/solid';
|
|
2
2
|
import { createColumnHelper } from '@tanstack/react-table';
|
|
3
3
|
import type { CollectionEntry } from 'astro:content';
|
|
4
|
-
import { useMemo } from 'react';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
5
|
import { filterByName, filterCollectionByName } from '../filters/custom-filters';
|
|
6
6
|
import { buildUrl } from '@utils/url-builder';
|
|
7
7
|
import { getColorAndIconForMessageType } from './MessageTableColumns';
|
|
8
|
+
import { createBadgesColumn } from './SharedColumns';
|
|
8
9
|
|
|
9
10
|
const columnHelper = createColumnHelper<CollectionEntry<'services'>>();
|
|
10
11
|
|
|
@@ -40,14 +41,6 @@ export const columns = () => [
|
|
|
40
41
|
},
|
|
41
42
|
filterFn: filterByName,
|
|
42
43
|
}),
|
|
43
|
-
// columnHelper.accessor('data.version', {
|
|
44
|
-
// header: () => <span>Version</span>,
|
|
45
|
-
// cell: (info) => {
|
|
46
|
-
// const service = info.row.original;
|
|
47
|
-
// return <div className="text-left">{`v${info.getValue()} ${service.data.latestVersion === service.data.version ? '(latest)': ''}`}</div>
|
|
48
|
-
// },
|
|
49
|
-
// footer: (info) => info.column.id,
|
|
50
|
-
// }),
|
|
51
44
|
columnHelper.accessor('data.summary', {
|
|
52
45
|
id: 'summary',
|
|
53
46
|
header: () => 'Summary',
|
|
@@ -65,39 +58,59 @@ export const columns = () => [
|
|
|
65
58
|
collectionFilterKey: 'receives',
|
|
66
59
|
},
|
|
67
60
|
cell: (info) => {
|
|
68
|
-
const receives = info.getValue();
|
|
61
|
+
const receives = info.getValue() || [];
|
|
62
|
+
const isExpandable = receives?.length > 10;
|
|
63
|
+
const isOpen = isExpandable ? receives?.length < 10 : true;
|
|
64
|
+
const [isExpanded, setIsExpanded] = useState(isOpen);
|
|
65
|
+
|
|
66
|
+
const receiversWithIcons = useMemo(
|
|
67
|
+
() =>
|
|
68
|
+
receives?.map((consumer: any) => {
|
|
69
|
+
const type = consumer.collection.slice(0, -1);
|
|
70
|
+
return {
|
|
71
|
+
...consumer,
|
|
72
|
+
...getColorAndIconForMessageType(type),
|
|
73
|
+
};
|
|
74
|
+
}) || [],
|
|
75
|
+
[receives]
|
|
76
|
+
);
|
|
77
|
+
|
|
69
78
|
if (receives?.length === 0 || !receives)
|
|
70
79
|
return <div className="text-sm text-gray-400/80 text-left italic">Service receives no messages.</div>;
|
|
71
80
|
|
|
72
81
|
return (
|
|
73
|
-
<
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<span className="
|
|
89
|
-
{consumer.
|
|
82
|
+
<div>
|
|
83
|
+
{isExpandable && (
|
|
84
|
+
<button onClick={() => setIsExpanded(!isExpanded)} className="mb-2 text-sm text-gray-600 hover:text-gray-900">
|
|
85
|
+
{isExpanded ? '▼' : '▶'} {receives.length} message{receives.length !== 1 ? 's' : ''}
|
|
86
|
+
</button>
|
|
87
|
+
)}
|
|
88
|
+
{isExpanded && (
|
|
89
|
+
<ul>
|
|
90
|
+
{receiversWithIcons.map((consumer: any, index: number) => (
|
|
91
|
+
<li key={`${consumer.data.id}-${index}`} className="py-1 group font-light ">
|
|
92
|
+
<a
|
|
93
|
+
href={buildUrl(`/docs/${consumer.collection}/${consumer.data.id}/${consumer.data.version}`)}
|
|
94
|
+
className="group-hover:text-primary flex space-x-1 items-center "
|
|
95
|
+
>
|
|
96
|
+
<div className={`flex items-center border border-gray-300 shadow-sm rounded-md`}>
|
|
97
|
+
<span className="flex items-center">
|
|
98
|
+
<span className={`bg-${consumer.color}-500 h-full rounded-tl rounded-bl p-1`}>
|
|
99
|
+
<consumer.Icon className="h-4 w-4 text-white" />
|
|
100
|
+
</span>
|
|
101
|
+
<span className="leading-none px-2 group-hover:underline ">
|
|
102
|
+
{consumer.data.name} (v{consumer.data.version})
|
|
103
|
+
</span>
|
|
90
104
|
</span>
|
|
91
|
-
</
|
|
92
|
-
</
|
|
93
|
-
</
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
</
|
|
105
|
+
</div>
|
|
106
|
+
</a>
|
|
107
|
+
</li>
|
|
108
|
+
))}
|
|
109
|
+
</ul>
|
|
110
|
+
)}
|
|
111
|
+
</div>
|
|
98
112
|
);
|
|
99
113
|
},
|
|
100
|
-
// footer: (info) => info.column.id,
|
|
101
114
|
filterFn: filterCollectionByName('receives'),
|
|
102
115
|
}),
|
|
103
116
|
columnHelper.accessor('data.sends', {
|
|
@@ -107,42 +120,55 @@ export const columns = () => [
|
|
|
107
120
|
collectionFilterKey: 'sends',
|
|
108
121
|
},
|
|
109
122
|
cell: (info) => {
|
|
110
|
-
const sends = info.getValue();
|
|
123
|
+
const sends = info.getValue() || [];
|
|
124
|
+
const isExpandable = sends?.length > 10;
|
|
125
|
+
const isOpen = isExpandable ? sends?.length < 10 : true;
|
|
126
|
+
const [isExpanded, setIsExpanded] = useState(isOpen);
|
|
127
|
+
|
|
111
128
|
if (sends?.length === 0 || !sends)
|
|
112
129
|
return <div className="text-sm text-gray-400/80 text-left italic">Service sends no messages.</div>;
|
|
113
130
|
|
|
114
131
|
return (
|
|
115
|
-
<
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
132
|
+
<div>
|
|
133
|
+
{isExpandable && (
|
|
134
|
+
<button onClick={() => setIsExpanded(!isExpanded)} className="mb-2 text-sm text-gray-600 hover:text-gray-900">
|
|
135
|
+
{isExpanded ? '▼' : '▶'} {sends.length} message{sends.length !== 1 ? 's' : ''}
|
|
136
|
+
</button>
|
|
137
|
+
)}
|
|
138
|
+
{isExpanded && (
|
|
139
|
+
<ul>
|
|
140
|
+
{sends.map((consumer: any, index: number) => {
|
|
141
|
+
const type = consumer.collection.slice(0, -1);
|
|
142
|
+
const color = type === 'event' ? 'orange' : 'blue';
|
|
143
|
+
const Icon = type === 'event' ? BoltIcon : ChatBubbleLeftIcon;
|
|
144
|
+
return (
|
|
145
|
+
<li key={`${consumer.data.id}-${index}`} className="py-1 group font-light">
|
|
146
|
+
<a
|
|
147
|
+
href={buildUrl(`/docs/${consumer.collection}/${consumer.data.id}/${consumer.data.version}`)}
|
|
148
|
+
className="group-hover:text-primary flex space-x-1 items-center "
|
|
149
|
+
>
|
|
150
|
+
<div className={`flex items-center border border-gray-300 shadow-sm rounded-md`}>
|
|
151
|
+
<span className="flex items-center">
|
|
152
|
+
<span className={`bg-${color}-500 h-full rounded-tl rounded-bl p-1`}>
|
|
153
|
+
<Icon className="h-4 w-4 text-white" />
|
|
154
|
+
</span>
|
|
155
|
+
<span className="leading-none px-2 group-hover:underline ">
|
|
156
|
+
{consumer.data.name} (v{consumer.data.version})
|
|
157
|
+
</span>
|
|
158
|
+
</span>
|
|
159
|
+
</div>
|
|
160
|
+
</a>
|
|
161
|
+
</li>
|
|
162
|
+
);
|
|
163
|
+
})}
|
|
164
|
+
</ul>
|
|
165
|
+
)}
|
|
166
|
+
</div>
|
|
141
167
|
);
|
|
142
168
|
},
|
|
143
|
-
// footer: (info) => info.column.id,
|
|
144
169
|
filterFn: filterCollectionByName('sends'),
|
|
145
170
|
}),
|
|
171
|
+
createBadgesColumn(columnHelper),
|
|
146
172
|
columnHelper.accessor('data.name', {
|
|
147
173
|
header: () => <span />,
|
|
148
174
|
cell: (info) => {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createColumnHelper } from '@tanstack/react-table';
|
|
2
|
+
import { Tag } from 'lucide-react';
|
|
3
|
+
import { filterByBadge } from '../filters/custom-filters';
|
|
4
|
+
export const createBadgesColumn = <T extends { data: { badges?: any[] } }>(
|
|
5
|
+
columnHelper: ReturnType<typeof createColumnHelper<T>>
|
|
6
|
+
) => {
|
|
7
|
+
return columnHelper.accessor((row) => row.data.badges, {
|
|
8
|
+
id: 'badges',
|
|
9
|
+
header: () => <span>Badges</span>,
|
|
10
|
+
cell: (info) => {
|
|
11
|
+
const item = info.row.original;
|
|
12
|
+
const badges = item.data.badges || [];
|
|
13
|
+
|
|
14
|
+
if (badges?.length === 0 || !badges)
|
|
15
|
+
return <div className="font-light text-sm text-gray-400/60 text-left italic">No badges documented</div>;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ul>
|
|
19
|
+
{badges.map((badge: any, index: number) => {
|
|
20
|
+
return (
|
|
21
|
+
<li key={`${badge.id}-${index}`} className="py-1 group font-light ">
|
|
22
|
+
<div className="group-hover:text-primary flex space-x-1 items-center ">
|
|
23
|
+
<div className="flex items-center border border-gray-300 shadow-sm rounded-md">
|
|
24
|
+
<span className="flex items-center">
|
|
25
|
+
<span className={`bg-${badge.backgroundColor}-500 h-full rounded-tl rounded-bl p-1`}>
|
|
26
|
+
{badge.icon && <badge.icon className="h-4 w-4 text-white" />}
|
|
27
|
+
{!badge.icon && <Tag className="h-4 w-4 text-white" />}
|
|
28
|
+
</span>
|
|
29
|
+
<span className="leading-none px-2 group-hover:underline ">{badge.content}</span>
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</li>
|
|
34
|
+
);
|
|
35
|
+
})}
|
|
36
|
+
</ul>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
meta: {
|
|
40
|
+
filterVariant: 'badges',
|
|
41
|
+
},
|
|
42
|
+
filterFn: filterByBadge,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
@@ -12,3 +12,8 @@ export const filterByName = (row: any, key: string, searchValue: string) => {
|
|
|
12
12
|
const label = `${row?.original?.data.name} (v${row?.original?.data.version})` || '';
|
|
13
13
|
return label.toLowerCase().includes(searchValue.toLowerCase());
|
|
14
14
|
};
|
|
15
|
+
|
|
16
|
+
export const filterByBadge = (row: any, key: string, searchValue: string) => {
|
|
17
|
+
const badges = row?.original?.data?.badges || [];
|
|
18
|
+
return badges.some((badge: any) => badge.content.toLowerCase().includes(searchValue.toLowerCase()));
|
|
19
|
+
};
|
|
@@ -221,6 +221,23 @@ const domains = defineCollection({
|
|
|
221
221
|
.merge(baseSchema),
|
|
222
222
|
});
|
|
223
223
|
|
|
224
|
+
const ubiquitousLanguages = defineCollection({
|
|
225
|
+
type: 'content',
|
|
226
|
+
schema: z.object({
|
|
227
|
+
dictionary: z
|
|
228
|
+
.array(
|
|
229
|
+
z.object({
|
|
230
|
+
id: z.string(),
|
|
231
|
+
name: z.string(),
|
|
232
|
+
summary: z.string().optional(),
|
|
233
|
+
description: z.string().optional(),
|
|
234
|
+
icon: z.string().optional(),
|
|
235
|
+
})
|
|
236
|
+
)
|
|
237
|
+
.optional(),
|
|
238
|
+
}),
|
|
239
|
+
});
|
|
240
|
+
|
|
224
241
|
const users = defineCollection({
|
|
225
242
|
type: 'content',
|
|
226
243
|
schema: z.object({
|
|
@@ -270,4 +287,5 @@ export const collections = {
|
|
|
270
287
|
flows,
|
|
271
288
|
pages,
|
|
272
289
|
changelogs,
|
|
290
|
+
ubiquitousLanguages,
|
|
273
291
|
};
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Footer from '@layouts/Footer.astro';
|
|
3
|
+
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
4
|
+
import { getDomains, type Domain, getUbiquitousLanguage } from '@utils/collections/domains';
|
|
5
|
+
import type { CollectionEntry } from 'astro:content';
|
|
6
|
+
import { ViewTransitions } from 'astro:transitions';
|
|
7
|
+
import * as LucideIcons from 'lucide-react';
|
|
8
|
+
|
|
9
|
+
export async function getStaticPaths() {
|
|
10
|
+
const domains = await getDomains();
|
|
11
|
+
|
|
12
|
+
const buildPages = (collection: CollectionEntry<'domains'>[]) => {
|
|
13
|
+
return collection.map((item) => ({
|
|
14
|
+
params: {
|
|
15
|
+
type: item.collection,
|
|
16
|
+
id: item.data.id,
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
type: item.collection,
|
|
20
|
+
...item,
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return [...buildPages(domains)];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const props = Astro.props;
|
|
29
|
+
const pageTitle = `${props.collection} | ${props.data.name}`.replace(/^\w/, (c) => c.toUpperCase());
|
|
30
|
+
const ubiquitousLanguages = await getUbiquitousLanguage(props);
|
|
31
|
+
|
|
32
|
+
const ubiquitousLanguage = ubiquitousLanguages[0];
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
<VerticalSideBarLayout title={pageTitle} description={props.data.summary}>
|
|
36
|
+
<main class="flex sm:px-8 docs-layout h-full">
|
|
37
|
+
<div class="flex docs-layout w-full">
|
|
38
|
+
<div class="w-full lg:mr-2 pr-8 overflow-y-auto py-8 min-h-[50em]">
|
|
39
|
+
<nav class="flex mb-4" aria-label="Breadcrumb">
|
|
40
|
+
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
|
41
|
+
<li class="inline-flex items-center">
|
|
42
|
+
<a
|
|
43
|
+
href={`/docs/${props.type}/${props.data.id}/${props.data.latestVersion}`}
|
|
44
|
+
class="inline-flex items-center text-sm font-medium text-gray-500 hover:text-primary"
|
|
45
|
+
>
|
|
46
|
+
<svg
|
|
47
|
+
class="w-3 h-3 mr-2.5"
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
50
|
+
fill="none"
|
|
51
|
+
viewBox="0 0 24 24"
|
|
52
|
+
stroke-width="2"
|
|
53
|
+
stroke="currentColor"
|
|
54
|
+
>
|
|
55
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"></path>
|
|
56
|
+
</svg>
|
|
57
|
+
Back to Documentation
|
|
58
|
+
</a>
|
|
59
|
+
</li>
|
|
60
|
+
</ol>
|
|
61
|
+
</nav>
|
|
62
|
+
|
|
63
|
+
<div class="border-b border-gray-200 flex justify-between items-start md:pb-2">
|
|
64
|
+
<div>
|
|
65
|
+
<h2 id="doc-page-header" class="text-2xl md:text-4xl font-bold text-black">Domain Language Explorer</h2>
|
|
66
|
+
<h2 class="text-2xl pt-2 text-gray-500 font-light">{props.data.name} domain</h2>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
{
|
|
71
|
+
!ubiquitousLanguage && (
|
|
72
|
+
<div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 my-4">
|
|
73
|
+
<p class="text-yellow-700">
|
|
74
|
+
This domain does not have any defined ubiquitous language terms yet. Consider adding some terms to help establish
|
|
75
|
+
a common vocabulary for your domain.
|
|
76
|
+
</p>
|
|
77
|
+
</div>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
<div class="py-4 w-full min-h-[calc(100vh-10em)]">
|
|
82
|
+
{
|
|
83
|
+
ubiquitousLanguage && (
|
|
84
|
+
<>
|
|
85
|
+
<div class="mb-6">
|
|
86
|
+
<input
|
|
87
|
+
type="text"
|
|
88
|
+
id="searchInput"
|
|
89
|
+
placeholder="Search terms..."
|
|
90
|
+
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
{!ubiquitousLanguage ? (
|
|
95
|
+
<div class="text-center py-12 bg-gray-50 rounded-lg">
|
|
96
|
+
<h3 class="text-lg font-medium text-gray-900">No domain language terms</h3>
|
|
97
|
+
<p class="mt-2 text-sm text-gray-500">There are no language terms defined for this domain yet.</p>
|
|
98
|
+
</div>
|
|
99
|
+
) : (
|
|
100
|
+
<div id="termsGrid" class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
101
|
+
{ubiquitousLanguage?.data?.dictionary?.map((term) => (
|
|
102
|
+
<div class="term-card block bg-white border border-gray-200 rounded-lg p-6 transition-all duration-300 ease-in-out hover:shadow-md hover:border-primary focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-primary focus:ring-white min-h-[12em] cursor-pointer">
|
|
103
|
+
<div class="flex flex-col h-full space-y-8">
|
|
104
|
+
{term.icon && (
|
|
105
|
+
<>
|
|
106
|
+
{(() => {
|
|
107
|
+
const Icon = LucideIcons[term.icon as keyof typeof LucideIcons];
|
|
108
|
+
//@ts-ignore
|
|
109
|
+
return Icon ? <Icon className="w-6 h-6 text-primary" /> : null;
|
|
110
|
+
})()}
|
|
111
|
+
</>
|
|
112
|
+
)}
|
|
113
|
+
<div>
|
|
114
|
+
<h3 class="text-gray-800 text-lg font-semibold transition-colors duration-300 ease-in-out group-hover:text-gray-300">
|
|
115
|
+
{term.name}
|
|
116
|
+
</h3>
|
|
117
|
+
<div class="term-content">
|
|
118
|
+
<p class="summary-text text-gray-600 transition-colors duration-300 ease-in-out group-hover:text-gray-200 m-0 font-light text-sm mb-4">
|
|
119
|
+
{term.summary}
|
|
120
|
+
</p>
|
|
121
|
+
{term.description && (
|
|
122
|
+
<>
|
|
123
|
+
<p class="description-text hidden text-gray-600 transition-colors duration-300 ease-in-out group-hover:text-gray-200 m-0 font-light text-sm whitespace-pre-line">
|
|
124
|
+
{term.description}
|
|
125
|
+
</p>
|
|
126
|
+
<span class="show-more-text text-sm text-primary font-medium">Show more</span>
|
|
127
|
+
</>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
))}
|
|
134
|
+
</div>
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
<div id="noSearchResults" class="hidden text-center py-12 bg-gray-50 rounded-lg">
|
|
138
|
+
<h3 class="text-lg font-medium text-gray-900">No matching terms</h3>
|
|
139
|
+
<p class="mt-2 text-sm text-gray-500">Try adjusting your search terms.</p>
|
|
140
|
+
</div>
|
|
141
|
+
</>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<Footer />
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
<ViewTransitions />
|
|
150
|
+
</main>
|
|
151
|
+
|
|
152
|
+
<script>
|
|
153
|
+
function initializeSearch() {
|
|
154
|
+
const searchInput = document.getElementById('searchInput');
|
|
155
|
+
const termCards = document.querySelectorAll('.term-card');
|
|
156
|
+
const noSearchResults = document.getElementById('noSearchResults');
|
|
157
|
+
|
|
158
|
+
searchInput?.addEventListener('input', (e) => {
|
|
159
|
+
const searchTerm = (e.target as HTMLInputElement).value.toLowerCase();
|
|
160
|
+
let visibleCount = 0;
|
|
161
|
+
|
|
162
|
+
termCards.forEach((card) => {
|
|
163
|
+
const title = card.querySelector('h3')?.textContent?.toLowerCase() || '';
|
|
164
|
+
const description = card.querySelector('p')?.textContent?.toLowerCase() || '';
|
|
165
|
+
const matches = title.includes(searchTerm) || description.includes(searchTerm);
|
|
166
|
+
|
|
167
|
+
card.classList.toggle('hidden', !matches);
|
|
168
|
+
if (matches) visibleCount++;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// Show/hide no results message
|
|
172
|
+
if (noSearchResults) {
|
|
173
|
+
noSearchResults.classList.toggle('hidden', visibleCount > 0);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function initializeShowMore() {
|
|
179
|
+
const cards = document.querySelectorAll('.term-card');
|
|
180
|
+
|
|
181
|
+
cards.forEach((card) => {
|
|
182
|
+
const newCard = card.cloneNode(true);
|
|
183
|
+
if (card.parentNode) {
|
|
184
|
+
card.parentNode.replaceChild(newCard, card);
|
|
185
|
+
// Initially show summary
|
|
186
|
+
const summary = (newCard as Element).querySelector('.summary-text');
|
|
187
|
+
summary?.classList.add('visible');
|
|
188
|
+
}
|
|
189
|
+
newCard.addEventListener('click', () => {
|
|
190
|
+
const description = (newCard as Element).querySelector('.description-text');
|
|
191
|
+
const summary = (newCard as Element).querySelector('.summary-text');
|
|
192
|
+
const showMoreText = (newCard as Element).querySelector('.show-more-text');
|
|
193
|
+
|
|
194
|
+
if (description && summary && showMoreText) {
|
|
195
|
+
(newCard as Element).classList.toggle('expanded');
|
|
196
|
+
description.classList.toggle('visible');
|
|
197
|
+
summary.classList.toggle('visible');
|
|
198
|
+
showMoreText.textContent = description.classList.contains('visible') ? 'Show less' : 'Show more';
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function highlightMatchingTerm() {
|
|
205
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
206
|
+
const termId = urlParams.get('id');
|
|
207
|
+
|
|
208
|
+
if (termId) {
|
|
209
|
+
const cards = document.querySelectorAll('.term-card');
|
|
210
|
+
cards.forEach((card) => {
|
|
211
|
+
const termName = card.querySelector('h3')?.textContent?.trim();
|
|
212
|
+
if (termName?.toLowerCase() === termId.toLowerCase()) {
|
|
213
|
+
// Add highlight class
|
|
214
|
+
card.classList.add('highlighted');
|
|
215
|
+
(card as HTMLElement).click();
|
|
216
|
+
|
|
217
|
+
setTimeout(() => {
|
|
218
|
+
// Scroll into view
|
|
219
|
+
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
220
|
+
}, 300);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
document.addEventListener('astro:page-load', () => {
|
|
227
|
+
initializeShowMore();
|
|
228
|
+
initializeSearch();
|
|
229
|
+
highlightMatchingTerm();
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
initializeShowMore();
|
|
233
|
+
initializeSearch();
|
|
234
|
+
highlightMatchingTerm();
|
|
235
|
+
</script>
|
|
236
|
+
|
|
237
|
+
<style is:global>
|
|
238
|
+
.term-card {
|
|
239
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
240
|
+
min-height: 12em;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.term-card.expanded {
|
|
244
|
+
min-height: 24em;
|
|
245
|
+
background-color: rgb(249 250 251);
|
|
246
|
+
z-index: 10;
|
|
247
|
+
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.summary-text,
|
|
251
|
+
.description-text {
|
|
252
|
+
transition:
|
|
253
|
+
opacity 0.3s ease-in-out,
|
|
254
|
+
max-height 0.3s ease-in-out;
|
|
255
|
+
opacity: 0;
|
|
256
|
+
max-height: 0;
|
|
257
|
+
overflow: hidden;
|
|
258
|
+
display: none;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.summary-text.visible,
|
|
262
|
+
.description-text.visible {
|
|
263
|
+
opacity: 1;
|
|
264
|
+
max-height: 500px;
|
|
265
|
+
margin-bottom: 1rem;
|
|
266
|
+
display: block;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.description-text {
|
|
270
|
+
white-space: pre-line;
|
|
271
|
+
line-height: 1.5;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.show-more-text {
|
|
275
|
+
display: block;
|
|
276
|
+
margin-top: 0.5rem;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.term-card.expanded .show-more-text {
|
|
280
|
+
display: none;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.term-card.highlighted {
|
|
284
|
+
border-color: var(--color-primary);
|
|
285
|
+
box-shadow: 0 0 0 2px var(--color-primary);
|
|
286
|
+
animation: pulse 1s;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
@keyframes pulse {
|
|
290
|
+
0%,
|
|
291
|
+
100% {
|
|
292
|
+
transform: scale(1);
|
|
293
|
+
box-shadow: 0 0 0 2px var(--color-primary);
|
|
294
|
+
}
|
|
295
|
+
50% {
|
|
296
|
+
transform: scale(1.01);
|
|
297
|
+
box-shadow: 0 0 0 4px var(--color-primary);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
</style>
|
|
301
|
+
</VerticalSideBarLayout>
|
|
@@ -6,7 +6,7 @@ import path from 'path';
|
|
|
6
6
|
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
7
7
|
|
|
8
8
|
export type Domain = CollectionEntry<'domains'>;
|
|
9
|
-
|
|
9
|
+
export type UbiquitousLanguage = CollectionEntry<'ubiquitousLanguages'>;
|
|
10
10
|
interface Props {
|
|
11
11
|
getAllVersions?: boolean;
|
|
12
12
|
}
|
|
@@ -28,7 +28,9 @@ export const getDomains = async ({ getAllVersions = true }: Props = {}): Promise
|
|
|
28
28
|
const servicesInDomain = domain.data.services || [];
|
|
29
29
|
|
|
30
30
|
const services = servicesInDomain
|
|
31
|
-
.map((_service
|
|
31
|
+
.map((_service: { id: string; version: string | undefined }) =>
|
|
32
|
+
getItemsFromCollectionByIdAndSemverOrLatest(servicesCollection, _service.id, _service.version)
|
|
33
|
+
)
|
|
32
34
|
.flat();
|
|
33
35
|
|
|
34
36
|
return {
|
|
@@ -50,3 +52,13 @@ export const getDomains = async ({ getAllVersions = true }: Props = {}): Promise
|
|
|
50
52
|
};
|
|
51
53
|
});
|
|
52
54
|
};
|
|
55
|
+
|
|
56
|
+
export const getUbiquitousLanguage = async (domain: Domain): Promise<UbiquitousLanguage[]> => {
|
|
57
|
+
const { collection, data, slug } = domain;
|
|
58
|
+
|
|
59
|
+
const ubiquitousLanguages = await getCollection('ubiquitousLanguages', (ubiquitousLanguage) => {
|
|
60
|
+
return ubiquitousLanguage.id.includes(`${collection}/${data.name}`);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return ubiquitousLanguages;
|
|
64
|
+
};
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ArrowsRightLeftIcon,
|
|
11
11
|
VariableIcon,
|
|
12
12
|
} from '@heroicons/react/24/outline';
|
|
13
|
+
import { BookText } from 'lucide-react';
|
|
13
14
|
|
|
14
15
|
export const getIconForCollection = (collection: string) => {
|
|
15
16
|
switch (collection) {
|
|
@@ -33,6 +34,8 @@ export const getIconForCollection = (collection: string) => {
|
|
|
33
34
|
return ArrowsRightLeftIcon;
|
|
34
35
|
case 'channels-parameter':
|
|
35
36
|
return VariableIcon;
|
|
37
|
+
case 'ubiquitousLanguages':
|
|
38
|
+
return BookText;
|
|
36
39
|
default:
|
|
37
40
|
return ServerIcon;
|
|
38
41
|
}
|
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.
|
|
9
|
+
"version": "2.16.1",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"glob": "^10.4.1",
|
|
69
69
|
"gray-matter": "^4.0.3",
|
|
70
70
|
"html-to-image": "^1.11.11",
|
|
71
|
+
"js-yaml": "^4.1.0",
|
|
71
72
|
"lodash.debounce": "^4.0.8",
|
|
72
73
|
"lodash.merge": "4.6.2",
|
|
73
74
|
"lucide-react": "^0.453.0",
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
"@playwright/test": "^1.48.1",
|
|
92
93
|
"@types/dagre": "^0.7.52",
|
|
93
94
|
"@types/diff": "^5.2.2",
|
|
95
|
+
"@types/js-yaml": "^4.0.9",
|
|
94
96
|
"@types/lodash.debounce": "^4.0.9",
|
|
95
97
|
"@types/lodash.merge": "4.6.9",
|
|
96
98
|
"@types/node": "^20.14.2",
|