@eventcatalog/core 2.33.3 → 2.33.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-557OECV4.js → chunk-2OM7CIOD.js} +1 -1
- package/dist/{chunk-5QUF2S7L.js → chunk-AUIYWFSM.js} +1 -1
- package/dist/{chunk-5TXSONUY.js → chunk-MRFHOQZ5.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/components/CustomDocsNav/components/NestedItem.tsx +32 -2
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/types.ts +2 -0
- package/eventcatalog/src/enterprise/custom-documentation/utils/custom-docs.ts +46 -28
- 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-MRFHOQZ5.js";
|
|
4
|
+
import "../chunk-AUIYWFSM.js";
|
|
5
|
+
import "../chunk-2OM7CIOD.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-MRFHOQZ5.js";
|
|
10
|
+
import "./chunk-AUIYWFSM.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-2OM7CIOD.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackstagePluginEnabled,
|
|
20
20
|
isEventCatalogScaleEnabled,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { buildUrl } from '@utils/url-builder';
|
|
3
3
|
import type { SidebarItem } from '../types';
|
|
4
|
+
import { ExternalLinkIcon } from 'lucide-react';
|
|
4
5
|
|
|
5
6
|
interface NestedItemProps {
|
|
6
7
|
item: SidebarItem;
|
|
@@ -89,16 +90,45 @@ const NestedItem: React.FC<NestedItemProps> = ({
|
|
|
89
90
|
);
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
let itemPath = item.slug ? buildUrl(`/docs/custom/${item.slug}`) : '#';
|
|
93
94
|
const isActive = currentPath === itemPath || currentPath.endsWith(`/${item.slug}`);
|
|
94
95
|
|
|
96
|
+
// Convert string style to React CSSProperties if needed
|
|
97
|
+
const attrs = item.attrs
|
|
98
|
+
? {
|
|
99
|
+
...item.attrs,
|
|
100
|
+
style:
|
|
101
|
+
typeof item.attrs.style === 'string'
|
|
102
|
+
? item.attrs.style
|
|
103
|
+
.split(';')
|
|
104
|
+
.filter((style) => style.trim())
|
|
105
|
+
.reduce((acc, style) => {
|
|
106
|
+
const [key, value] = style.split(':').map((s) => s.trim());
|
|
107
|
+
const camelKey = key.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
|
108
|
+
return { ...acc, [camelKey]: value };
|
|
109
|
+
}, {})
|
|
110
|
+
: item.attrs.style,
|
|
111
|
+
}
|
|
112
|
+
: null;
|
|
113
|
+
|
|
114
|
+
const isExternalLink = item.slug?.startsWith('http');
|
|
115
|
+
|
|
116
|
+
if (isExternalLink && item.slug) {
|
|
117
|
+
itemPath = item.slug;
|
|
118
|
+
}
|
|
119
|
+
|
|
95
120
|
return (
|
|
96
121
|
<a
|
|
97
122
|
href={itemPath}
|
|
123
|
+
{...(attrs || {})}
|
|
98
124
|
className={`flex items-center px-2 py-1.5 text-xs ${isActive ? 'bg-purple-100 text-purple-900 font-medium' : 'text-gray-600 hover:bg-purple-100'} rounded-md`}
|
|
99
125
|
data-active={isActive}
|
|
126
|
+
target={isExternalLink ? '_blank' : undefined}
|
|
100
127
|
>
|
|
101
|
-
<span className="truncate">
|
|
128
|
+
<span className="truncate flex items-center gap-1.5">
|
|
129
|
+
{item.label}
|
|
130
|
+
{isExternalLink && <ExternalLinkIcon className="w-3 -mt-0.5 h-3" />}
|
|
131
|
+
</span>
|
|
102
132
|
{item.badge && item?.badge?.text && (
|
|
103
133
|
<span
|
|
104
134
|
className={`text-${item.badge.color || 'purple'}-600 ml-2 text-[10px] font-medium bg-${item.badge.color || 'purple'}-50 px-2 py-0.5 rounded uppercase`}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// import { getCollection } from "astro:content";
|
|
2
1
|
import config from '@config';
|
|
3
2
|
import fs from 'node:fs';
|
|
4
3
|
import path from 'node:path';
|
|
@@ -16,6 +15,8 @@ type SidebarItem = {
|
|
|
16
15
|
items?: SidebarItem[];
|
|
17
16
|
badge?: Badge;
|
|
18
17
|
collapsed?: boolean;
|
|
18
|
+
link?: string;
|
|
19
|
+
attrs?: Record<string, string>;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
type SideBarConfigurationItem = {
|
|
@@ -28,6 +29,8 @@ type SideBarConfigurationItem = {
|
|
|
28
29
|
};
|
|
29
30
|
badge?: Badge;
|
|
30
31
|
collapsed?: boolean;
|
|
32
|
+
link?: string;
|
|
33
|
+
attrs?: Record<string, string>;
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
type AdjacentPage = {
|
|
@@ -52,39 +55,45 @@ const processAutoGeneratedDirectory = async (
|
|
|
52
55
|
collapsed?: boolean
|
|
53
56
|
): Promise<SidebarItem> => {
|
|
54
57
|
// @ts-ignore
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
// Convert files to frontmatter
|
|
58
|
-
const docsWithFrontmatter = files.map((file) => {
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
const content = fs.readFileSync(path.join(process.env.PROJECT_DIR || '', DOCS_DIR, directory, file), 'utf8');
|
|
61
|
-
const { data } = matter(content);
|
|
62
|
-
return { ...data, file };
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// If user defined slug use it, otherwise use the file
|
|
66
|
-
const astroIdsForFiles = docsWithFrontmatter.map(
|
|
67
|
-
(doc: any) => doc.slug || path.join(DOCS_DIR, directory, doc.file).replace('.mdx', '')
|
|
68
|
-
);
|
|
58
|
+
const items = fs.readdirSync(path.join(process.env.PROJECT_DIR || '', DOCS_DIR, directory));
|
|
69
59
|
|
|
70
|
-
const
|
|
71
|
-
astroIdsForFiles.map(async (astroId) => {
|
|
72
|
-
const entry = await getEntry('customPages', astroId);
|
|
73
|
-
return entry;
|
|
74
|
-
})
|
|
75
|
-
);
|
|
60
|
+
const allItems: SidebarItem[] = [];
|
|
76
61
|
|
|
77
|
-
|
|
78
|
-
|
|
62
|
+
for (const item of items) {
|
|
63
|
+
const fullPath = path.join(process.env.PROJECT_DIR || '', DOCS_DIR, directory, item);
|
|
64
|
+
const isDirectory = fs.statSync(fullPath).isDirectory();
|
|
65
|
+
|
|
66
|
+
if (isDirectory) {
|
|
67
|
+
// Recursively process subdirectory
|
|
68
|
+
const subdirResult = await processAutoGeneratedDirectory(
|
|
69
|
+
path.join(directory, item),
|
|
70
|
+
item, // Use directory name as label
|
|
71
|
+
undefined, // No badge for subdirectories
|
|
72
|
+
collapsed // Inherit collapsed state
|
|
73
|
+
);
|
|
74
|
+
allItems.push(subdirResult);
|
|
75
|
+
} else {
|
|
76
|
+
// Process file
|
|
77
|
+
const content = fs.readFileSync(fullPath, 'utf8');
|
|
78
|
+
const { data } = matter(content);
|
|
79
|
+
|
|
80
|
+
const astroId = data.slug || path.join(DOCS_DIR, directory, item).replace('.mdx', '');
|
|
81
|
+
const entry = await getEntry('customPages', astroId.toLowerCase());
|
|
82
|
+
|
|
83
|
+
if (entry) {
|
|
84
|
+
allItems.push({
|
|
85
|
+
label: entry.data.title,
|
|
86
|
+
slug: entry.data.slug || entry.id.replace(DOCS_DIR, ''),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
79
91
|
|
|
80
92
|
return {
|
|
81
93
|
label,
|
|
82
94
|
badge,
|
|
83
95
|
collapsed,
|
|
84
|
-
items:
|
|
85
|
-
label: entry?.data?.title,
|
|
86
|
-
slug: entry?.data?.slug || entry?.id.replace(DOCS_DIR, ''),
|
|
87
|
-
})),
|
|
96
|
+
items: allItems,
|
|
88
97
|
};
|
|
89
98
|
};
|
|
90
99
|
|
|
@@ -118,7 +127,16 @@ const processSidebarItems = async (items: SideBarConfigurationItem[]): Promise<S
|
|
|
118
127
|
}
|
|
119
128
|
// Otherwise, it's a regular item
|
|
120
129
|
else {
|
|
121
|
-
|
|
130
|
+
// if its a link, add it to the processedItems
|
|
131
|
+
if (item.link) {
|
|
132
|
+
processedItems.push({
|
|
133
|
+
label: item.label,
|
|
134
|
+
slug: item.link,
|
|
135
|
+
attrs: item.attrs,
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
processedItems.push(item as SidebarItem);
|
|
139
|
+
}
|
|
122
140
|
}
|
|
123
141
|
}
|
|
124
142
|
|