@eventcatalog/core 4.2.4 → 4.2.5

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.
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "4.2.4";
39
+ var version = "4.2.5";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-BXEGST4Z.js";
4
- import "../chunk-J2MVHSKA.js";
3
+ } from "../chunk-7JCTB2SM.js";
4
+ import "../chunk-EU4BANDV.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
140
140
  var import_os = __toESM(require("os"), 1);
141
141
 
142
142
  // package.json
143
- var version = "4.2.4";
143
+ var version = "4.2.5";
144
144
 
145
145
  // src/constants.ts
146
146
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-GCEFDCZB.js";
3
+ } from "../chunk-R5HOP2PF.js";
4
4
  import "../chunk-K2XIENVT.js";
5
- import "../chunk-BXEGST4Z.js";
6
- import "../chunk-J2MVHSKA.js";
5
+ import "../chunk-7JCTB2SM.js";
6
+ import "../chunk-EU4BANDV.js";
7
7
  import "../chunk-6QENHZZP.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-J2MVHSKA.js";
3
+ } from "./chunk-EU4BANDV.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "4.2.4";
2
+ var version = "4.2.5";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-5MIGBCON.js";
3
+ } from "./chunk-JB6RZSTL.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-J2MVHSKA.js";
3
+ } from "./chunk-EU4BANDV.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-K2XIENVT.js";
5
5
  import {
6
6
  raiseEvent
7
- } from "./chunk-BXEGST4Z.js";
7
+ } from "./chunk-7JCTB2SM.js";
8
8
  import {
9
9
  getEventCatalogConfigFile,
10
10
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "4.2.4";
28
+ var version = "4.2.5";
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-J2MVHSKA.js";
3
+ } from "./chunk-EU4BANDV.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -51,8 +51,8 @@ The easiest way to do this is to use [a docker container](/docs/development/depl
51
51
 
52
52
  ## Loading indicator
53
53
 
54
- <AddedIn version="4.2.4" />
54
+ <AddedIn version="4.2.5" />
55
55
 
56
56
  Server-side rendering means a page's render time depends on your server, so navigations can occasionally take longer than a static build.
57
57
 
58
- EventCatalog shows a thin progress bar at the top of the page during navigations that take longer than 200ms, so the catalog never looks unresponsive. It works automatically and needs no configuration.
58
+ EventCatalog shows a thin progress bar at the top of the page during navigations that take longer than 200ms, so the catalog never looks unresponsive. It works automatically and needs no configuration.
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
144
144
  var import_picocolors = __toESM(require("picocolors"), 1);
145
145
 
146
146
  // package.json
147
- var version = "4.2.4";
147
+ var version = "4.2.5";
148
148
 
149
149
  // src/constants.ts
150
150
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log_build_default
3
- } from "./chunk-GCEFDCZB.js";
3
+ } from "./chunk-R5HOP2PF.js";
4
4
  import "./chunk-K2XIENVT.js";
5
5
  import {
6
6
  runMigrations
@@ -14,10 +14,10 @@ import {
14
14
  } from "./chunk-B7HCX5HM.js";
15
15
  import {
16
16
  generate
17
- } from "./chunk-WVIOZDVK.js";
17
+ } from "./chunk-FXSZNWHH.js";
18
18
  import {
19
19
  logger
20
- } from "./chunk-5MIGBCON.js";
20
+ } from "./chunk-JB6RZSTL.js";
21
21
  import {
22
22
  resolve_catalog_dependencies_default
23
23
  } from "./chunk-LHR4G2UO.js";
