@eventcatalog/core 3.14.6 → 3.15.0-beta.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.
Files changed (35) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/{chunk-6NRRWRLT.js → chunk-4JTLFCQ7.js} +1 -1
  6. package/dist/{chunk-TERDXO46.js → chunk-7RPTQBIY.js} +1 -1
  7. package/dist/{chunk-LNIPDPVB.js → chunk-CVH4LGYA.js} +1 -1
  8. package/dist/{chunk-NYVQSLA5.js → chunk-FRILQLHV.js} +1 -1
  9. package/dist/{chunk-KWCAGR52.js → chunk-VUARMJ2E.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.cjs +1 -1
  13. package/dist/eventcatalog.js +5 -5
  14. package/dist/generate.cjs +1 -1
  15. package/dist/generate.js +3 -3
  16. package/dist/utils/cli-logger.cjs +1 -1
  17. package/dist/utils/cli-logger.js +2 -2
  18. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +56 -10
  19. package/eventcatalog/src/content.config.ts +53 -0
  20. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/_index.data.ts +85 -0
  21. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +195 -0
  22. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/_index.data.ts +86 -0
  23. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +195 -0
  24. package/eventcatalog/src/stores/sidebar-store/builders/container.ts +9 -0
  25. package/eventcatalog/src/stores/sidebar-store/builders/data-product.ts +15 -9
  26. package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +9 -0
  27. package/eventcatalog/src/stores/sidebar-store/builders/flow.ts +13 -4
  28. package/eventcatalog/src/stores/sidebar-store/builders/message.ts +9 -0
  29. package/eventcatalog/src/stores/sidebar-store/builders/service.ts +9 -0
  30. package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +82 -0
  31. package/eventcatalog/src/stores/sidebar-store/state.ts +27 -2
  32. package/eventcatalog/src/utils/collections/data-products.ts +6 -2
  33. package/eventcatalog/src/utils/collections/resource-docs.ts +601 -0
  34. package/eventcatalog/src/utils/feature.ts +1 -0
  35. package/package.json +3 -3
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "3.14.6";
40
+ var version = "3.15.0-beta.0";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-TERDXO46.js";
4
- import "../chunk-NYVQSLA5.js";
3
+ } from "../chunk-7RPTQBIY.js";
4
+ import "../chunk-FRILQLHV.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -111,7 +111,7 @@ var import_axios = __toESM(require("axios"), 1);
111
111
  var import_os = __toESM(require("os"), 1);
112
112
 
113
113
  // package.json
114
- var version = "3.14.6";
114
+ var version = "3.15.0-beta.0";
115
115
 
116
116
  // src/constants.ts
117
117
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-KWCAGR52.js";
4
- import "../chunk-TERDXO46.js";
3
+ } from "../chunk-VUARMJ2E.js";
4
+ import "../chunk-7RPTQBIY.js";
5
5
  import "../chunk-4UVFXLPI.js";
6
- import "../chunk-NYVQSLA5.js";
6
+ import "../chunk-FRILQLHV.js";
7
7
  import "../chunk-5T63CXKU.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-NYVQSLA5.js";
3
+ } from "./chunk-FRILQLHV.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-NYVQSLA5.js";
3
+ } from "./chunk-FRILQLHV.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-6NRRWRLT.js";
3
+ } from "./chunk-4JTLFCQ7.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.14.6";
2
+ var version = "3.15.0-beta.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-TERDXO46.js";
3
+ } from "./chunk-7RPTQBIY.js";
4
4
  import {
5
5
  countResources,
6
6
  serializeCounts
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "3.14.6";
28
+ var version = "3.15.0-beta.0";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-NYVQSLA5.js";
3
+ } from "./chunk-FRILQLHV.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -115,7 +115,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
115
115
  var import_picocolors = __toESM(require("picocolors"), 1);
116
116
 
117
117
  // package.json
118
- var version = "3.14.6";
118
+ var version = "3.15.0-beta.0";
119
119
 
