@eventcatalog/core 3.0.0-beta.9 → 3.1.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/README.md +41 -98
- package/dist/__mocks__/astro-content.cjs +32 -0
- package/dist/__mocks__/astro-content.d.cts +13 -0
- package/dist/__mocks__/astro-content.d.ts +13 -0
- package/dist/__mocks__/astro-content.js +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 +2 -19
- package/dist/catalog-to-astro-content-directory.d.cts +1 -2
- package/dist/catalog-to-astro-content-directory.d.ts +1 -2
- package/dist/catalog-to-astro-content-directory.js +3 -5
- package/dist/{chunk-RAJ7TGWN.js → chunk-2WGZFERB.js} +1 -1
- package/dist/{chunk-R2BJ7MJG.js → chunk-6Z6ARMQS.js} +1 -17
- package/dist/{chunk-TC3R47V6.js → chunk-ESUL7UE6.js} +1 -1
- package/dist/{chunk-2VPX4WIJ.js → chunk-I3CW5KQI.js} +1 -1
- package/dist/{chunk-TT4LZO2Q.js → chunk-KBO4IL2D.js} +1 -1
- package/dist/{chunk-A4MGWK5T.js → chunk-URR33SNK.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +20 -64
- package/dist/eventcatalog.config.d.cts +11 -0
- package/dist/eventcatalog.config.d.ts +11 -0
- package/dist/eventcatalog.js +26 -52
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/astro.config.mjs +4 -1
- package/eventcatalog/integrations/eventcatalog-features.ts +69 -0
- package/eventcatalog/public/icons/asyncapi-black.svg +2 -0
- package/eventcatalog/public/icons/graphql-black.svg +1 -0
- package/eventcatalog/public/icons/openapi-black.svg +1 -0
- package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +1010 -0
- package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +24 -0
- package/eventcatalog/src/components/Checkbox.astro +7 -4
- package/eventcatalog/src/components/CopyAsMarkdown.tsx +15 -15
- package/eventcatalog/src/components/EnvironmentDropdown.tsx +15 -7
- package/eventcatalog/src/components/FavoriteButton.tsx +1 -1
- package/eventcatalog/src/components/Grids/DomainGrid.tsx +322 -173
- package/eventcatalog/src/components/Grids/MessageGrid.tsx +317 -178
- package/eventcatalog/src/components/Grids/specification-utils.ts +106 -0
- package/eventcatalog/src/components/Header.astro +40 -15
- package/eventcatalog/src/components/Lists/OwnersList.tsx +17 -10
- package/eventcatalog/src/components/Lists/PillListFlat.styles.css +12 -0
- package/eventcatalog/src/components/Lists/PillListFlat.tsx +15 -15
- package/eventcatalog/src/components/Lists/VersionList.astro +15 -5
- package/eventcatalog/src/components/MDX/Accordion/Accordion.tsx +3 -3
- package/eventcatalog/src/components/MDX/Admonition.tsx +49 -9
- package/eventcatalog/src/components/MDX/Attachments.astro +15 -11
- package/eventcatalog/src/components/MDX/ChannelInformation/ChannelInformation.tsx +29 -15
- package/eventcatalog/src/components/MDX/EntityPropertiesTable/EntityPropertiesTable.astro +20 -13
- package/eventcatalog/src/components/MDX/Link/Link.astro +1 -1
- package/eventcatalog/src/components/MDX/MessageTable/MessageTable.client.tsx +50 -29
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +28 -15
- package/eventcatalog/src/components/MDX/NodeGraph/StepWalkthrough.tsx +4 -4
- package/eventcatalog/src/components/MDX/NodeGraph/StudioModal.tsx +4 -4
- package/eventcatalog/src/components/MDX/NodeGraph/VisualiserSearch.tsx +2 -2
- package/eventcatalog/src/components/MDX/ResourceGroupTable/ResourceGroupTable.client.tsx +54 -33
- package/eventcatalog/src/components/MDX/ResourceLink/ResourceLink.astro +1 -1
- package/eventcatalog/src/components/MDX/Steps/Step.astro +2 -2
- package/eventcatalog/src/components/MDX/Steps/Steps.astro +3 -3
- package/eventcatalog/src/components/MDX/Tabs/Tabs.astro +13 -9
- package/eventcatalog/src/components/MDX/Tiles/Tile.astro +25 -13
- package/eventcatalog/src/components/MDX/Tiles/Tiles.astro +1 -1
- package/eventcatalog/src/components/SchemaExplorer/ApiAccessSection.tsx +95 -90
- package/eventcatalog/src/components/SchemaExplorer/ApiContentViewer.tsx +144 -0
- package/eventcatalog/src/components/SchemaExplorer/AvroSchemaViewer.tsx +29 -25
- package/eventcatalog/src/components/SchemaExplorer/DiffViewer.tsx +3 -3
- package/eventcatalog/src/components/SchemaExplorer/JSONSchemaViewer.tsx +61 -42
- package/eventcatalog/src/components/SchemaExplorer/OwnersSection.tsx +13 -9
- package/eventcatalog/src/components/SchemaExplorer/Pagination.tsx +36 -8
- package/eventcatalog/src/components/SchemaExplorer/ProducersConsumersSection.tsx +17 -13
- package/eventcatalog/src/components/SchemaExplorer/SchemaContentViewer.tsx +37 -10
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsHeader.tsx +152 -109
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +6 -15
- package/eventcatalog/src/components/SchemaExplorer/SchemaExplorer.tsx +257 -61
- package/eventcatalog/src/components/SchemaExplorer/SchemaFilters.tsx +64 -126
- package/eventcatalog/src/components/SchemaExplorer/SchemaListItem.tsx +53 -43
- package/eventcatalog/src/components/SchemaExplorer/SchemaViewerModal.tsx +8 -8
- package/eventcatalog/src/components/Search/Search.astro +5 -5
- package/eventcatalog/src/components/Search/SearchDataLoader.astro +25 -0
- package/eventcatalog/src/components/Search/SearchModal.tsx +65 -36
- package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +37 -24
- package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +117 -56
- package/eventcatalog/src/components/SideNav/SideNav.astro +0 -15
- package/eventcatalog/src/components/Tables/Table.tsx +97 -77
- package/eventcatalog/src/components/Tables/columns/ContainersTableColumns.tsx +114 -74
- package/eventcatalog/src/components/Tables/columns/DomainTableColumns.tsx +77 -55
- package/eventcatalog/src/components/Tables/columns/FlowTableColumns.tsx +36 -36
- package/eventcatalog/src/components/Tables/columns/MessageTableColumns.tsx +116 -77
- package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +111 -94
- package/eventcatalog/src/components/Tables/columns/SharedColumns.tsx +31 -26
- package/eventcatalog/src/components/Tables/columns/TeamsTableColumns.tsx +123 -215
- package/eventcatalog/src/components/Tables/columns/UserTableColumns.tsx +156 -243
- package/eventcatalog/src/components/ThemeToggle.tsx +18 -0
- package/eventcatalog/src/content.config.ts +1 -13
- package/eventcatalog/src/enterprise/ai/chat-api.ts +360 -0
- package/eventcatalog/src/enterprise/auth/[...auth].ts +3 -0
- package/eventcatalog/src/enterprise/auth/login.astro +420 -0
- package/eventcatalog/src/enterprise/collections/index.ts +0 -1
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/components/NestedItem.tsx +15 -7
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/components/NoResultsFound.tsx +2 -2
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/index.tsx +19 -15
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/index.astro +50 -17
- package/eventcatalog/src/layouts/DirectoryLayout.astro +11 -6
- package/eventcatalog/src/layouts/DiscoverLayout.astro +13 -8
- package/eventcatalog/src/layouts/Footer.astro +14 -11
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +187 -123
- package/eventcatalog/src/pages/_index.astro +213 -573
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +8 -2
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +9 -5
- package/eventcatalog/src/pages/directory/[type]/index.astro +6 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +19 -3
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +7 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +5 -5
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +81 -64
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +23 -24
- package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +214 -125
- package/eventcatalog/src/pages/docs/custom/index.astro +2 -2
- package/eventcatalog/src/pages/docs/teams/[id]/index.astro +98 -70
- package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +36 -0
- package/eventcatalog/src/pages/docs/users/[id]/index.astro +60 -45
- package/eventcatalog/src/pages/docs/users/[id].mdx.ts +36 -0
- package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +178 -0
- package/eventcatalog/src/pages/schemas/explorer/index.astro +7 -157
- package/eventcatalog/src/pages/studio.astro +155 -75
- package/eventcatalog/src/remark-plugins/directives.ts +36 -15
- package/eventcatalog/src/remark-plugins/mermaid.ts +2 -2
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/container.ts +10 -1
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/domain.ts +17 -7
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/message.ts +10 -1
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/service.ts +11 -4
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/shared.ts +14 -0
- package/eventcatalog/src/stores/{sidebar-store.ts → sidebar-store/index.ts} +1 -1
- package/eventcatalog/src/stores/theme-store.ts +93 -0
- package/eventcatalog/src/styles/theme.css +255 -0
- package/eventcatalog/src/styles/themes/forest.css +230 -0
- package/eventcatalog/src/styles/themes/ocean.css +235 -0
- package/eventcatalog/src/styles/themes/sapphire.css +230 -0
- package/eventcatalog/src/styles/themes/sunset.css +230 -0
- package/eventcatalog/src/utils/collections/channels.ts +0 -2
- package/eventcatalog/src/utils/collections/commands.ts +0 -2
- package/eventcatalog/src/utils/collections/containers.ts +0 -2
- package/eventcatalog/src/utils/collections/domains.ts +0 -2
- package/eventcatalog/src/utils/collections/entities.ts +0 -2
- package/eventcatalog/src/utils/collections/events.ts +0 -2
- package/eventcatalog/src/utils/collections/flows.ts +0 -2
- package/eventcatalog/src/utils/collections/queries.ts +0 -2
- package/eventcatalog/src/utils/collections/schemas.ts +45 -7
- package/eventcatalog/src/utils/collections/services.ts +0 -2
- package/eventcatalog/src/utils/feature.ts +13 -5
- package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +1 -1
- package/eventcatalog/src/utils/resource-files.ts +86 -0
- package/eventcatalog/tailwind.config.mjs +6 -3
- package/package.json +12 -15
- package/default-files-for-collections/changelogs.md +0 -5
- package/default-files-for-collections/channels.md +0 -8
- package/default-files-for-collections/commands.md +0 -8
- package/default-files-for-collections/domains.md +0 -8
- package/default-files-for-collections/events.md +0 -8
- package/default-files-for-collections/flows.md +0 -11
- package/default-files-for-collections/queries.md +0 -8
- package/default-files-for-collections/services.md +0 -8
- package/default-files-for-collections/ubiquitousLanguages.md +0 -7
- package/eventcatalog/src/enterprise/collections/chat-prompts.ts +0 -32
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/Chat.tsx +0 -60
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatMessage.tsx +0 -414
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatSidebar.tsx +0 -169
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/InputModal.tsx +0 -244
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/MentionInput.tsx +0 -211
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/WelcomePromptArea.tsx +0 -176
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/default-prompts.ts +0 -93
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/hooks/ChatProvider.tsx +0 -143
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/windows/ChatWindow.server.tsx +0 -387
- package/eventcatalog/src/enterprise/eventcatalog-chat/pages/api/chat.ts +0 -59
- package/eventcatalog/src/enterprise/eventcatalog-chat/pages/chat/index.astro +0 -104
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/ai-provider.ts +0 -140
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/anthropic.ts +0 -28
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/google.ts +0 -41
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/index.ts +0 -26
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/openai.ts +0 -61
- package/eventcatalog/src/enterprise/eventcatalog-chat/utils/chat-prompts.ts +0 -50
- package/eventcatalog/src/pages/auth/login.astro +0 -280
- package/eventcatalog/src/pages/chat/feature.astro +0 -179
- package/eventcatalog/src/pages/chat/index.astro +0 -10
- package/eventcatalog/src/pages/docs/_default-docs.mdx +0 -25
- package/eventcatalog/src/pages/docs/index.astro +0 -33
- package/eventcatalog/src/pages/nav-index.json.ts +0 -30
- /package/eventcatalog/src/{pages → enterprise}/auth/error.astro +0 -0
- /package/eventcatalog/src/{middleware-auth.ts → enterprise/auth/middleware/middleware-auth.ts} +0 -0
- /package/eventcatalog/src/{middleware.ts → enterprise/auth/middleware/middleware.ts} +0 -0
- /package/eventcatalog/src/{pages/unauthorized/index.astro → enterprise/auth/unauthorized.astro} +0 -0
- /package/eventcatalog/src/{pages → enterprise}/plans/index.astro +0 -0
- /package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/flow.ts +0 -0
- /package/eventcatalog/src/{components/SideNav/NestedSideBar/sidebar-builder.ts → stores/sidebar-store/state.ts} +0 -0
|
@@ -1,173 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
3
|
-
import { getEvents } from '@utils/collections/events';
|
|
4
|
-
import { getCommands } from '@utils/collections/commands';
|
|
5
|
-
import { getQueries } from '@utils/collections/queries';
|
|
6
|
-
import { getServices, getSpecificationsForService } from '@utils/collections/services';
|
|
7
3
|
import SchemaExplorer from '@components/SchemaExplorer/SchemaExplorer';
|
|
8
4
|
import { isEventCatalogScaleEnabled } from '@utils/feature';
|
|
9
|
-
import {
|
|
10
|
-
import { buildUrl } from '@utils/url-builder';
|
|
11
|
-
import fs from 'fs';
|
|
12
|
-
import path from 'path';
|
|
5
|
+
import { Page } from './_index.data';
|
|
13
6
|
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const commands = await getCommands({ getAllVersions: true });
|
|
17
|
-
const queries = await getQueries({ getAllVersions: true });
|
|
7
|
+
export const prerender = Page.prerender;
|
|
8
|
+
export const getStaticPaths = Page.getStaticPaths;
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
const services = await getServices({ getAllVersions: true });
|
|
21
|
-
|
|
22
|
-
// Combine all messages
|
|
23
|
-
const allMessages = [...events, ...commands, ...queries];
|
|
24
|
-
|
|
25
|
-
// Helper function to enrich owners with full details
|
|
26
|
-
async function enrichOwners(ownersRaw: any[]) {
|
|
27
|
-
if (!ownersRaw || ownersRaw.length === 0) return [];
|
|
28
|
-
|
|
29
|
-
const owners = await Promise.all(ownersRaw.map(getOwner));
|
|
30
|
-
const filteredOwners = owners.filter((o) => o !== undefined);
|
|
31
|
-
|
|
32
|
-
return filteredOwners.map((o) => ({
|
|
33
|
-
id: o.data.id,
|
|
34
|
-
name: o.data.name,
|
|
35
|
-
type: o.collection,
|
|
36
|
-
href: buildUrl(`/docs/${o.collection}/${o.data.id}`),
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Filter messages with schemas and read schema content - only keep essential data
|
|
41
|
-
const messagesWithSchemas = await Promise.all(
|
|
42
|
-
allMessages
|
|
43
|
-
.filter((message) => message.data.schemaPath)
|
|
44
|
-
// Make sure the file exists
|
|
45
|
-
.filter((message) => fs.existsSync(path.join(path.dirname(message.filePath ?? ''), message.data.schemaPath ?? '')))
|
|
46
|
-
.map(async (message) => {
|
|
47
|
-
try {
|
|
48
|
-
// Get the schema file path
|
|
49
|
-
const schemaPath = message.data.schemaPath;
|
|
50
|
-
const fullSchemaPath = path.join(path.dirname(message.filePath ?? ''), schemaPath ?? '');
|
|
51
|
-
|
|
52
|
-
// Read the schema content
|
|
53
|
-
let schemaContent = '';
|
|
54
|
-
if (fs.existsSync(fullSchemaPath)) {
|
|
55
|
-
schemaContent = fs.readFileSync(fullSchemaPath, 'utf-8');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Get schema file extension
|
|
59
|
-
const schemaExtension = path.extname(schemaPath ?? '').slice(1);
|
|
60
|
-
|
|
61
|
-
// Enrich owners with full details
|
|
62
|
-
const enrichedOwners = await enrichOwners(message.data.owners || []);
|
|
63
|
-
|
|
64
|
-
// Only return essential data - strip out markdown, full data objects, etc.
|
|
65
|
-
return {
|
|
66
|
-
collection: message.collection,
|
|
67
|
-
data: {
|
|
68
|
-
id: message.data.id,
|
|
69
|
-
name: message.data.name,
|
|
70
|
-
version: message.data.version,
|
|
71
|
-
summary: message.data.summary,
|
|
72
|
-
schemaPath: message.data.schemaPath,
|
|
73
|
-
producers: message.data.producers || [],
|
|
74
|
-
consumers: message.data.consumers || [],
|
|
75
|
-
owners: enrichedOwners,
|
|
76
|
-
},
|
|
77
|
-
schemaContent,
|
|
78
|
-
schemaExtension,
|
|
79
|
-
};
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.error(`Error reading schema for ${message.data.id}:`, error);
|
|
82
|
-
const enrichedOwners = await enrichOwners(message.data.owners || []);
|
|
83
|
-
return {
|
|
84
|
-
collection: message.collection,
|
|
85
|
-
data: {
|
|
86
|
-
id: message.data.id,
|
|
87
|
-
name: message.data.name,
|
|
88
|
-
version: message.data.version,
|
|
89
|
-
summary: message.data.summary,
|
|
90
|
-
schemaPath: message.data.schemaPath,
|
|
91
|
-
producers: message.data.producers || [],
|
|
92
|
-
consumers: message.data.consumers || [],
|
|
93
|
-
owners: enrichedOwners,
|
|
94
|
-
},
|
|
95
|
-
schemaContent: '',
|
|
96
|
-
schemaExtension: 'json',
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
// Filter services with specifications and read spec content - only keep essential data
|
|
103
|
-
const servicesWithSpecs = await Promise.all(
|
|
104
|
-
services.map(async (service) => {
|
|
105
|
-
try {
|
|
106
|
-
const specifications = getSpecificationsForService(service);
|
|
107
|
-
|
|
108
|
-
// Only include services that have specifications
|
|
109
|
-
if (specifications.length === 0) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Process each specification file for this service
|
|
114
|
-
return await Promise.all(
|
|
115
|
-
specifications.map(async (spec) => {
|
|
116
|
-
const specPath = path.join(path.dirname(service.filePath ?? ''), spec.path);
|
|
117
|
-
|
|
118
|
-
// Only include if the spec file exists
|
|
119
|
-
if (!fs.existsSync(specPath)) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const schemaContent = fs.readFileSync(specPath, 'utf-8');
|
|
124
|
-
// Use spec type (openapi, asyncapi) as the extension for proper labeling
|
|
125
|
-
const schemaExtension = spec.type;
|
|
126
|
-
|
|
127
|
-
// Enrich owners with full details
|
|
128
|
-
const enrichedOwners = await enrichOwners(service.data.owners || []);
|
|
129
|
-
|
|
130
|
-
// Only return essential data - strip out markdown, sends/receives, entities, etc.
|
|
131
|
-
return {
|
|
132
|
-
collection: 'services',
|
|
133
|
-
data: {
|
|
134
|
-
id: `${service.data.id}`,
|
|
135
|
-
name: `${service.data.name} - ${spec.name}`,
|
|
136
|
-
version: service.data.version,
|
|
137
|
-
summary: service.data.summary,
|
|
138
|
-
schemaPath: spec.path,
|
|
139
|
-
owners: enrichedOwners,
|
|
140
|
-
},
|
|
141
|
-
schemaContent,
|
|
142
|
-
schemaExtension,
|
|
143
|
-
specType: spec.type,
|
|
144
|
-
specName: spec.name,
|
|
145
|
-
specFilenameWithoutExtension: spec.filenameWithoutExtension,
|
|
146
|
-
};
|
|
147
|
-
})
|
|
148
|
-
);
|
|
149
|
-
} catch (error) {
|
|
150
|
-
console.error(`Error reading specifications for service ${service.data.id}:`, error);
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
// Flatten and filter out null values
|
|
157
|
-
const flatServicesWithSpecs = servicesWithSpecs.flat().filter((service) => service !== null);
|
|
158
|
-
|
|
159
|
-
// Combine messages and services
|
|
160
|
-
const allSchemas = [...messagesWithSchemas, ...flatServicesWithSpecs];
|
|
10
|
+
const { schemas } = await Page.getData(Astro);
|
|
161
11
|
|
|
162
12
|
const apiAccessEnabled = isEventCatalogScaleEnabled();
|
|
163
13
|
---
|
|
164
14
|
|
|
165
15
|
<VerticalSideBarLayout title="Schema Explorer - EventCatalog" showNestedSideBar={false}>
|
|
166
|
-
<main class="flex sm:
|
|
16
|
+
<main class="flex sm:pl-8 pr-4 docs-layout h-[calc(100vh-var(--header-height,0px)-64px)] bg-[rgb(var(--ec-page-bg))]">
|
|
167
17
|
<div class="flex docs-layout w-full h-full">
|
|
168
|
-
<div class="w-full lg:mr-2
|
|
18
|
+
<div class="w-full lg:mr-2 py-6 flex flex-col h-full">
|
|
169
19
|
<div class="w-full !max-w-none h-full flex flex-col overflow-hidden">
|
|
170
|
-
<SchemaExplorer client:load schemas={
|
|
20
|
+
<SchemaExplorer client:load schemas={schemas as any} apiAccessEnabled={apiAccessEnabled} />
|
|
171
21
|
</div>
|
|
172
22
|
</div>
|
|
173
23
|
</div>
|
|
@@ -3,8 +3,8 @@ import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
|
3
3
|
import { getEvents } from '@utils/collections/events';
|
|
4
4
|
import { getCommands } from '@utils/collections/commands';
|
|
5
5
|
import { getServices } from '@utils/collections/services';
|
|
6
|
-
import { BoltIcon, ServerIcon
|
|
7
|
-
import { SquareDashedMousePointerIcon, ArrowLeftRightIcon } from 'lucide-react';
|
|
6
|
+
import { BoltIcon, ServerIcon } from '@heroicons/react/24/outline';
|
|
7
|
+
import { SquareDashedMousePointerIcon, ArrowLeftRightIcon, ExternalLink } from 'lucide-react';
|
|
8
8
|
import StudioPageModal from '@components/Studio/StudioPageModal';
|
|
9
9
|
import { getChannels } from '@utils/collections/channels';
|
|
10
10
|
|
|
@@ -20,6 +20,7 @@ const eventCount = events.length;
|
|
|
20
20
|
const serviceCount = services.length;
|
|
21
21
|
const commandCount = commands.length;
|
|
22
22
|
const channelCount = channels.length;
|
|
23
|
+
const totalResources = eventCount + serviceCount + channelCount + commandCount;
|
|
23
24
|
|
|
24
25
|
// Get a few sample resources to display
|
|
25
26
|
const sampleEvents = events.slice(0, 2);
|
|
@@ -32,6 +33,8 @@ const resourcesToShow = [
|
|
|
32
33
|
...sampleServices.map((service, index) => ({ type: 'service', data: service, index: index + 2 })),
|
|
33
34
|
...sampleChannels.map((channel, index) => ({ type: 'channel', data: channel, index: index + 4 })),
|
|
34
35
|
].slice(0, 5); // Max 5 resources
|
|
36
|
+
|
|
37
|
+
const hasResources = resourcesToShow.length > 0;
|
|
35
38
|
---
|
|
36
39
|
|
|
37
40
|
<!doctype html>
|
|
@@ -45,136 +48,213 @@ const resourcesToShow = [
|
|
|
45
48
|
</head>
|
|
46
49
|
<body>
|
|
47
50
|
<VerticalSideBarLayout title="EventCatalog Studio" showNestedSideBar={false}>
|
|
48
|
-
<div class="min-h-[calc(100vh-60px)] bg-
|
|
51
|
+
<div class="min-h-[calc(100vh-60px)] bg-[rgb(var(--ec-page-bg))]">
|
|
49
52
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16">
|
|
50
53
|
{/* Hero Section */}
|
|
51
54
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-12 items-center mb-16">
|
|
52
55
|
<div>
|
|
53
|
-
<div
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
<div
|
|
57
|
+
class="inline-flex items-center px-3 py-1.5 rounded-full bg-[rgb(var(--ec-content-hover))] text-[rgb(var(--ec-page-text))] font-medium text-xs mb-6"
|
|
58
|
+
>
|
|
59
|
+
Visual Design Tool
|
|
56
60
|
</div>
|
|
57
|
-
<h1 class="text-4xl font-bold text-
|
|
58
|
-
|
|
61
|
+
<h1 class="text-4xl font-bold text-[rgb(var(--ec-page-text))] tracking-tight mb-4">
|
|
62
|
+
Turn your resources into designs
|
|
63
|
+
</h1>
|
|
64
|
+
<p class="text-lg text-[rgb(var(--ec-page-text-muted))] mb-8">
|
|
59
65
|
Transform your documented messages, services, and domains into architecture diagrams. Drag, drop, and design with
|
|
60
66
|
what you already have.
|
|
61
67
|
</p>
|
|
62
|
-
<div class="flex flex-col sm:flex-row gap-
|
|
68
|
+
<div class="flex flex-col sm:flex-row gap-3 mb-4">
|
|
63
69
|
<button
|
|
64
70
|
id="design-button"
|
|
65
|
-
class="inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-lg text-
|
|
71
|
+
class="inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-lg text-[rgb(var(--ec-button-text))] bg-[rgb(var(--ec-button-bg))] hover:bg-[rgb(var(--ec-button-bg-hover))] transition-colors duration-150"
|
|
66
72
|
>
|
|
67
73
|
<SquareDashedMousePointerIcon className="w-4 h-4 mr-2" />
|
|
68
|
-
Open
|
|
74
|
+
Open Studio
|
|
69
75
|
</button>
|
|
76
|
+
<a
|
|
77
|
+
href="https://www.eventcatalog.dev/docs/development/components/designs"
|
|
78
|
+
target="_blank"
|
|
79
|
+
rel="noopener noreferrer"
|
|
80
|
+
class="inline-flex items-center justify-center px-6 py-3 border border-[rgb(var(--ec-page-border))] text-base font-medium rounded-lg text-[rgb(var(--ec-page-text))] bg-[rgb(var(--ec-card-bg,var(--ec-page-bg)))] hover:bg-[rgb(var(--ec-content-hover))] transition-colors duration-150"
|
|
81
|
+
>
|
|
82
|
+
Learn more
|
|
83
|
+
<ExternalLink className="w-4 h-4 ml-2" />
|
|
84
|
+
</a>
|
|
70
85
|
</div>
|
|
71
86
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
{
|
|
88
|
+
totalResources > 0 && (
|
|
89
|
+
<p class="text-sm text-[rgb(var(--ec-page-text-muted))]">
|
|
90
|
+
<span class="font-medium text-[rgb(var(--ec-page-text))]">{totalResources}</span> resources available to
|
|
91
|
+
design with
|
|
92
|
+
</p>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
75
95
|
</div>
|
|
76
96
|
|
|
77
|
-
<div class="relative">
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
resourcesToShow.map((resource) => {
|
|
97
|
+
<div class="relative hidden lg:block">
|
|
98
|
+
{/* Animation container */}
|
|
99
|
+
<div class="relative h-[350px] flex items-center justify-center">
|
|
100
|
+
{/* Resource cards that animate in */}
|
|
101
|
+
{
|
|
102
|
+
hasResources ? (
|
|
103
|
+
<div class="absolute left-0 top-1/2 -translate-y-1/2 space-y-2.5">
|
|
104
|
+
{resourcesToShow.map((resource) => {
|
|
85
105
|
if (resource.type === 'event') {
|
|
86
106
|
return (
|
|
87
107
|
<div
|
|
88
|
-
class="animate-float-in flex items-center gap-2 text-sm text-
|
|
89
|
-
style={`animation-delay: ${resource.index * 0.
|
|
108
|
+
class="animate-float-in flex items-center gap-2 text-sm text-[rgb(var(--ec-page-text))] px-4 py-2.5 bg-orange-50 dark:bg-orange-500/10 rounded-lg border border-orange-200 dark:border-orange-500/30 shadow-sm"
|
|
109
|
+
style={`animation-delay: ${resource.index * 0.3}s;`}
|
|
90
110
|
>
|
|
91
|
-
<BoltIcon className="w-4 h-4 text-orange-
|
|
92
|
-
{resource.data.data.name}
|
|
111
|
+
<BoltIcon className="w-4 h-4 text-orange-500" />
|
|
112
|
+
<span class="truncate max-w-[140px]">{resource.data.data.name}</span>
|
|
93
113
|
</div>
|
|
94
114
|
);
|
|
95
115
|
} else if (resource.type === 'service') {
|
|
96
116
|
return (
|
|
97
117
|
<div
|
|
98
|
-
class="animate-float-in flex items-center gap-2 text-sm text-
|
|
99
|
-
style={`animation-delay: ${resource.index * 0.
|
|
118
|
+
class="animate-float-in flex items-center gap-2 text-sm text-[rgb(var(--ec-page-text))] px-4 py-2.5 bg-pink-50 dark:bg-pink-500/10 rounded-lg border border-pink-200 dark:border-pink-500/30 shadow-sm"
|
|
119
|
+
style={`animation-delay: ${resource.index * 0.3}s;`}
|
|
100
120
|
>
|
|
101
|
-
<ServerIcon className="w-4 h-4 text-
|
|
102
|
-
{resource.data.data.name}
|
|
121
|
+
<ServerIcon className="w-4 h-4 text-pink-500" />
|
|
122
|
+
<span class="truncate max-w-[140px]">{resource.data.data.name}</span>
|
|
103
123
|
</div>
|
|
104
124
|
);
|
|
105
125
|
} else if (resource.type === 'channel') {
|
|
106
126
|
return (
|
|
107
127
|
<div
|
|
108
|
-
class="animate-float-in flex items-center gap-2 text-sm text-
|
|
109
|
-
style={`animation-delay: ${resource.index * 0.
|
|
128
|
+
class="animate-float-in flex items-center gap-2 text-sm text-[rgb(var(--ec-page-text))] px-4 py-2.5 bg-indigo-50 dark:bg-indigo-500/10 rounded-lg border border-indigo-200 dark:border-indigo-500/30 shadow-sm"
|
|
129
|
+
style={`animation-delay: ${resource.index * 0.3}s;`}
|
|
110
130
|
>
|
|
111
|
-
<ArrowLeftRightIcon className="w-4 h-4 text-
|
|
112
|
-
{resource.data.data.name}
|
|
131
|
+
<ArrowLeftRightIcon className="w-4 h-4 text-indigo-500" />
|
|
132
|
+
<span class="truncate max-w-[140px]">{resource.data.data.name}</span>
|
|
113
133
|
</div>
|
|
114
134
|
);
|
|
115
135
|
}
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
})}
|
|
137
|
+
</div>
|
|
138
|
+
) : (
|
|
139
|
+
<div class="absolute left-0 top-1/2 -translate-y-1/2 space-y-2.5">
|
|
140
|
+
<div
|
|
141
|
+
class="animate-float-in flex items-center gap-2 text-sm text-[rgb(var(--ec-icon-color))] px-4 py-2.5 bg-[rgb(var(--ec-content-hover))] rounded-lg border border-[rgb(var(--ec-page-border))] border-dashed"
|
|
142
|
+
style="animation-delay: 0s;"
|
|
143
|
+
>
|
|
144
|
+
<BoltIcon className="w-4 h-4" />
|
|
145
|
+
<span>Your events</span>
|
|
146
|
+
</div>
|
|
147
|
+
<div
|
|
148
|
+
class="animate-float-in flex items-center gap-2 text-sm text-[rgb(var(--ec-icon-color))] px-4 py-2.5 bg-[rgb(var(--ec-content-hover))] rounded-lg border border-[rgb(var(--ec-page-border))] border-dashed"
|
|
149
|
+
style="animation-delay: 0.3s;"
|
|
150
|
+
>
|
|
151
|
+
<ServerIcon className="w-4 h-4" />
|
|
152
|
+
<span>Your services</span>
|
|
153
|
+
</div>
|
|
154
|
+
<div
|
|
155
|
+
class="animate-float-in flex items-center gap-2 text-sm text-[rgb(var(--ec-icon-color))] px-4 py-2.5 bg-[rgb(var(--ec-content-hover))] rounded-lg border border-[rgb(var(--ec-page-border))] border-dashed"
|
|
156
|
+
style="animation-delay: 0.6s;"
|
|
157
|
+
>
|
|
158
|
+
<ArrowLeftRightIcon className="w-4 h-4" />
|
|
159
|
+
<span>Your channels</span>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
{/* Arrow indicator */}
|
|
166
|
+
<div class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
|
|
167
|
+
<svg
|
|
168
|
+
class="w-10 h-10 text-[rgb(var(--ec-icon-color))] animate-pulse"
|
|
169
|
+
viewBox="0 0 24 24"
|
|
170
|
+
fill="none"
|
|
171
|
+
stroke="currentColor"
|
|
172
|
+
>
|
|
173
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
|
|
174
|
+
</svg>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
{/* Design preview */}
|
|
178
|
+
<div class="absolute right-0 top-1/2 -translate-y-1/2 animate-fade-in-scale" style="animation-delay: 1.5s;">
|
|
179
|
+
<img
|
|
180
|
+
src="/studio-bg.png"
|
|
181
|
+
alt="Studio Design Preview"
|
|
182
|
+
class="rounded-xl shadow-lg border border-[rgb(var(--ec-page-border))] w-56 h-auto"
|
|
183
|
+
/>
|
|
135
184
|
</div>
|
|
136
185
|
</div>
|
|
137
186
|
</div>
|
|
138
187
|
</div>
|
|
139
188
|
|
|
140
189
|
{/* Features Section */}
|
|
141
|
-
<div class="grid grid-cols-1 md:grid-cols-3 gap-
|
|
142
|
-
<div
|
|
143
|
-
|
|
144
|
-
|
|
190
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
191
|
+
<div
|
|
192
|
+
class="group bg-[rgb(var(--ec-card-bg,var(--ec-page-bg)))] rounded-xl p-6 border border-[rgb(var(--ec-page-border))] hover:border-[rgb(var(--ec-accent))] hover:shadow-md transition-all duration-200"
|
|
193
|
+
>
|
|
194
|
+
<div
|
|
195
|
+
class="w-10 h-10 bg-[rgb(var(--ec-content-hover))] rounded-lg flex items-center justify-center mb-4 group-hover:bg-[rgb(var(--ec-accent-subtle))] transition-colors"
|
|
196
|
+
>
|
|
197
|
+
<svg
|
|
198
|
+
class="w-5 h-5 text-[rgb(var(--ec-page-text))]"
|
|
199
|
+
viewBox="0 0 24 24"
|
|
200
|
+
fill="none"
|
|
201
|
+
stroke="currentColor"
|
|
202
|
+
stroke-width="2"
|
|
203
|
+
>
|
|
145
204
|
<rect width="8" height="8" x="3" y="3" rx="2"></rect>
|
|
146
205
|
<path d="M7 11v4a2 2 0 0 0 2 2h4"></path>
|
|
147
206
|
<rect width="8" height="8" x="13" y="13" rx="2"></rect>
|
|
148
207
|
</svg>
|
|
149
208
|
</div>
|
|
150
|
-
<h3 class="text-
|
|
151
|
-
<p class="text-
|
|
152
|
-
Drag and drop messages, services, and domains from your catalog. No more copying names or keeping things
|
|
153
|
-
in sync.
|
|
209
|
+
<h3 class="text-base font-semibold text-[rgb(var(--ec-page-text))] mb-2">Real Resources</h3>
|
|
210
|
+
<p class="text-sm text-[rgb(var(--ec-page-text-muted))] leading-relaxed">
|
|
211
|
+
Drag and drop messages, services, and domains from your catalog. No more copying names or keeping things in sync.
|
|
154
212
|
</p>
|
|
155
213
|
</div>
|
|
156
214
|
|
|
157
|
-
<div
|
|
158
|
-
|
|
159
|
-
|
|
215
|
+
<div
|
|
216
|
+
class="group bg-[rgb(var(--ec-card-bg,var(--ec-page-bg)))] rounded-xl p-6 border border-[rgb(var(--ec-page-border))] hover:border-[rgb(var(--ec-accent))] hover:shadow-md transition-all duration-200"
|
|
217
|
+
>
|
|
218
|
+
<div
|
|
219
|
+
class="w-10 h-10 bg-[rgb(var(--ec-content-hover))] rounded-lg flex items-center justify-center mb-4 group-hover:bg-[rgb(var(--ec-accent-subtle))] transition-colors"
|
|
220
|
+
>
|
|
221
|
+
<svg
|
|
222
|
+
class="w-5 h-5 text-[rgb(var(--ec-page-text))]"
|
|
223
|
+
viewBox="0 0 24 24"
|
|
224
|
+
fill="none"
|
|
225
|
+
stroke="currentColor"
|
|
226
|
+
stroke-width="2"
|
|
227
|
+
>
|
|
160
228
|
<path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"></path>
|
|
161
229
|
<polyline points="17 21 17 13 7 13 7 21"></polyline>
|
|
162
230
|
<polyline points="7 3 7 8 15 8"></polyline>
|
|
163
231
|
</svg>
|
|
164
232
|
</div>
|
|
165
|
-
<h3 class="text-
|
|
166
|
-
<p class="text-
|
|
233
|
+
<h3 class="text-base font-semibold text-[rgb(var(--ec-page-text))] mb-2">Save & Version</h3>
|
|
234
|
+
<p class="text-sm text-[rgb(var(--ec-page-text-muted))] leading-relaxed">
|
|
235
|
+
Save designs locally and store in Git. All designs and data is owned by you.
|
|
236
|
+
</p>
|
|
167
237
|
</div>
|
|
168
238
|
|
|
169
|
-
<div
|
|
170
|
-
|
|
171
|
-
|
|
239
|
+
<div
|
|
240
|
+
class="group bg-[rgb(var(--ec-card-bg,var(--ec-page-bg)))] rounded-xl p-6 border border-[rgb(var(--ec-page-border))] hover:border-[rgb(var(--ec-accent))] hover:shadow-md transition-all duration-200"
|
|
241
|
+
>
|
|
242
|
+
<div
|
|
243
|
+
class="w-10 h-10 bg-[rgb(var(--ec-content-hover))] rounded-lg flex items-center justify-center mb-4 group-hover:bg-[rgb(var(--ec-accent-subtle))] transition-colors"
|
|
244
|
+
>
|
|
245
|
+
<svg
|
|
246
|
+
class="w-5 h-5 text-[rgb(var(--ec-page-text))]"
|
|
247
|
+
viewBox="0 0 24 24"
|
|
248
|
+
fill="none"
|
|
249
|
+
stroke="currentColor"
|
|
250
|
+
stroke-width="2"
|
|
251
|
+
>
|
|
172
252
|
<polyline points="16 18 22 12 16 6"></polyline>
|
|
173
253
|
<polyline points="8 6 2 12 8 18"></polyline>
|
|
174
254
|
</svg>
|
|
175
255
|
</div>
|
|
176
|
-
<h3 class="text-
|
|
177
|
-
<p class="text-
|
|
256
|
+
<h3 class="text-base font-semibold text-[rgb(var(--ec-page-text))] mb-2">Embed Anywhere</h3>
|
|
257
|
+
<p class="text-sm text-[rgb(var(--ec-page-text-muted))] leading-relaxed">
|
|
178
258
|
Drop diagrams directly into documentation pages. One source of truth for your architecture.
|
|
179
259
|
</p>
|
|
180
260
|
</div>
|
|
@@ -201,7 +281,7 @@ const resourcesToShow = [
|
|
|
201
281
|
@keyframes float-in {
|
|
202
282
|
0% {
|
|
203
283
|
opacity: 0;
|
|
204
|
-
transform: translateX(-
|
|
284
|
+
transform: translateX(-20px);
|
|
205
285
|
}
|
|
206
286
|
100% {
|
|
207
287
|
opacity: 1;
|
|
@@ -212,7 +292,7 @@ const resourcesToShow = [
|
|
|
212
292
|
@keyframes fade-in-scale {
|
|
213
293
|
0% {
|
|
214
294
|
opacity: 0;
|
|
215
|
-
transform: translateY(-50%) scale(0.
|
|
295
|
+
transform: translateY(-50%) scale(0.95);
|
|
216
296
|
}
|
|
217
297
|
100% {
|
|
218
298
|
opacity: 1;
|
|
@@ -221,12 +301,12 @@ const resourcesToShow = [
|
|
|
221
301
|
}
|
|
222
302
|
|
|
223
303
|
.animate-float-in {
|
|
224
|
-
animation: float-in 0.
|
|
304
|
+
animation: float-in 0.5s ease-out forwards;
|
|
225
305
|
opacity: 0;
|
|
226
306
|
}
|
|
227
307
|
|
|
228
308
|
.animate-fade-in-scale {
|
|
229
|
-
animation: fade-in-scale 0.
|
|
309
|
+
animation: fade-in-scale 0.6s ease-out forwards;
|
|
230
310
|
opacity: 0;
|
|
231
311
|
}
|
|
232
312
|
</style>
|
|
@@ -6,11 +6,11 @@ export function remarkDirectives() {
|
|
|
6
6
|
visit(tree, (node) => {
|
|
7
7
|
if (node.type === 'containerDirective') {
|
|
8
8
|
const blockTypes = {
|
|
9
|
-
info: 'bg-blue-50 border-l-4 border-blue-500',
|
|
10
|
-
warning: 'bg-yellow-50 border-l-4 border-yellow-500',
|
|
11
|
-
danger: 'bg-red-50 border-l-4 border-red-500',
|
|
12
|
-
tip: 'bg-green-50 border-l-4 border-green-500',
|
|
13
|
-
note: 'bg-gray-50 border-l-4 border-gray-500',
|
|
9
|
+
info: 'bg-blue-50 dark:bg-blue-950/50 border-l-4 border-blue-500 text-blue-700 dark:text-blue-200',
|
|
10
|
+
warning: 'bg-yellow-50 dark:bg-yellow-950/50 border-l-4 border-yellow-500 text-yellow-700 dark:text-yellow-200',
|
|
11
|
+
danger: 'bg-red-50 dark:bg-red-950/50 border-l-4 border-red-500 text-red-700 dark:text-red-200',
|
|
12
|
+
tip: 'bg-green-50 dark:bg-green-950/50 border-l-4 border-green-500 text-green-700 dark:text-green-200',
|
|
13
|
+
note: 'bg-gray-50 dark:bg-gray-950/50 border-l-4 border-gray-500 text-gray-700 dark:text-gray-200',
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
// Lucide icon paths
|
|
@@ -30,7 +30,33 @@ export function remarkDirectives() {
|
|
|
30
30
|
class: `rounded-lg p-4 my-4 ${blockTypes[node.name as keyof typeof blockTypes] || ''}`,
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// Check if there's a custom title (label) provided via :::note[Custom Title]
|
|
34
|
+
// In remark-directive, the label is stored in node.children as a paragraph node
|
|
35
|
+
// with data.directiveLabel = true
|
|
36
|
+
let titleChildren;
|
|
37
|
+
let contentChildren;
|
|
38
|
+
|
|
39
|
+
const firstChild = node.children && node.children.length > 0 ? node.children[0] : null;
|
|
40
|
+
const hasCustomTitle = firstChild && firstChild.data?.directiveLabel === true;
|
|
41
|
+
|
|
42
|
+
if (hasCustomTitle && firstChild) {
|
|
43
|
+
// Custom title was provided in the label - it contains markdown parsed as inline content
|
|
44
|
+
titleChildren = firstChild.children || [
|
|
45
|
+
{ type: 'text', value: node.name.charAt(0).toUpperCase() + node.name.slice(1) },
|
|
46
|
+
];
|
|
47
|
+
contentChildren = node.children.slice(1);
|
|
48
|
+
} else {
|
|
49
|
+
// No custom title, use default based on directive name
|
|
50
|
+
titleChildren = [
|
|
51
|
+
{
|
|
52
|
+
type: 'text',
|
|
53
|
+
value: node.name.charAt(0).toUpperCase() + node.name.slice(1),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
contentChildren = node.children;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Create header div that will contain icon and title
|
|
34
60
|
const headerNode = {
|
|
35
61
|
type: 'element',
|
|
36
62
|
data: {
|
|
@@ -70,7 +96,7 @@ export function remarkDirectives() {
|
|
|
70
96
|
},
|
|
71
97
|
],
|
|
72
98
|
},
|
|
73
|
-
//
|
|
99
|
+
// Title (with support for markdown)
|
|
74
100
|
{
|
|
75
101
|
type: 'element',
|
|
76
102
|
data: {
|
|
@@ -79,12 +105,7 @@ export function remarkDirectives() {
|
|
|
79
105
|
class: '',
|
|
80
106
|
},
|
|
81
107
|
},
|
|
82
|
-
children:
|
|
83
|
-
{
|
|
84
|
-
type: 'text',
|
|
85
|
-
value: node.name.charAt(0).toUpperCase() + node.name.slice(1),
|
|
86
|
-
},
|
|
87
|
-
],
|
|
108
|
+
children: titleChildren,
|
|
88
109
|
},
|
|
89
110
|
],
|
|
90
111
|
};
|
|
@@ -95,10 +116,10 @@ export function remarkDirectives() {
|
|
|
95
116
|
data: {
|
|
96
117
|
hName: 'div',
|
|
97
118
|
hProperties: {
|
|
98
|
-
class: 'prose prose-md w-full !max-w-none ',
|
|
119
|
+
class: 'prose prose-md dark:prose-invert w-full !max-w-none prose-p:my-1 prose-p:text-inherit',
|
|
99
120
|
},
|
|
100
121
|
},
|
|
101
|
-
children:
|
|
122
|
+
children: contentChildren,
|
|
102
123
|
};
|
|
103
124
|
|
|
104
125
|
// Replace node's children with header and content
|
|
@@ -19,8 +19,8 @@ export const mermaid: RemarkPlugin<[]> = () => (tree) => {
|
|
|
19
19
|
node.type = 'html';
|
|
20
20
|
node.value = `
|
|
21
21
|
<div class="mermaid-block pb-4">
|
|
22
|
-
<div class="mermaid border border-
|
|
23
|
-
<p>Loading graph...</p>
|
|
22
|
+
<div class="mermaid border border-[rgb(var(--ec-page-border))] rounded-lg p-1" data-content="${escapeHtml(node.value)}">
|
|
23
|
+
<p class="text-[rgb(var(--ec-page-text-muted))]">Loading graph...</p>
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
`;
|