@eventcatalog/core 2.31.2 → 2.31.4
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/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/{chunk-U2LUOMEZ.js → chunk-C3M26NRD.js} +1 -1
- package/dist/{chunk-5RIG3ETK.js → chunk-H5QIDJHP.js} +1 -1
- package/dist/{chunk-DETRHSB6.js → chunk-W5HUNIMM.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/src/enterprise/custom-documentation/pages/index.astro +12 -16
- package/eventcatalog/src/enterprise/custom-documentation/utils/custom-docs.ts +76 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +2 -115
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-C3M26NRD.js";
|
|
4
|
+
import "../chunk-W5HUNIMM.js";
|
|
5
|
+
import "../chunk-H5QIDJHP.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
package/dist/eventcatalog.js
CHANGED
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-UKJ7F5WR.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-C3M26NRD.js";
|
|
10
|
+
import "./chunk-W5HUNIMM.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
14
14
|
} from "./chunk-7SI5EVOX.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-H5QIDJHP.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackstagePluginEnabled,
|
|
20
20
|
isEventCatalogProEnabled
|
|
@@ -8,6 +8,7 @@ import mdxComponents from '@components/MDX/components';
|
|
|
8
8
|
import OwnersList from '@components/Lists/OwnersList';
|
|
9
9
|
import { getOwner } from '@utils/collections/owners';
|
|
10
10
|
import CustomDocsNav from '@components/SideNav/CustomDocsNav.astro';
|
|
11
|
+
import { getAdjacentPages } from '../utils/custom-docs';
|
|
11
12
|
|
|
12
13
|
const props = Astro.props;
|
|
13
14
|
const doc = props.data;
|
|
@@ -53,12 +54,7 @@ sidebar.forEach((section: SidebarSection) => {
|
|
|
53
54
|
}
|
|
54
55
|
});
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
const currentIndex = flattenedItems.findIndex((item) => currentSlug === item.slug);
|
|
58
|
-
|
|
59
|
-
// Get previous and next items
|
|
60
|
-
const prevItem = currentIndex > 0 ? flattenedItems[currentIndex - 1] : null;
|
|
61
|
-
const nextItem = currentIndex < flattenedItems.length - 1 ? flattenedItems[currentIndex + 1] : null;
|
|
57
|
+
const { prev, next } = await getAdjacentPages(currentSlug.replace());
|
|
62
58
|
|
|
63
59
|
const ownersRaw = doc?.owners || [];
|
|
64
60
|
const owners = await Promise.all<ReturnType<typeof getOwner>>(ownersRaw.map(getOwner));
|
|
@@ -83,7 +79,7 @@ const badges = doc?.badges || [];
|
|
|
83
79
|
</aside>
|
|
84
80
|
|
|
85
81
|
<!-- Main Content Area - Independent scrolling -->
|
|
86
|
-
<main class="sidebar-transition w-full max-h-content ml-[22em] 2xl:ml-[24em] mr-80 lg:mr-[
|
|
82
|
+
<main class="sidebar-transition w-full max-h-content ml-[22em] 2xl:ml-[24em] mr-80 lg:mr-[20em] max-w-5xl mx-auto">
|
|
87
83
|
<div class="max-w-7xl mx-auto px-6 py-10">
|
|
88
84
|
<div class="border-b border-gray-200 flex justify-between items-start md:pb-6">
|
|
89
85
|
<div>
|
|
@@ -119,27 +115,27 @@ const badges = doc?.badges || [];
|
|
|
119
115
|
<div class="py-8 border-t border-gray-200 mt-8">
|
|
120
116
|
<div class="flex flex-col sm:flex-row justify-between w-full gap-4">
|
|
121
117
|
{
|
|
122
|
-
|
|
118
|
+
prev && (
|
|
123
119
|
<a
|
|
124
|
-
href={buildUrl(`/docs/custom/${
|
|
120
|
+
href={buildUrl(`/docs/custom/${prev.slug}`)}
|
|
125
121
|
class="group flex flex-col border border-gray-200 rounded-lg p-4 hover:border-gray-300 hover:bg-gray-50 transition-colors w-full sm:w-1/2"
|
|
126
122
|
>
|
|
127
123
|
<span class="text-sm text-gray-500 mb-1">Previous</span>
|
|
128
|
-
<span class="font-medium group-hover:text-primary-600 transition-colors">{
|
|
124
|
+
<span class="font-medium group-hover:text-primary-600 transition-colors">{prev.label}</span>
|
|
129
125
|
</a>
|
|
130
126
|
)
|
|
131
127
|
}
|
|
132
128
|
|
|
133
|
-
{!
|
|
129
|
+
{!prev && <div class="w-full sm:w-1/2" />}
|
|
134
130
|
|
|
135
131
|
{
|
|
136
|
-
|
|
132
|
+
next && (
|
|
137
133
|
<a
|
|
138
|
-
href={buildUrl(`/docs/custom/${
|
|
134
|
+
href={buildUrl(`/docs/custom/${next.slug}`)}
|
|
139
135
|
class="group flex flex-col items-end text-right border border-gray-200 rounded-lg p-4 hover:border-gray-300 hover:bg-gray-50 transition-colors w-full sm:w-1/2"
|
|
140
136
|
>
|
|
141
137
|
<span class="text-sm text-gray-500 mb-1">Next</span>
|
|
142
|
-
<span class="font-medium group-hover:text-primary-600 transition-colors">{
|
|
138
|
+
<span class="font-medium group-hover:text-primary-600 transition-colors">{next.label}</span>
|
|
143
139
|
</a>
|
|
144
140
|
)
|
|
145
141
|
}
|
|
@@ -150,7 +146,7 @@ const badges = doc?.badges || [];
|
|
|
150
146
|
|
|
151
147
|
<!-- Right Sidebar TOC -->
|
|
152
148
|
<aside
|
|
153
|
-
class="fixed right-0 top-16 bottom-0 w-96 overflow-y-auto border-l border-gray-100 bg-white p-6 flex-shrink-0 hidden lg:block z-10"
|
|
149
|
+
class="fixed right-0 top-16 bottom-0 w-80 2xl:w-96 overflow-y-auto border-l border-gray-100 bg-white p-6 flex-shrink-0 hidden lg:block z-10"
|
|
154
150
|
>
|
|
155
151
|
<div>
|
|
156
152
|
<div>
|
|
@@ -227,7 +223,7 @@ const badges = doc?.badges || [];
|
|
|
227
223
|
let observerPaused = false;
|
|
228
224
|
|
|
229
225
|
// Function to highlight a TOC item
|
|
230
|
-
function highlightTocItem(id) {
|
|
226
|
+
function highlightTocItem(id: string) {
|
|
231
227
|
// Remove active class from all links
|
|
232
228
|
document.querySelectorAll('.active-toc-item').forEach((link) => {
|
|
233
229
|
link.classList.remove('active-toc-item', 'text-purple-600', 'font-light');
|
|
@@ -29,6 +29,16 @@ type SideBarConfigurationItem = {
|
|
|
29
29
|
collapsed?: boolean;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
type AdjacentPage = {
|
|
33
|
+
label: string;
|
|
34
|
+
slug: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type AdjacentPages = {
|
|
38
|
+
prev: AdjacentPage | null;
|
|
39
|
+
next: AdjacentPage | null;
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const DOCS_DIR = 'docs';
|
|
33
43
|
|
|
34
44
|
/**
|
|
@@ -112,6 +122,72 @@ const processSidebarItems = async (items: SideBarConfigurationItem[]): Promise<S
|
|
|
112
122
|
return processedItems;
|
|
113
123
|
};
|
|
114
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Flatten all navigation items into a single array of pages with slugs
|
|
127
|
+
* This is used to find previous and next pages for navigation
|
|
128
|
+
*/
|
|
129
|
+
const flattenNavigationItems = (items: SidebarItem[]): AdjacentPage[] => {
|
|
130
|
+
const flatPages: AdjacentPage[] = [];
|
|
131
|
+
|
|
132
|
+
const processItem = (item: SidebarItem) => {
|
|
133
|
+
// Add the current item if it has a slug
|
|
134
|
+
if (item.slug) {
|
|
135
|
+
flatPages.push({
|
|
136
|
+
label: item.label,
|
|
137
|
+
slug: item.slug,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Process nested items if they exist
|
|
142
|
+
if (item.items && item.items.length > 0) {
|
|
143
|
+
item.items.forEach(processItem);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
items.forEach(processItem);
|
|
148
|
+
return flatPages;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Get the previous and next pages for a given slug
|
|
153
|
+
* Returns null for prev if it's the first page, and null for next if it's the last page
|
|
154
|
+
*/
|
|
155
|
+
export const getAdjacentPages = async (slug: string): Promise<AdjacentPages> => {
|
|
156
|
+
const navigationItems = await getNavigationItems();
|
|
157
|
+
const flatPages = flattenNavigationItems(navigationItems);
|
|
158
|
+
|
|
159
|
+
// Normalize the slug by removing 'docs/' prefix if it exists
|
|
160
|
+
// and ensure consistent formatting with or without leading slash
|
|
161
|
+
let normalizedSlug = slug;
|
|
162
|
+
if (normalizedSlug.startsWith('docs/')) {
|
|
163
|
+
normalizedSlug = normalizedSlug.substring(5); // Remove 'docs/' prefix
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Find the current page by comparing normalized slugs
|
|
167
|
+
const currentIndex = flatPages.findIndex((page) => {
|
|
168
|
+
// Normalize page slug for comparison
|
|
169
|
+
let pageSlug = page.slug;
|
|
170
|
+
if (pageSlug.startsWith('/')) {
|
|
171
|
+
pageSlug = pageSlug.substring(1);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return pageSlug === normalizedSlug;
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// If page not found, return null for both prev and next
|
|
178
|
+
if (currentIndex === -1) {
|
|
179
|
+
return { prev: null, next: null };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Get previous page if it exists
|
|
183
|
+
const prev = currentIndex > 0 ? flatPages[currentIndex - 1] : null;
|
|
184
|
+
|
|
185
|
+
// Get next page if it exists
|
|
186
|
+
const next = currentIndex < flatPages.length - 1 ? flatPages[currentIndex + 1] : null;
|
|
187
|
+
|
|
188
|
+
return { prev, next };
|
|
189
|
+
};
|
|
190
|
+
|
|
115
191
|
export const getNavigationItems = async (): Promise<SidebarItem[]> => {
|
|
116
192
|
const configuredSidebar = config.customDocs.sidebar;
|
|
117
193
|
return processSidebarItems(configuredSidebar as SideBarConfigurationItem[]);
|
|
@@ -268,126 +268,13 @@ const pagefindAttributes =
|
|
|
268
268
|
if (document.getElementsByClassName('mermaid').length > 0) {
|
|
269
269
|
renderDiagrams(graphs);
|
|
270
270
|
}
|
|
271
|
-
|
|
272
|
-
// Set up TOC highlighting and scrolling
|
|
273
|
-
setupTOCHighlighting();
|
|
274
271
|
});
|
|
275
272
|
|
|
276
|
-
/**
|
|
277
|
-
* Setup TOC highlighting and scrolling
|
|
278
|
-
*/
|
|
279
|
-
function setupTOCHighlighting() {
|
|
280
|
-
// Check if there's a sidebar with navigation
|
|
281
|
-
const sidebarNav = document.querySelector('aside nav');
|
|
282
|
-
if (!sidebarNav) return;
|
|
283
|
-
|
|
284
|
-
const observerOptions = {
|
|
285
|
-
rootMargin: '0px 0px -40% 0px',
|
|
286
|
-
threshold: 0.1,
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
// Flag to temporarily disable observer after click
|
|
290
|
-
let observerPaused = false;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Highlights a TOC item and scrolls it into view
|
|
294
|
-
* @param {string} id - The ID of the heading to highlight in the TOC
|
|
295
|
-
*/
|
|
296
|
-
function highlightTocItem(id) {
|
|
297
|
-
// Remove active class from all links
|
|
298
|
-
document.querySelectorAll('.active-toc-item').forEach((link) => {
|
|
299
|
-
link.classList.remove('active-toc-item', 'text-primary-600', 'font-medium');
|
|
300
|
-
link.classList.add('text-gray-400');
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
// Add active class to current link
|
|
304
|
-
const tocLink = document.querySelector(`aside nav a[href="#${id}"]`);
|
|
305
|
-
if (tocLink) {
|
|
306
|
-
tocLink.classList.add('active-toc-item', 'text-primary-600', 'font-medium');
|
|
307
|
-
tocLink.classList.remove('text-gray-400');
|
|
308
|
-
|
|
309
|
-
// Scroll the highlighted item into view with a small delay to ensure DOM updates first
|
|
310
|
-
setTimeout(() => {
|
|
311
|
-
tocLink.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });
|
|
312
|
-
}, 10);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// Set up the intersection observer for scrolling
|
|
317
|
-
const observer = new IntersectionObserver((entries) => {
|
|
318
|
-
// If observer is paused, don't process entries
|
|
319
|
-
if (observerPaused) return;
|
|
320
|
-
|
|
321
|
-
entries.forEach((entry) => {
|
|
322
|
-
try {
|
|
323
|
-
const id = entry.target.getAttribute('id');
|
|
324
|
-
if (entry.isIntersecting && id) {
|
|
325
|
-
highlightTocItem(id);
|
|
326
|
-
}
|
|
327
|
-
} catch (entryError) {
|
|
328
|
-
console.error('Error processing intersection entry:', entryError);
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
}, observerOptions);
|
|
332
|
-
|
|
333
|
-
// Find all headings in the content area
|
|
334
|
-
const prose = document.querySelector('.prose');
|
|
335
|
-
if (!prose) return;
|
|
336
|
-
|
|
337
|
-
// First try to find headings with IDs
|
|
338
|
-
const headings = prose.querySelectorAll('h1[id], h2[id], h3[id]');
|
|
339
|
-
|
|
340
|
-
if (headings.length > 0) {
|
|
341
|
-
headings.forEach((heading) => {
|
|
342
|
-
observer.observe(heading);
|
|
343
|
-
});
|
|
344
|
-
} else {
|
|
345
|
-
// Fallback: If no headings with IDs found, attach IDs to them
|
|
346
|
-
const allHeadings = prose.querySelectorAll('h1, h2, h3');
|
|
347
|
-
|
|
348
|
-
allHeadings.forEach((heading) => {
|
|
349
|
-
// Only add ID if it doesn't exist
|
|
350
|
-
if (!heading.id) {
|
|
351
|
-
const text = heading.textContent || '';
|
|
352
|
-
const slug = text
|
|
353
|
-
.toLowerCase()
|
|
354
|
-
.replace(/[^\w\s-]/g, '')
|
|
355
|
-
.replace(/\s+/g, '-');
|
|
356
|
-
heading.id = slug;
|
|
357
|
-
}
|
|
358
|
-
observer.observe(heading);
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// Add click event listeners to all TOC links
|
|
363
|
-
const tocLinks = document.querySelectorAll('aside nav a[href^="#"]');
|
|
364
|
-
tocLinks.forEach((link) => {
|
|
365
|
-
link.addEventListener('click', (e) => {
|
|
366
|
-
// Get the ID from the href attribute
|
|
367
|
-
const hrefAttr = link.getAttribute('href');
|
|
368
|
-
if (!hrefAttr) return;
|
|
369
|
-
|
|
370
|
-
const id = hrefAttr.substring(1);
|
|
371
|
-
|
|
372
|
-
// Highlight the clicked item
|
|
373
|
-
highlightTocItem(id);
|
|
374
|
-
|
|
375
|
-
// Temporarily pause the observer to prevent immediate highlighting changes
|
|
376
|
-
observerPaused = true;
|
|
377
|
-
|
|
378
|
-
// Resume the observer after a delay
|
|
379
|
-
setTimeout(() => {
|
|
380
|
-
observerPaused = false;
|
|
381
|
-
}, 500);
|
|
382
|
-
});
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
|
|
386
273
|
/**
|
|
387
274
|
* Renders mermaid diagrams in the page
|
|
388
275
|
* @param {HTMLCollectionOf<HTMLElement>} graphs - The collection of mermaid graph elements
|
|
389
276
|
*/
|
|
390
|
-
async function renderDiagrams(graphs) {
|
|
277
|
+
async function renderDiagrams(graphs: any) {
|
|
391
278
|
const { default: mermaid } = await import('mermaid');
|
|
392
279
|
|
|
393
280
|
if (window.eventcatalog.mermaid) {
|
|
@@ -395,7 +282,7 @@ const pagefindAttributes =
|
|
|
395
282
|
const { iconPacks = [] } = window.eventcatalog.mermaid ?? {};
|
|
396
283
|
|
|
397
284
|
if (iconPacks.length > 0) {
|
|
398
|
-
const iconPacksToRegister = iconPacks.map((name) => {
|
|
285
|
+
const iconPacksToRegister = iconPacks.map((name: any) => {
|
|
399
286
|
return {
|
|
400
287
|
name,
|
|
401
288
|
icons,
|