120
120
  // src/constants.ts
121
121
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-KWCAGR52.js";
10
- import "./chunk-TERDXO46.js";
9
+ } from "./chunk-VUARMJ2E.js";
10
+ import "./chunk-7RPTQBIY.js";
11
11
  import "./chunk-4UVFXLPI.js";
12
12
  import {
13
13
  runMigrations
@@ -22,13 +22,13 @@ import {
22
22
  } from "./chunk-3KXCGYET.js";
23
23
  import {
24
24
  generate
25
- } from "./chunk-LNIPDPVB.js";
25
+ } from "./chunk-CVH4LGYA.js";
26
26
  import {
27
27
  logger
28
- } from "./chunk-6NRRWRLT.js";
28
+ } from "./chunk-4JTLFCQ7.js";
29
29
  import {
30
30
  VERSION
31
- } from "./chunk-NYVQSLA5.js";
31
+ } from "./chunk-FRILQLHV.js";
32
32
  import {
33
33
  getEventCatalogConfigFile,
34
34
  verifyRequiredFieldsAreInCatalogConfigFile
package/dist/generate.cjs CHANGED
@@ -78,7 +78,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
78
78
  var import_picocolors = __toESM(require("picocolors"), 1);
79
79
 
80
80
  // package.json
81
- var version = "3.14.6";
81
+ var version = "3.15.0-beta.0";
82
82
 
83
83
  // src/constants.ts
84
84
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-LNIPDPVB.js";
4
- import "./chunk-6NRRWRLT.js";
5
- import "./chunk-NYVQSLA5.js";
3
+ } from "./chunk-CVH4LGYA.js";
4
+ import "./chunk-4JTLFCQ7.js";
5
+ import "./chunk-FRILQLHV.js";
6
6
  import "./chunk-5T63CXKU.js";
7
7
  export {
8
8
  generate
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "3.14.6";
39
+ var version = "3.15.0-beta.0";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-6NRRWRLT.js";
4
- import "../chunk-NYVQSLA5.js";
3
+ } from "../chunk-4JTLFCQ7.js";
4
+ import "../chunk-FRILQLHV.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -723,6 +723,7 @@ export default function NestedSideBar() {
723
723
  const renderGroup = (group: NavNode, groupKey: string | null, index: number) => {
724
724
  // Get optional icon for group
725
725
  const GroupIcon = group.icon ? (LucideIcons as unknown as Record<string, LucideIcons.LucideIcon>)[group.icon] : null;
726
+ const isSubtleGroup = group.subtle === true;
726
727
 
727
728
  // Get visible children
728
729
  const visibleChildren =
@@ -730,43 +731,82 @@ export default function NestedSideBar() {
730
731
  const child = resolveRef(childRef);
731
732
  return child && isVisible(child);
732
733
  }) ?? [];
734
+ const shouldFlattenSubtleChildren =
735
+ !isSubtleGroup &&
736
+ visibleChildren.length > 0 &&
737
+ visibleChildren.every((childRef) => {
738
+ const child = resolveRef(childRef);
739
+ return !!child && isGroup(child) && child.subtle === true;
740
+ });
733
741
 
734
742
  const groupId = groupKey || `group-${index}`;
735
- const isCollapsed = collapsedSections.has(groupId);
736
743
  const canCollapse = visibleChildren.length > 3;
744
+ const isCollapsed = collapsedSections.has(groupId);
737
745
 