@@ -27,7 +27,7 @@ import {
27
27
  import {
28
28
  watch
29
29
  } from "./chunk-CAJUIMDJ.js";
30
- import "./chunk-BXEGST4Z.js";
30
+ import "./chunk-7JCTB2SM.js";
31
31
  import {
32
32
  createAstroDevLineFilter,
33
33
  createAstroLineFilter
@@ -38,7 +38,7 @@ import {
38
38
  import "./chunk-W5JQON7Z.js";
39
39
  import {
40
40
  VERSION
41
- } from "./chunk-J2MVHSKA.js";
41
+ } from "./chunk-EU4BANDV.js";
42
42
  import {
43
43
  linkCoreNodeModules,
44
44
  resolveInstalledCoreNodeModules
package/dist/generate.cjs CHANGED
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
108
108
  var import_picocolors = __toESM(require("picocolors"), 1);
109
109
 
110
110
  // package.json
111
- var version = "4.2.4";
111
+ var version = "4.2.5";
112
112
 
113
113
  // src/constants.ts
114
114
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-WVIOZDVK.js";
4
- import "./chunk-5MIGBCON.js";
5
- import "./chunk-J2MVHSKA.js";
3
+ } from "./chunk-FXSZNWHH.js";
4
+ import "./chunk-JB6RZSTL.js";
5
+ import "./chunk-EU4BANDV.js";
6
6
  import "./chunk-6QENHZZP.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 = "4.2.4";
39
+ var version = "4.2.5";
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-5MIGBCON.js";
4
- import "../chunk-J2MVHSKA.js";
3
+ } from "../chunk-JB6RZSTL.js";
4
+ import "../chunk-EU4BANDV.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -0,0 +1,64 @@
1
+ <div id="navigation-progress-container" transition:persist="navigation-progress">
2
+ <div id="navigation-progress" role="progressbar" aria-label="Loading page" aria-hidden="true" data-visible="false">
3
+ <div class="navigation-progress__bar"></div>
4
+ </div>
5
+ <span id="navigation-progress-status" class="sr-only" role="status" aria-live="polite" aria-atomic="true"></span>
6
+ </div>
7
+
8
+ <style>
9
+ #navigation-progress {
10
+ position: fixed;
11
+ inset: 0 0 auto;
12
+ z-index: 100;
13
+ height: 3px;
14
+ overflow: hidden;
15
+ pointer-events: none;
16
+ background: rgb(var(--ec-accent) / 0.14);
17
+ opacity: 0;
18
+ transition: opacity 120ms ease;
19
+ }
20
+
21
+ #navigation-progress[data-visible='true'] {
22
+ opacity: 1;
23
+ }
24
+
25
+ .navigation-progress__bar {
26
+ width: 35%;
27
+ height: 100%;
28
+ background: rgb(var(--ec-accent));
29
+ box-shadow: 0 0 10px rgb(var(--ec-accent) / 0.55);
30
+ animation: navigation-progress 1.1s ease-in-out infinite;
31
+ }
32
+
33
+ :global([data-navigation-pending='true']) {
34
+ cursor: progress;
35
+ }
36
+
37
+ @keyframes navigation-progress {
38
+ from {
39
+ transform: translateX(-110%);
40
+ }
41
+
42
+ to {
43
+ transform: translateX(395%);
44
+ }
45
+ }
46
+
47
+ @media (prefers-reduced-motion: reduce) {
48
+ #navigation-progress {
49
+ transition: none;
50
+ }
51
+
52
+ .navigation-progress__bar {
53
+ width: 100%;
54
+ animation: none;
55
+ opacity: 0.75;
56
+ }
57
+ }
58
+ </style>
59
+
60
+ <script>
61
+ import { initializeNavigationProgress } from './navigation-progress';
62
+
63
+ initializeNavigationProgress();
64
+ </script>
@@ -0,0 +1,68 @@
1
+ // @vitest-environment jsdom
2
+
3
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
4
+ import { initializeNavigationProgress } from './navigation-progress';
5
+
6
+ const dispatchNavigationEvent = (name: string, sourceElement?: HTMLElement) => {
7
+ const event = new Event(name) as Event & { sourceElement?: HTMLElement };
8
+ event.sourceElement = sourceElement;
9
+ document.dispatchEvent(event);
10
+ };
11
+
12
+ describe('navigation progress', () => {
13
+ let cleanup: () => void;
14
+
15
+ beforeEach(() => {
16
+ vi.useFakeTimers();
17
+ document.body.innerHTML = `
18
+ <a id="navigation-link" href="/next">Next page</a>
19
+ <div id="navigation-progress" data-visible="false" aria-hidden="true"></div>
20
+ <span id="navigation-progress-status"></span>
21
+ <main id="content"></main>
22
+ `;
23
+ cleanup = initializeNavigationProgress();
24
+ });
25
+
26
+ afterEach(() => {
27
+ cleanup();
28
+ vi.useRealTimers();
29
+ });
30
+
31
+ it('does not show the indicator for fast navigations', () => {
32
+ const link = document.getElementById('navigation-link')!;
33
+
34
+ dispatchNavigationEvent('astro:before-preparation', link);
35
+ vi.advanceTimersByTime(199);
36
+ dispatchNavigationEvent('astro:after-preparation');
37
+ vi.runAllTimers();
38
+
39
+ expect(document.getElementById('navigation-progress')?.dataset.visible).toBe('false');
40
+ expect(link.hasAttribute('aria-busy')).toBe(false);
41
+ expect(document.getElementById('content')?.hasAttribute('aria-busy')).toBe(false);
42
+ });
43
+
44
+ it('shows accessible pending state during slow navigations', () => {
45
+ const link = document.getElementById('navigation-link')!;
46
+
47
+ dispatchNavigationEvent('astro:before-preparation', link);
48
+ expect(link.getAttribute('aria-busy')).toBe('true');
49
+ expect(link.dataset.navigationPending).toBe('true');
50
+
51
+ vi.advanceTimersByTime(200);
52
+
53
+ expect(document.getElementById('navigation-progress')?.dataset.visible).toBe('true');
54
+ expect(document.getElementById('navigation-progress')?.getAttribute('aria-hidden')).toBe('false');
55
+ expect(document.getElementById('content')?.getAttribute('aria-busy')).toBe('true');
56
+ expect(document.getElementById('navigation-progress-status')?.textContent).toBe('Loading page');
57
+
58
+ dispatchNavigationEvent('astro:after-preparation');
59
+ vi.advanceTimersByTime(249);
60
+ expect(document.getElementById('navigation-progress')?.dataset.visible).toBe('true');
61
+
62
+ vi.advanceTimersByTime(1);
63
+ expect(document.getElementById('navigation-progress')?.dataset.visible).toBe('false');
64
+ expect(link.hasAttribute('data-navigation-pending')).toBe(false);
65
+ expect(document.getElementById('content')?.hasAttribute('aria-busy')).toBe(false);
66
+ expect(document.getElementById('navigation-progress-status')?.textContent).toBe('');
67
+ });
68
+ });
@@ -0,0 +1,98 @@
1
+ const SHOW_DELAY_MS = 200;
2
+ const MINIMUM_VISIBLE_MS = 250;
3
+
4
+ type NavigationPreparationEvent = Event & {
5
+ sourceElement?: EventTarget | null;
6
+ };
7
+
8
+ export const initializeNavigationProgress = () => {
9
+ let showTimer: ReturnType<typeof setTimeout> | undefined;
10
+ let hideTimer: ReturnType<typeof setTimeout> | undefined;
11
+ let visibleAt = 0;
12
+ let pendingSource: HTMLElement | null = null;
13
+
14
+ const getProgress = () => document.getElementById('navigation-progress');
15
+ const getStatus = () => document.getElementById('navigation-progress-status');
16
+
17
+ const clearPendingSource = () => {
18
+ pendingSource?.removeAttribute('aria-busy');
19
+ pendingSource?.removeAttribute('data-navigation-pending');
20
+ pendingSource = null;
21
+ };
22
+
23
+ const showProgress = () => {
24
+ const progress = getProgress();
25
+ if (!progress) return;
26
+
27
+ visibleAt = performance.now();
28
+ progress.dataset.visible = 'true';
29
+ progress.setAttribute('aria-hidden', 'false');
30
+ document.getElementById('content')?.setAttribute('aria-busy', 'true');
31
+
32
+ const status = getStatus();
33
+ if (status) status.textContent = 'Loading page';
34
+ };
35
+
36
+ const hideProgress = () => {
37
+ const progress = getProgress();
38
+ if (progress) {
39
+ progress.dataset.visible = 'false';
40
+ progress.setAttribute('aria-hidden', 'true');
41
+ }
42
+
43
+ document.getElementById('content')?.removeAttribute('aria-busy');
44
+ const status = getStatus();
45
+ if (status) status.textContent = '';
46
+
47
+ clearPendingSource();
48
+ visibleAt = 0;
49
+ hideTimer = undefined;
50
+ };
51
+
52
+ const startProgress = (event: NavigationPreparationEvent) => {
53
+ if (showTimer) clearTimeout(showTimer);
54
+ if (hideTimer) clearTimeout(hideTimer);
55
+
56
+ clearPendingSource();
57
+
58
+ if (event.sourceElement instanceof HTMLElement) {
59
+ pendingSource = event.sourceElement;
60
+ pendingSource.setAttribute('aria-busy', 'true');
61
+ pendingSource.dataset.navigationPending = 'true';
62
+ }
63
+
64
+ showTimer = setTimeout(showProgress, SHOW_DELAY_MS);
65
+ };
66
+
67
+ const finishProgress = () => {
68
+ if (showTimer) {
69
+ clearTimeout(showTimer);
70
+ showTimer = undefined;
71
+ }
72
+
73
+ if (!visibleAt) {
74
+ hideProgress();
75
+ return;
76
+ }
77
+
78
+ const remainingVisibleTime = Math.max(0, MINIMUM_VISIBLE_MS - (performance.now() - visibleAt));
79
+ hideTimer = setTimeout(hideProgress, remainingVisibleTime);
80
+ };
81
+
82
+ const resetProgress = () => {
83
+ if (!showTimer && !hideTimer && !visibleAt) hideProgress();
84
+ };
85
+
86
+ document.addEventListener('astro:before-preparation', startProgress);
87
+ document.addEventListener('astro:after-preparation', finishProgress);
88
+ document.addEventListener('astro:page-load', resetProgress);
89
+
90
+ return () => {
91
+ if (showTimer) clearTimeout(showTimer);
92
+ if (hideTimer) clearTimeout(hideTimer);
93
+ hideProgress();
94
+ document.removeEventListener('astro:before-preparation', startProgress);
95
+ document.removeEventListener('astro:after-preparation', finishProgress);
96
+ document.removeEventListener('astro:page-load', resetProgress);
97
+ };
98
+ };
@@ -2,6 +2,7 @@
2
2
  import SEO from '../components/Seo.astro';
