@eventcatalog/core 2.45.2 → 2.46.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.
- 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-LAXPNLIC.js → chunk-DGPDGCPS.js} +1 -1
- package/dist/{chunk-GHBK2QBQ.js → chunk-GXL54GNJ.js} +1 -1
- package/dist/{chunk-JGJBD36S.js → chunk-IVCYYU5X.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/astro.config.mjs +15 -2
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/index.astro +57 -0
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +33 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +58 -0
- package/eventcatalog/src/remark-plugins/mermaid.ts +3 -1
- package/eventcatalog/src/remark-plugins/plantuml.ts +40 -0
- package/package.json +4 -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-IVCYYU5X.js";
|
|
4
|
+
import "../chunk-DGPDGCPS.js";
|
|
5
|
+
import "../chunk-GXL54GNJ.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,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-DCLTVJDP.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-IVCYYU5X.js";
|
|
10
|
+
import "./chunk-DGPDGCPS.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import "./chunk-EXAALOQA.js";
|
|
16
16
|
import {
|
|
17
17
|
VERSION
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-GXL54GNJ.js";
|
|
19
19
|
import {
|
|
20
20
|
isAuthEnabled,
|
|
21
21
|
isBackstagePluginEnabled,
|
|
@@ -4,12 +4,14 @@ import mdx from '@astrojs/mdx';
|
|
|
4
4
|
import react from '@astrojs/react';
|
|
5
5
|
import pagefind from "astro-pagefind";
|
|
6
6
|
import { mermaid } from "./src/remark-plugins/mermaid"
|
|
7
|
+
import { plantuml } from "./src/remark-plugins/plantuml"
|
|
7
8
|
import { join } from 'node:path';
|
|
8
9
|
import remarkDirective from 'remark-directive';
|
|
9
10
|
import { remarkDirectives } from "./src/remark-plugins/directives"
|
|
10
11
|
import node from '@astrojs/node';
|
|
11
12
|
import remarkComment from 'remark-comment'
|
|
12
|
-
import
|
|
13
|
+
import rehypeSlug from 'rehype-slug';
|
|
14
|
+
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
|
|
13
15
|
|
|
14
16
|
/** @type {import('bin/eventcatalog.config').Config} */
|
|
15
17
|
import config from './eventcatalog.config';
|
|
@@ -59,7 +61,18 @@ export default defineConfig({
|
|
|
59
61
|
mdx({
|
|
60
62
|
// https://docs.astro.build/en/guides/integrations-guide/mdx/#optimize
|
|
61
63
|
optimize: config.mdxOptimize || false,
|
|
62
|
-
remarkPlugins: [remarkDirective, remarkDirectives, remarkComment, mermaid],
|
|
64
|
+
remarkPlugins: [remarkDirective, remarkDirectives, remarkComment, mermaid, plantuml],
|
|
65
|
+
rehypePlugins: [
|
|
66
|
+
rehypeSlug,
|
|
67
|
+
[
|
|
68
|
+
rehypeAutolinkHeadings,
|
|
69
|
+
{
|
|
70
|
+
behavior: 'append',
|
|
71
|
+
properties: { className: ['anchor-link'] },
|
|
72
|
+
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
],
|
|
63
76
|
gfm: true,
|
|
64
77
|
}),
|
|
65
78
|
config.output !== 'server' && pagefind(),
|
|
@@ -412,3 +412,60 @@ const badges = doc?.badges || [];
|
|
|
412
412
|
|
|
413
413
|
document.addEventListener('astro:page-load', setupObserver);
|
|
414
414
|
</script>
|
|
415
|
+
|
|
416
|
+
<script>
|
|
417
|
+
import('pako').then(({ deflate }: any) => {
|
|
418
|
+
document.addEventListener('astro:page-load', () => {
|
|
419
|
+
const blocks = document.getElementsByClassName('plantuml');
|
|
420
|
+
if (blocks.length > 0) {
|
|
421
|
+
renderPlantUML(blocks, deflate);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
function renderPlantUML(blocks: any, deflate: any) {
|
|
426
|
+
for (const block of blocks) {
|
|
427
|
+
const content = block.getAttribute('data-content');
|
|
428
|
+
if (!content) continue;
|
|
429
|
+
|
|
430
|
+
const encoded = encodePlantUML(content, deflate);
|
|
431
|
+
const img = document.createElement('img');
|
|
432
|
+
img.src = `https://www.plantuml.com/plantuml/svg/~1${encoded}`;
|
|
433
|
+
img.alt = 'PlantUML diagram';
|
|
434
|
+
img.loading = 'lazy';
|
|
435
|
+
block.innerHTML = '';
|
|
436
|
+
img.classList.add('mx-auto');
|
|
437
|
+
block.appendChild(img);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function encodePlantUML(text: any, deflate: any) {
|
|
442
|
+
const utf8encoded = new TextEncoder().encode(text);
|
|
443
|
+
const compressed = deflate(utf8encoded, { level: 9 });
|
|
444
|
+
return encode64(compressed);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const encode64 = (data: any) => {
|
|
448
|
+
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_';
|
|
449
|
+
let str = '';
|
|
450
|
+
let i = 0;
|
|
451
|
+
while (i < data.length) {
|
|
452
|
+
let b1 = data[i++];
|
|
453
|
+
let b2 = i < data.length ? data[i++] : 0;
|
|
454
|
+
let b3 = i < data.length ? data[i++] : 0;
|
|
455
|
+
|
|
456
|
+
let c1 = b1 >> 2;
|
|
457
|
+
let c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
|
|
458
|
+
let c3 = ((b2 & 0xf) << 2) | (b3 >> 6);
|
|
459
|
+
let c4 = b3 & 0x3f;
|
|
460
|
+
|
|
461
|
+
str += chars[c1] + chars[c2] + chars[c3] + chars[c4];
|
|
462
|
+
}
|
|
463
|
+
return str;
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
const graphs = document.getElementsByClassName('plantuml');
|
|
467
|
+
if (document.getElementsByClassName('plantuml').length > 0) {
|
|
468
|
+
renderPlantUML(graphs, deflate);
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
</script>
|
|
@@ -189,6 +189,39 @@ const canPageBeEmbedded = process.env.ENABLE_EMBED === 'true';
|
|
|
189
189
|
visibility: visible;
|
|
190
190
|
z-index: 100;
|
|
191
191
|
}
|
|
192
|
+
|
|
193
|
+
/* Hide anchor link by default */
|
|
194
|
+
.anchor-link {
|
|
195
|
+
display: inline-block;
|
|
196
|
+
width: 1em;
|
|
197
|
+
height: 1em;
|
|
198
|
+
margin-left: 0.5rem;
|
|
199
|
+
margin-top: 0.25rem;
|
|
200
|
+
background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20fill%3D%22currentColor%22%20d%3D%22m12.11%2015.39-3.88%203.88a2.52%202.52%200%200%201-3.5%200%202.47%202.47%200%200%201%200-3.5l3.88-3.88a1%201%200%200%200-1.42-1.42l-3.88%203.89a4.48%204.48%200%200%200%206.33%206.33l3.89-3.88a1%201%200%201%200-1.42-1.42Zm8.58-12.08a4.49%204.49%200%200%200-6.33%200l-3.89%203.88a1%201%200%200%200%201.42%201.42l3.88-3.88a2.52%202.52%200%200%201%203.5%200%202.47%202.47%200%200%201%200%203.5l-3.88%203.88a1%201%200%201%200%201.42%201.42l3.88-3.89a4.49%204.49%200%200%200%200-6.33ZM8.83%2015.17a1%201%200%200%200%201.1.22%201%201%200%200%200%20.32-.22l4.92-4.92a1%201%200%200%200-1.42-1.42l-4.92%204.92a1%201%200%200%200%200%201.42Z%22/%3E%3C/svg%3E');
|
|
201
|
+
background-repeat: no-repeat;
|
|
202
|
+
background-position: center;
|
|
203
|
+
background-size: 1em 1em;
|
|
204
|
+
opacity: 0;
|
|
205
|
+
transition: opacity 0.2s ease-in-out;
|
|
206
|
+
text-decoration: none;
|
|
207
|
+
vertical-align: -2px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* Show icon on heading hover */
|
|
211
|
+
h1:hover .anchor-link,
|
|
212
|
+
h2:hover .anchor-link,
|
|
213
|
+
h3:hover .anchor-link,
|
|
214
|
+
h4:hover .anchor-link,
|
|
215
|
+
h5:hover .anchor-link,
|
|
216
|
+
h6:hover .anchor-link {
|
|
217
|
+
opacity: 1;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* Show on keyboard focus */
|
|
221
|
+
.anchor-link:focus {
|
|
222
|
+
opacity: 1;
|
|
223
|
+
outline: none;
|
|
224
|
+
}
|
|
192
225
|
</style>
|
|
193
226
|
</head>
|
|
194
227
|
<body>
|
|
@@ -459,4 +459,62 @@ nodeGraphs.push({
|
|
|
459
459
|
renderDiagrams(graphs);
|
|
460
460
|
}
|
|
461
461
|
</script>
|
|
462
|
+
|
|
463
|
+
<script>
|
|
464
|
+
import('pako').then(({ deflate }: any) => {
|
|
465
|
+
document.addEventListener('astro:page-load', () => {
|
|
466
|
+
const blocks = document.getElementsByClassName('plantuml');
|
|
467
|
+
if (blocks.length > 0) {
|
|
468
|
+
renderPlantUML(blocks, deflate);
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
function renderPlantUML(blocks: any, deflate: any) {
|
|
473
|
+
for (const block of blocks) {
|
|
474
|
+
const content = block.getAttribute('data-content');
|
|
475
|
+
if (!content) continue;
|
|
476
|
+
|
|
477
|
+
const encoded = encodePlantUML(content, deflate);
|
|
478
|
+
const img = document.createElement('img');
|
|
479
|
+
img.src = `https://www.plantuml.com/plantuml/svg/~1${encoded}`;
|
|
480
|
+
img.alt = 'PlantUML diagram';
|
|
481
|
+
img.loading = 'lazy';
|
|
482
|
+
block.innerHTML = '';
|
|
483
|
+
// Add class to the img
|
|
484
|
+
img.classList.add('mx-auto');
|
|
485
|
+
block.appendChild(img);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function encodePlantUML(text: any, deflate: any) {
|
|
490
|
+
const utf8encoded = new TextEncoder().encode(text);
|
|
491
|
+
const compressed = deflate(utf8encoded, { level: 9 });
|
|
492
|
+
return encode64(compressed);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
const encode64 = (data: any) => {
|
|
496
|
+
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_';
|
|
497
|
+
let str = '';
|
|
498
|
+
let i = 0;
|
|
499
|
+
while (i < data.length) {
|
|
500
|
+
let b1 = data[i++];
|
|
501
|
+
let b2 = i < data.length ? data[i++] : 0;
|
|
502
|
+
let b3 = i < data.length ? data[i++] : 0;
|
|
503
|
+
|
|
504
|
+
let c1 = b1 >> 2;
|
|
505
|
+
let c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
|
|
506
|
+
let c3 = ((b2 & 0xf) << 2) | (b3 >> 6);
|
|
507
|
+
let c4 = b3 & 0x3f;
|
|
508
|
+
|
|
509
|
+
str += chars[c1] + chars[c2] + chars[c3] + chars[c4];
|
|
510
|
+
}
|
|
511
|
+
return str;
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
const graphs = document.getElementsByClassName('plantuml');
|
|
515
|
+
if (document.getElementsByClassName('plantuml').length > 0) {
|
|
516
|
+
renderPlantUML(graphs, deflate);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
</script>
|
|
462
520
|
</VerticalSideBarLayout>
|
|
@@ -18,9 +18,11 @@ export const mermaid: RemarkPlugin<[]> = () => (tree) => {
|
|
|
18
18
|
// @ts-ignore test
|
|
19
19
|
node.type = 'html';
|
|
20
20
|
node.value = `
|
|
21
|
-
|
|
21
|
+
<div class="mermaid-block pb-4">
|
|
22
|
+
<div class="mermaid border border-gray-200 rounded-lg p-1" data-content="${escapeHtml(node.value)}">
|
|
22
23
|
<p>Loading graph...</p>
|
|
23
24
|
</div>
|
|
25
|
+
</div>
|
|
24
26
|
`;
|
|
25
27
|
});
|
|
26
28
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { RemarkPlugin } from '@astrojs/markdown-remark';
|
|
2
|
+
import { visit } from 'unist-util-visit';
|
|
3
|
+
|
|
4
|
+
const escapeMap: Record<string, string> = {
|
|
5
|
+
'&': '&',
|
|
6
|
+
'<': '<',
|
|
7
|
+
'>': '>',
|
|
8
|
+
'"': '"',
|
|
9
|
+
"'": ''',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const escapeHtml = (str: string) => str.replace(/[&<>"']/g, (c) => escapeMap[c]);
|
|
13
|
+
|
|
14
|
+
function extractTitle(meta: string | undefined): string | null {
|
|
15
|
+
if (!meta) return null;
|
|
16
|
+
const match = meta.match(/title="([^"]+)"/);
|
|
17
|
+
return match ? match[1] : null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const plantuml: RemarkPlugin<[]> = () => (tree) => {
|
|
21
|
+
visit(tree, 'code', (node) => {
|
|
22
|
+
if (node.lang !== 'plantuml') return;
|
|
23
|
+
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const title = extractTitle(node.meta);
|
|
26
|
+
const escapedContent = escapeHtml(node.value);
|
|
27
|
+
const escapedTitle = title ? escapeHtml(title) : null;
|
|
28
|
+
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
node.type = 'html';
|
|
31
|
+
node.value = `
|
|
32
|
+
<div class="plantuml-block pb-4">
|
|
33
|
+
${escapedTitle ? `<h2 class="plantuml-title">${escapedTitle}</h2>` : ''}
|
|
34
|
+
<div class="plantuml border border-gray-200 rounded-lg p-1" data-content="${escapedContent}">
|
|
35
|
+
<p>Rendering PlantUML diagram...</p>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
`;
|
|
39
|
+
});
|
|
40
|
+
};
|
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.46.0",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -81,10 +81,12 @@
|
|
|
81
81
|
"lucide-react": "^0.453.0",
|
|
82
82
|
"marked": "^15.0.6",
|
|
83
83
|
"mermaid": "^11.4.1",
|
|
84
|
+
"pako": "^2.1.0",
|
|
84
85
|
"react": "^18.3.1",
|
|
85
86
|
"react-dom": "^18.3.1",
|
|
86
87
|
"react-markdown": "^10.1.0",
|
|
87
88
|
"react-syntax-highlighter": "^15.6.1",
|
|
89
|
+
"rehype-autolink-headings": "^7.1.0",
|
|
88
90
|
"rehype-slug": "^6.0.0",
|
|
89
91
|
"remark-comment": "^1.0.0",
|
|
90
92
|
"remark-directive": "^3.0.0",
|
|
@@ -109,6 +111,7 @@
|
|
|
109
111
|
"@types/lodash.debounce": "^4.0.9",
|
|
110
112
|
"@types/lodash.merge": "4.6.9",
|
|
111
113
|
"@types/node": "^20.14.2",
|
|
114
|
+
"@types/pako": "^2.0.3",
|
|
112
115
|
"@types/react": "^18.3.3",
|
|
113
116
|
"@types/react-dom": "^18.3.0",
|
|
114
117
|
"@types/react-syntax-highlighter": "^15.5.13",
|