738
746
  const headerContent = (
739
747
  <>
740
748
  <div className="flex items-center gap-2">
741
749
  {GroupIcon && (
742
- <span className="flex items-center justify-center w-5 h-5 rounded bg-[rgb(var(--ec-group-icon-bg))] text-[rgb(var(--ec-group-icon-text))]">
743
- <GroupIcon className="w-3 h-3" />
750
+ <span
751
+ className={cn(
752
+ 'flex items-center justify-center',
753
+ isSubtleGroup
754
+ ? 'w-4 h-4 text-[rgb(var(--ec-content-text-muted))]'
755
+ : 'w-5 h-5 rounded bg-[rgb(var(--ec-group-icon-bg))] text-[rgb(var(--ec-group-icon-text))]'
756
+ )}
757
+ >
758
+ <GroupIcon className={cn(isSubtleGroup ? 'w-3 h-3' : 'w-3 h-3')} />
744
759
  </span>
745
760
  )}
746
- <span className="text-[13px] text-[rgb(var(--ec-content-text))] font-semibold tracking-tight">{group.title}</span>
761
+ <span
762
+ className={cn(
763
+ 'tracking-tight',
764
+ isSubtleGroup
765
+ ? 'text-[12px] text-[rgb(var(--ec-content-text-muted))] font-medium'
766
+ : 'text-[13px] text-[rgb(var(--ec-content-text))] font-semibold'
767
+ )}
768
+ >
769
+ {group.title}
770
+ </span>
747
771
  </div>
748
772
  {canCollapse && (
749
773
  <ChevronDown
750
- className={cn('w-4 h-4 text-[rgb(var(--ec-icon-color))] transition-transform', isCollapsed && '-rotate-90')}
774
+ className={cn(
775
+ isSubtleGroup ? 'w-3.5 h-3.5' : 'w-4 h-4',
776
+ 'text-[rgb(var(--ec-icon-color))] transition-transform',
777
+ isCollapsed && '-rotate-90'
778
+ )}
751
779
  />
752
780
  )}
753
781
  </>
754
782
  );
755
783
 