3
3
  import AnalyticsHead from '../enterprise/analytics/components/AnalyticsHead.astro';
4
4
  import AnalyticsTracker from '../enterprise/analytics/components/AnalyticsTracker.astro';
5
+ import NavigationProgress from '../components/NavigationProgress.astro';
5
6
  import config from '@config';
6
7
 
7
8
  interface Props {
@@ -46,6 +47,7 @@ const catalogTheme = config.theme || 'default';
46
47
  <slot name="head" />
47
48
  </head>
48
49
  <body>
50
+ <NavigationProgress />
49
51
  <slot />
50
52
  <AnalyticsTracker />
51
53
  </body>
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "4.2.4",
10
+ "version": "4.2.5",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -116,9 +116,9 @@
116
116
  "update-notifier": "^7.3.1",
117
117
  "uuid": "^10.0.0",
118
118
  "zod": "^4.3.6",
119
- "@eventcatalog/sdk": "2.26.1",
119
+ "@eventcatalog/visualiser": "^4.1.0",
120
120
  "@eventcatalog/linter": "1.1.6",
121
- "@eventcatalog/visualiser": "^4.1.0"
121
+ "@eventcatalog/sdk": "2.26.1"
122
122
  },
123
123
  "devDependencies": {
124
124
  "@astrojs/check": "^0.9.9",