756
784
  return (
757
- <div key={`group-${groupKey || index}`} className="mb-5 last:mb-2">
785
+ <div key={`group-${groupKey || index}`} className={cn(isSubtleGroup ? 'mb-3 last:mb-1' : 'mb-5 last:mb-2')}>
758
786
  {canCollapse ? (
759
787
  <button
760
788
  onClick={() => toggleSectionCollapse(groupId)}
761
- className="flex items-center justify-between w-full px-2 py-1.5 hover:bg-[rgb(var(--ec-content-hover))] rounded-md transition-colors cursor-pointer"
789
+ className={cn(
790
+ 'flex items-center justify-between w-full rounded-md transition-colors cursor-pointer',
791
+ isSubtleGroup
792
+ ? 'px-1.5 py-1 hover:bg-[rgb(var(--ec-content-hover))]/60'
793
+ : 'px-2 py-1.5 hover:bg-[rgb(var(--ec-content-hover))]'
794
+ )}
762
795
  >
763
796
  {headerContent}
764
797
  </button>
765
798
  ) : (
766
- <div className="flex items-center justify-between px-2 py-1.5">{headerContent}</div>
799
+ <div className={cn('flex items-center justify-between', isSubtleGroup ? 'px-1.5 py-1' : 'px-2 py-1.5')}>
800
+ {headerContent}
801
+ </div>
767
802
  )}
768
803
  {!isCollapsed && (
769
- <div className="flex flex-col gap-0.5 border-l ml-4 mt-1 border-[rgb(var(--ec-content-border))]">
804
+ <div
805
+ className={cn(
806
+ 'flex flex-col gap-0.5 border-[rgb(var(--ec-content-border))]',
807
+ isSubtleGroup ? 'border-l ml-3 mt-0.5' : shouldFlattenSubtleChildren ? 'mt-1' : 'border-l ml-4 mt-1'
808
+ )}
809
+ >
770
810
  {visibleChildren.map((childRef, childIndex) => {
771
811
  const child = resolveRef(childRef);
772
812
  if (!child) return null;
@@ -780,7 +820,13 @@ export default function NestedSideBar() {
780
820
  return (
781
821
  <div
782
822
  key={`nested-group-${childKey || childIndex}`}
783
- className="ml-3 mt-1.5 pl-3 border-l border-[rgb(var(--ec-content-border))]"
823
+ className={cn(
824
+ child.subtle
825
+ ? shouldFlattenSubtleChildren
826
+ ? 'ml-5 mt-0.5'
827
+ : 'ml-1.5 mt-1 pl-1.5'
828
+ : 'ml-3 mt-1.5 pl-3 border-l border-[rgb(var(--ec-content-border))]'
829
+ )}
784
830
  >
785
831
  {renderGroup(child, childKey, childIndex)}
786
832
  </div>
@@ -511,6 +511,57 @@ const customPages = defineCollection({
511
511
  schema: customPagesSchema,
512
512
  });
513
513
 
514
+ const resourceDocs = defineCollection({
515
+ loader: glob({
516
+ // Resource-level docs are restricted to known resource paths.
517
+ // This avoids scanning external docs such as node_modules/**/docs.
518
+ pattern: [
519
+ '{events,commands,queries,services,flows,containers,channels,entities,data-products}/*/docs/**/*.@(md|mdx)',
520
+ '{events,commands,queries,services,flows,containers,channels,entities,data-products}/*/versioned/*/docs/**/*.@(md|mdx)',
521
+ 'domains/*/docs/**/*.@(md|mdx)',
522
+ 'domains/*/versioned/*/docs/**/*.@(md|mdx)',
523
+ 'domains/*/subdomains/*/docs/**/*.@(md|mdx)',
524
+ 'domains/*/subdomains/*/versioned/*/docs/**/*.@(md|mdx)',
525
+ ],
526
+ base: projectDirBase,
527
+ }),
528
+ schema: z.object({
529
+ id: z.string().optional(),
530
+ type: z.string().optional(),
531
+ version: z.string().optional(),
532
+ order: z.number().optional(),
533
+ badges: z.array(badge).optional(),
534
+ title: z.string().optional(),
535
+ summary: z.string().optional(),
536
+ slug: z.string().optional(),
537
+ hidden: z.boolean().optional(),
538
+ }),
539
+ });
540
+
541
+ const resourceDocCategories = defineCollection({
542
+ loader: glob({
543
+ pattern: [
544
+ '{events,commands,queries,services,flows,containers,channels,entities,data-products}/*/docs/**/category.json',
545
+ '{events,commands,queries,services,flows,containers,channels,entities,data-products}/*/docs/**/_category_.json',
546
+ '{events,commands,queries,services,flows,containers,channels,entities,data-products}/*/versioned/*/docs/**/category.json',
547
+ '{events,commands,queries,services,flows,containers,channels,entities,data-products}/*/versioned/*/docs/**/_category_.json',
548
+ 'domains/*/docs/**/category.json',
549
+ 'domains/*/docs/**/_category_.json',
550
+ 'domains/*/versioned/*/docs/**/category.json',
551
+ 'domains/*/versioned/*/docs/**/_category_.json',
552
+ 'domains/*/subdomains/*/docs/**/category.json',
553
+ 'domains/*/subdomains/*/docs/**/_category_.json',
554
+ 'domains/*/subdomains/*/versioned/*/docs/**/category.json',
555
+ 'domains/*/subdomains/*/versioned/*/docs/**/_category_.json',
556
+ ],
557
+ base: projectDirBase,
558
+ }),
559
+ schema: z.object({
560
+ label: z.string().optional(),
561
+ position: z.number().optional(),
562
+ }),
563
+ });
564
+
514
565
  const domains = defineCollection({
515
566
  loader: glob({
516
567
  pattern: [
@@ -778,6 +829,8 @@ export const collections = {
778
829
 
779
830
  // EventCatalog Pro Collections
780
831
  customPages,
832
+ resourceDocs,
833
+ resourceDocCategories,
781
834
 
782
835
  // EventCatalog Studio Collections
783
836
  designs,
@@ -0,0 +1,85 @@
1
+ import { isSSR, isResourceDocsEnabled } from '@utils/feature';
2
+ import { HybridPage } from '@utils/page-loaders/hybrid-page';
3
+ import { getResourceDocs, getResourceDocsForResource, type ResourceCollection } from '@utils/collections/resource-docs';
4
+
5
+ const supportedResourceCollections = new Set<ResourceCollection>([
6
+ 'domains',
7
+ 'services',
8
+ 'events',
9
+ 'commands',
10
+ 'queries',
11
+ 'flows',
12
+ 'containers',
13
+ 'channels',
14
+ 'entities',
15
+ 'data-products',
16
+ ]);
17
+
18
+ export class Page extends HybridPage {
19
+ static async getStaticPaths() {
20
+ if (isSSR() || !isResourceDocsEnabled()) {
21
+ return [];
22
+ }
23
+
24
+ const docs = await getResourceDocs();
25
+
26
+ return docs.map((doc) => ({
27
+ params: {
28
+ type: doc.data.resourceCollection,
29
+ id: doc.data.resourceId,
30
+ version: doc.data.resourceVersion,
31
+ docType: doc.data.type,
32
+ docId: doc.data.id,
33
+ docVersion: doc.data.version,
34
+ },
35
+ props: {},
36
+ }));
37
+ }
38
+
39
+ protected static async fetchData(params: any) {
40
+ if (!isResourceDocsEnabled()) {
41
+ return null;
42
+ }
43
+
44
+ const decodeParam = (value: string) => {
45
+ try {
46
+ return decodeURIComponent(value);
47
+ } catch {
48
+ return value;
49
+ }
50
+ };
51
+
52
+ const type = decodeParam(params.type);
53
+ const id = decodeParam(params.id);
54
+ const version = decodeParam(params.version);
55
+ const docType = decodeParam(params.docType);
56
+ const docId = decodeParam(params.docId);
57
+ const docVersion = decodeParam(params.docVersion);
58
+ if (!type || !id || !version || !docType || !docId || !docVersion) {
59
+ return null;
60
+ }
61
+
62
+ if (!supportedResourceCollections.has(type as ResourceCollection)) {
63
+ return null;
64
+ }
65
+
66
+ const docsForResource = await getResourceDocsForResource(type as ResourceCollection, id, version);
67
+ const doc = docsForResource.find(
68
+ (resourceDoc) =>
69
+ resourceDoc.data.type === docType && resourceDoc.data.id === docId && resourceDoc.data.version === docVersion
70
+ );
71
+
72
+ if (!doc) {
73
+ return null;
74
+ }
75
+
76
+ return doc;
77
+ }
78
+
79
+ protected static createNotFoundResponse(): Response {
80
+ return new Response(null, {
81
+ status: 404,
82
+ statusText: 'Resource documentation not found',
83
+ });
84
+ }
85
+ }
@@ -0,0 +1,195 @@
1
+ ---
2
+ import { render } from 'astro:content';
3
+
4
+ import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
5
+ import components from '@components/MDX/components';
6
+ import { buildUrl } from '@utils/url-builder';
7
+ import { AlignLeftIcon, HistoryIcon } from 'lucide-react';
8
+ import { isResourceDocsEnabled } from '@utils/feature';
9
+ import { getIcon } from '@utils/badges';
10
+ import { collectionToResourceMap } from '@utils/collections/util';
11
+
12
+ import { Page } from './_index.data';
13
+
14
+ export const prerender = Page.prerender;
15
+ export const getStaticPaths = Page.getStaticPaths;
16
+
17
+ if (!isResourceDocsEnabled()) {
18
+ return Astro.redirect(buildUrl('/docs/custom/feature'));
19
+ }
20
+
21
+ const props = await Page.getData(Astro);
22
+ const { Content, headings } = await render(props);
23
+
24
+ const title = props.data.title || props.data.id;
25
+ const pageTitle = `${title} | ${props.data.resourceId}`;
26
+ const versions = props.data.versions || [props.data.version];
27
+ const badges = (props.data.badges || []).map((badge: any) => ({
28
+ ...badge,
29
+ iconComponent: badge.icon ? getIcon(badge.icon) : null,
30
+ }));
31
+
32
+ const docsBasePath = `/docs/${props.data.resourceCollection}/${props.data.resourceId}/${props.data.resourceVersion}/${encodeURIComponent(props.data.type)}/${encodeURIComponent(props.data.id)}`;
33
+ const singularResourceName =
34
+ collectionToResourceMap[props.data.resourceCollection as keyof typeof collectionToResourceMap] ??
35
+ props.data.resourceCollection.slice(0, props.data.resourceCollection.length - 1);
36
+
37
+ const pagefindAttributes =
38
+ props.data.version === props.data.latestVersion
39
+ ? {
40
+ 'data-pagefind-body': '',
41
+ 'data-pagefind-meta': `title:${pageTitle}`,
42
+ }
43
+ : {};
44
+ ---
45
+
46
+ <VerticalSideBarLayout title={pageTitle} description={props.data.summary}>
47
+ <main class="flex docs-layout h-full bg-[rgb(var(--ec-page-bg))]" {...pagefindAttributes}>
48
+ <div class="flex docs-layout w-full pl-16">
49
+ <div class="w-full lg:mr-2 pr-8 overflow-y-auto py-8 bg-[rgb(var(--ec-page-bg))]">
50
+ <div class="border-b border-[rgb(var(--ec-page-border))] pb-4">
51
+ <p class="text-xs uppercase tracking-wide text-[rgb(var(--ec-page-text-muted))]">
52
+ <a
53
+ href={buildUrl(`/docs/${props.data.resourceCollection}/${props.data.resourceId}/${props.data.resourceVersion}`)}
54
+ class="hover:underline"
55
+ >
56
+ {singularResourceName}: {props.data.resourceId}
57
+ </a>
58
+ </p>
59
+ <div class="flex items-center gap-2 pt-1">
60
+ <h2 id="doc-page-header" class="text-2xl md:text-4xl font-bold text-[rgb(var(--ec-page-text))]">{title}</h2>
61
+ <span
62
+ class="text-xs rounded-md px-2 py-1 bg-[rgb(var(--ec-content-hover))] text-[rgb(var(--ec-page-text-muted))] border border-[rgb(var(--ec-page-border))]"
63
+ >
64
+ v{props.data.version}
65
+ {props.data.version === props.data.latestVersion && ' (latest)'}
66
+ </span>
67
+ </div>
68
+ {
69
+ props.data.summary && (
70
+ <p class="text-lg pt-2 text-[rgb(var(--ec-page-text-muted))] font-light">{props.data.summary}</p>
71
+ )
72
+ }
73
+ {
74
+ badges.length > 0 && (
75
+ <div class="flex flex-wrap gap-3 pt-4">
76
+ {badges.map((badge: any) => (
77
+ <span
78
+ class={`
79
+ inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium
80
+ bg-[rgb(var(--ec-content-hover))] border border-[rgb(var(--ec-page-border))]
81
+ text-[rgb(var(--ec-page-text))]
82
+ `}
83
+ >
84
+ {badge.iconComponent && (
85
+ <badge.iconComponent className="w-4 h-4 flex-shrink-0 text-[rgb(var(--ec-icon-color))]" />
86
+ )}
87
+ <span>{badge.content}</span>
88
+ </span>
89
+ ))}
90
+ </div>
91
+ )
92
+ }
93
+ </div>
94
+ <div data-pagefind-ignore>
95
+ {
96
+ props.data.version !== props.data.latestVersion && (
97
+ <div class="rounded-md bg-[rgb(var(--ec-accent-subtle))] p-4 not-prose my-4">
98
+ <div class="flex">
99
+ <div class="flex-shrink-0">
100
+ <svg class="h-5 w-5 text-[rgb(var(--ec-accent))]" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
101
+ <path
102
+ fill-rule="evenodd"
103
+ d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z"
104
+ clip-rule="evenodd"
105
+ />
106
+ </svg>
107
+ </div>
108
+ <div class="ml-3">
109
+ <h3 class="text-sm font-medium text-[rgb(var(--ec-accent-text))]">New version found</h3>
110
+ <div class="mt-2 text-sm text-[rgb(var(--ec-accent-text))]">
111
+ <p>
112
+ You are looking at a previous version of the {singularResourceName} doc <strong>{title}</strong>.{' '}
113
+ <a
114
+ class="underline hover:text-primary block pt-2"
115
+ href={buildUrl(`${docsBasePath}/${props.data.latestVersion}`)}
116
+ >
117
+ The latest version of this doc is <span>v{props.data.latestVersion}</span> &rarr;
118
+ </a>
119
+ </p>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ )
125
+ }
126
+ </div>
127
+ <div class="prose py-8 max-w-none">
128
+ <Content components={components(props)} />
129
+ </div>
130
+ </div>
131
+ <aside class="hidden lg:block sticky top-0 pb-10 w-80 overflow-y-auto border-l border-[rgb(var(--ec-page-border))] py-2">
132
+ <div class="sticky top-28 left-0 h-full overflow-y-auto px-6 py-4">
133
+ <h3 class="text-sm text-[rgb(var(--ec-page-text))] font-semibold capitalize flex items-center gap-2">
134
+ <AlignLeftIcon className="w-4 h-4" />
135
+ On this page
136
+ </h3>
137
+ <nav class="space-y-1 text-sm py-4">
138
+ {
139
+ headings.map((heading) => {
140
+ if (heading.depth > 3) {
141
+ return null;
142
+ }
143
+ return (
144
+ <a
145
+ href={`#${heading.slug}`}
146
+ class={`block text-[12px] py-0.5 ${heading.depth === 1 ? 'font-light' : ''} text-[rgb(var(--ec-page-text-muted))] hover:text-[rgb(var(--ec-page-text))]`}
147
+ style={`padding-left: ${(heading.depth - 1) * 8}px`}
148
+ >
149
+ {heading.text}
150
+ </a>
151
+ );
152
+ })
153
+ }
154
+ </nav>
155
+ <div class="space-y-2 pb-4">
156
+ <span class="text-xs text-[rgb(var(--ec-page-text))] font-semibold capitalize">Versions ({versions.length})</span>
157
+ <ul role="list" class="space-y-2">
158
+ {
159
+ versions.map((version: string) => (
160
+ <li class="version-item rounded-md px-1 group w-full">
161
+ <a class="flex items-center space-x-2" href={buildUrl(`${docsBasePath}/${encodeURIComponent(version)}`)}>
162
+ <HistoryIcon
163
+ className="h-4 w-4 text-[rgb(var(--ec-page-text-muted))] group-hover:text-[rgb(var(--ec-accent-text))]"
164
+ strokeWidth={1}
165
+ />
166
+ <span
167
+ class={`font-light text-xs text-[rgb(var(--ec-page-text))] group-hover:text-[rgb(var(--ec-accent-text))] ${
168
+ version === props.data.version ? 'underline' : ''
169
+ }`}
170
+ >
171
+ {version === props.data.latestVersion ? `v${version} (latest)` : `v${version}`}
172
+ </span>
173
+ </a>
174
+ </li>
175
+ ))
176
+ }
177
+ </ul>
178
+ <div class="border-b border-[rgb(var(--ec-page-border))] pt-2"></div>
179
+ </div>
180
+ </div>
181
+ </aside>
182
+ </div>
183
+ </main>
184
+ </VerticalSideBarLayout>
185
+
186
+ <style is:global>
187
+ .docs-layout .prose {
188
+ max-width: none;
189
+ overflow: auto;
190
+ }
191
+
192
+ .version-item:hover {
193
+ background: linear-gradient(to left, rgb(var(--ec-accent-gradient-from)), rgb(var(--ec-accent-gradient-to)));
194
+ }
195
+ </style>