riksdagsmonitor 0.8.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.
Files changed (40) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +999 -0
  3. package/SECURITY.md +154 -0
  4. package/dist/lib/chart-factory.d.ts +45 -0
  5. package/dist/lib/chart-factory.d.ts.map +1 -0
  6. package/dist/lib/chart-factory.js +220 -0
  7. package/dist/lib/chart-factory.js.map +1 -0
  8. package/dist/lib/data-loader.d.ts +44 -0
  9. package/dist/lib/data-loader.d.ts.map +1 -0
  10. package/dist/lib/data-loader.js +159 -0
  11. package/dist/lib/data-loader.js.map +1 -0
  12. package/dist/lib/dom-utils.d.ts +58 -0
  13. package/dist/lib/dom-utils.d.ts.map +1 -0
  14. package/dist/lib/dom-utils.js +153 -0
  15. package/dist/lib/dom-utils.js.map +1 -0
  16. package/dist/lib/error-boundary.d.ts +43 -0
  17. package/dist/lib/error-boundary.d.ts.map +1 -0
  18. package/dist/lib/error-boundary.js +101 -0
  19. package/dist/lib/error-boundary.js.map +1 -0
  20. package/dist/lib/fallback-ui.d.ts +28 -0
  21. package/dist/lib/fallback-ui.d.ts.map +1 -0
  22. package/dist/lib/fallback-ui.js +65 -0
  23. package/dist/lib/fallback-ui.js.map +1 -0
  24. package/dist/lib/index.d.ts +20 -0
  25. package/dist/lib/index.d.ts.map +1 -0
  26. package/dist/lib/index.js +20 -0
  27. package/dist/lib/index.js.map +1 -0
  28. package/dist/lib/logger.d.ts +19 -0
  29. package/dist/lib/logger.d.ts.map +1 -0
  30. package/dist/lib/logger.js +31 -0
  31. package/dist/lib/logger.js.map +1 -0
  32. package/dist/lib/theme.d.ts +107 -0
  33. package/dist/lib/theme.d.ts.map +1 -0
  34. package/dist/lib/theme.js +207 -0
  35. package/dist/lib/theme.js.map +1 -0
  36. package/dist/lib/types.d.ts +95 -0
  37. package/dist/lib/types.d.ts.map +1 -0
  38. package/dist/lib/types.js +14 -0
  39. package/dist/lib/types.js.map +1 -0
  40. package/package.json +140 -0
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @module Shared/DomUtils
3
+ * @description Shared DOM utility functions for dashboard components.
4
+ * Provides loading states, error display, and accessibility helpers.
5
+
6
+ *
7
+ * @intelligence Intelligence presentation layer — standardized loading states, error recovery displays, and accessibility helpers ensuring WCAG 2.1 AA compliance across all intelligence dashboard components.
8
+ *
9
+ * @business User experience consistency — loading skeletons and error states prevent user frustration during data acquisition. Accessibility compliance (WCAG 2.1 AA) is a legal requirement for government clients and a competitive advantage.
10
+ *
11
+ * @marketing Inclusive design asset — accessibility compliance enables marketing to government agencies (mandatory WCAG requirement), educational institutions, and disability advocacy organizations. Demonstrates corporate social responsibility.
12
+ * */
13
+ /**
14
+ * Show a loading spinner overlay inside a container.
15
+ */
16
+ export declare function showLoadingState(container: HTMLElement, message?: string): void;
17
+ /**
18
+ * Show an empty state message inside a container.
19
+ */
20
+ export declare function showEmptyState(container: HTMLElement, message?: string): void;
21
+ /**
22
+ * Show an error state message inside a container.
23
+ */
24
+ export declare function showErrorState(container: HTMLElement, message?: string): void;
25
+ /**
26
+ * Hide all state overlays in a container.
27
+ */
28
+ export declare function hideStateOverlays(container: HTMLElement): void;
29
+ /**
30
+ * Format a number with locale-appropriate separators.
31
+ */
32
+ export declare function formatNumber(value: number, locale?: string): string;
33
+ /**
34
+ * Format a number as percentage.
35
+ */
36
+ export declare function formatPercent(value: number, decimals?: number): string;
37
+ /**
38
+ * Debounce a function call.
39
+ */
40
+ export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
41
+ /**
42
+ * Detect the current page language from the HTML lang attribute.
43
+ */
44
+ export declare function detectLanguage(): string;
45
+ /**
46
+ * Data source type for dashboard disclaimers.
47
+ */
48
+ export type DataSourceType = 'live' | 'synthetic' | 'mock';
49
+ /**
50
+ * Show a data source disclaimer banner inside a dashboard container.
51
+ * Informs users whether data is live CSV, synthetic fallback, or mock.
52
+ */
53
+ export declare function showDataSourceDisclaimer(container: HTMLElement, sourceType: DataSourceType): void;
54
+ /**
55
+ * Announce a data point to screen readers via live region.
56
+ */
57
+ export declare function announceToScreenReader(message: string): void;
58
+ //# sourceMappingURL=dom-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-utils.d.ts","sourceRoot":"","sources":["../../src/browser/shared/dom-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAEL;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,SAAoB,GAAG,IAAI,CAe1F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,SAAsB,GAAG,IAAI,CAW1F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,SAAwB,GAAG,IAAI,CAY5F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,CAK9D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAU,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,EAC7D,EAAE,EAAE,CAAC,EACL,KAAK,EAAE,MAAM,GACZ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAMlC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAID;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,WAAW,EACtB,UAAU,EAAE,cAAc,GACzB,IAAI,CAoCN;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAW5D"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * @module Shared/DomUtils
3
+ * @description Shared DOM utility functions for dashboard components.
4
+ * Provides loading states, error display, and accessibility helpers.
5
+
6
+ *
7
+ * @intelligence Intelligence presentation layer — standardized loading states, error recovery displays, and accessibility helpers ensuring WCAG 2.1 AA compliance across all intelligence dashboard components.
8
+ *
9
+ * @business User experience consistency — loading skeletons and error states prevent user frustration during data acquisition. Accessibility compliance (WCAG 2.1 AA) is a legal requirement for government clients and a competitive advantage.
10
+ *
11
+ * @marketing Inclusive design asset — accessibility compliance enables marketing to government agencies (mandatory WCAG requirement), educational institutions, and disability advocacy organizations. Demonstrates corporate social responsibility.
12
+ * */
13
+ /**
14
+ * Show a loading spinner overlay inside a container.
15
+ */
16
+ export function showLoadingState(container, message = 'Loading data...') {
17
+ let overlay = container.querySelector('.chart-loading-overlay');
18
+ if (!overlay) {
19
+ overlay = document.createElement('div');
20
+ overlay.className = 'chart-loading-overlay';
21
+ overlay.setAttribute('role', 'status');
22
+ overlay.setAttribute('aria-live', 'polite');
23
+ container.style.position = 'relative';
24
+ container.appendChild(overlay);
25
+ }
26
+ overlay.innerHTML = `
27
+ <div class="loading-spinner" aria-hidden="true"></div>
28
+ <p>${message}</p>
29
+ `;
30
+ overlay.style.display = 'flex';
31
+ }
32
+ /**
33
+ * Show an empty state message inside a container.
34
+ */
35
+ export function showEmptyState(container, message = 'No data available') {
36
+ let overlay = container.querySelector('.chart-loading-overlay');
37
+ if (!overlay) {
38
+ overlay = document.createElement('div');
39
+ overlay.className = 'chart-loading-overlay';
40
+ overlay.setAttribute('role', 'status');
41
+ container.style.position = 'relative';
42
+ container.appendChild(overlay);
43
+ }
44
+ overlay.innerHTML = `<p class="empty-message">${message}</p>`;
45
+ overlay.style.display = 'flex';
46
+ }
47
+ /**
48
+ * Show an error state message inside a container.
49
+ */
50
+ export function showErrorState(container, message = 'Failed to load data') {
51
+ let overlay = container.querySelector('.chart-loading-overlay');
52
+ if (!overlay) {
53
+ overlay = document.createElement('div');
54
+ overlay.className = 'chart-loading-overlay';
55
+ overlay.setAttribute('role', 'status');
56
+ overlay.setAttribute('aria-live', 'assertive');
57
+ container.style.position = 'relative';
58
+ container.appendChild(overlay);
59
+ }
60
+ overlay.innerHTML = `<p class="error-message" role="alert">${message}</p>`;
61
+ overlay.style.display = 'flex';
62
+ }
63
+ /**
64
+ * Hide all state overlays in a container.
65
+ */
66
+ export function hideStateOverlays(container) {
67
+ const overlay = container.querySelector('.chart-loading-overlay');
68
+ if (overlay) {
69
+ overlay.style.display = 'none';
70
+ }
71
+ }
72
+ /**
73
+ * Format a number with locale-appropriate separators.
74
+ */
75
+ export function formatNumber(value, locale = 'sv-SE') {
76
+ return new Intl.NumberFormat(locale).format(value);
77
+ }
78
+ /**
79
+ * Format a number as percentage.
80
+ */
81
+ export function formatPercent(value, decimals = 1) {
82
+ return `${value.toFixed(decimals)}%`;
83
+ }
84
+ /**
85
+ * Debounce a function call.
86
+ */
87
+ export function debounce(fn, delay) {
88
+ let timer;
89
+ return (...args) => {
90
+ clearTimeout(timer);
91
+ timer = setTimeout(() => fn(...args), delay);
92
+ };
93
+ }
94
+ /**
95
+ * Detect the current page language from the HTML lang attribute.
96
+ */
97
+ export function detectLanguage() {
98
+ return document.documentElement.lang || 'en';
99
+ }
100
+ /**
101
+ * Show a data source disclaimer banner inside a dashboard container.
102
+ * Informs users whether data is live CSV, synthetic fallback, or mock.
103
+ */
104
+ export function showDataSourceDisclaimer(container, sourceType) {
105
+ // Remove any existing disclaimer in this container
106
+ const existing = container.querySelector('.data-source-disclaimer');
107
+ if (existing)
108
+ existing.remove();
109
+ const disclaimer = document.createElement('div');
110
+ disclaimer.className = `data-source-disclaimer data-source-${sourceType}`;
111
+ disclaimer.setAttribute('role', 'status');
112
+ let icon;
113
+ let text;
114
+ switch (sourceType) {
115
+ case 'live':
116
+ icon = '✅';
117
+ text = 'Live data loaded from CIA Platform CSV exports';
118
+ break;
119
+ case 'synthetic':
120
+ icon = '⚠️';
121
+ text = 'Synthetic fallback data — live CSV sources unavailable';
122
+ break;
123
+ case 'mock':
124
+ icon = '🔧';
125
+ text = 'Mock demonstration data — not based on real parliamentary records';
126
+ break;
127
+ }
128
+ disclaimer.textContent = `${icon} ${text}`;
129
+ // Insert after the first heading if present, otherwise at the top of the container
130
+ const heading = container.querySelector('h2, h3');
131
+ if (heading) {
132
+ heading.insertAdjacentElement('afterend', disclaimer);
133
+ }
134
+ else {
135
+ container.prepend(disclaimer);
136
+ }
137
+ }
138
+ /**
139
+ * Announce a data point to screen readers via live region.
140
+ */
141
+ export function announceToScreenReader(message) {
142
+ let region = document.getElementById('sr-announcements');
143
+ if (!region) {
144
+ region = document.createElement('div');
145
+ region.id = 'sr-announcements';
146
+ region.setAttribute('role', 'status');
147
+ region.setAttribute('aria-live', 'polite');
148
+ region.className = 'sr-only';
149
+ document.body.appendChild(region);
150
+ }
151
+ region.textContent = message;
152
+ }
153
+ //# sourceMappingURL=dom-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-utils.js","sourceRoot":"","sources":["../../src/browser/shared/dom-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAEL;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAsB,EAAE,OAAO,GAAG,iBAAiB;IAClF,IAAI,OAAO,GAAG,SAAS,CAAC,aAAa,CAAC,wBAAwB,CAAuB,CAAC;IACtF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,CAAC,SAAS,GAAG,uBAAuB,CAAC;QAC5C,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACvC,OAAO,CAA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AI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,EAAE,GAAG,kBAAkB,CAAC;QAC/B,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACtC,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAC3C,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @module Shared/ErrorBoundary
3
+ * @description Centralized error boundary pattern for browser-side dashboard components.
4
+ * Prevents individual component failures from breaking the entire page by wrapping
5
+ * render functions with error catching, fallback UI, and optional retry logic.
6
+ *
7
+ * @intelligence Intelligence platform resilience layer — each dashboard panel is isolated
8
+ * so a single data-source failure never cascades to the rest of the page. Retry logic
9
+ * maximises successful data acquisition from unstable government APIs.
10
+ *
11
+ * @business Platform reliability — isolated component failures improve perceived
12
+ * reliability and reduce support incidents. Automatic retry reduces manual page refreshes
13
+ * and keeps users engaged with available data.
14
+ *
15
+ * @marketing Enterprise readiness signal — graceful degradation and structured error
16
+ * handling demonstrate production quality to government and enterprise prospects.
17
+ */
18
+ /**
19
+ * Localised labels for the loading and error states produced by
20
+ * {@link renderWithFallback}. Both fields are optional; English defaults
21
+ * are used when omitted so the API remains backwards-compatible.
22
+ */
23
+ export interface RenderWithFallbackOptions {
24
+ /** ARIA label announced by screen readers while the skeleton is visible. */
25
+ readonly loadingLabel?: string;
26
+ /** Text shown on the retry button in the error card. */
27
+ readonly retryLabel?: string;
28
+ }
29
+ /**
30
+ * Wrap a synchronous or asynchronous render function with an error boundary.
31
+ *
32
+ * - Shows a loading skeleton while an async render is in progress.
33
+ * - On success the container is left with whatever the render function produced.
34
+ * - On failure the container shows an error card with an optional retry button.
35
+ * - Each retry re-runs the full renderFn.
36
+ *
37
+ * @param container - Target DOM element that will receive the rendered output.
38
+ * @param renderFn - Function (sync or async) that populates `container`.
39
+ * @param fallbackMessage - Human-readable message shown in the error card.
40
+ * @param options - Optional localised labels for the loading/error states.
41
+ */
42
+ export declare function renderWithFallback(container: HTMLElement, renderFn: () => void | Promise<void>, fallbackMessage?: string, options?: RenderWithFallbackOptions): Promise<void>;
43
+ //# sourceMappingURL=error-boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../src/browser/shared/error-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,wDAAwD;IACxD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EACpC,eAAe,SAAiC,EAChD,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,IAAI,CAAC,CA0Ef"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @module Shared/ErrorBoundary
3
+ * @description Centralized error boundary pattern for browser-side dashboard components.
4
+ * Prevents individual component failures from breaking the entire page by wrapping
5
+ * render functions with error catching, fallback UI, and optional retry logic.
6
+ *
7
+ * @intelligence Intelligence platform resilience layer — each dashboard panel is isolated
8
+ * so a single data-source failure never cascades to the rest of the page. Retry logic
9
+ * maximises successful data acquisition from unstable government APIs.
10
+ *
11
+ * @business Platform reliability — isolated component failures improve perceived
12
+ * reliability and reduce support incidents. Automatic retry reduces manual page refreshes
13
+ * and keeps users engaged with available data.
14
+ *
15
+ * @marketing Enterprise readiness signal — graceful degradation and structured error
16
+ * handling demonstrate production quality to government and enterprise prospects.
17
+ */
18
+ import { logger } from './logger.js';
19
+ import { renderErrorFallback, renderLoadingFallback } from './fallback-ui.js';
20
+ /**
21
+ * Wrap a synchronous or asynchronous render function with an error boundary.
22
+ *
23
+ * - Shows a loading skeleton while an async render is in progress.
24
+ * - On success the container is left with whatever the render function produced.
25
+ * - On failure the container shows an error card with an optional retry button.
26
+ * - Each retry re-runs the full renderFn.
27
+ *
28
+ * @param container - Target DOM element that will receive the rendered output.
29
+ * @param renderFn - Function (sync or async) that populates `container`.
30
+ * @param fallbackMessage - Human-readable message shown in the error card.
31
+ * @param options - Optional localised labels for the loading/error states.
32
+ */
33
+ export async function renderWithFallback(container, renderFn, fallbackMessage = 'Data temporarily unavailable', options = {}) {
34
+ // Snapshot original markup so retry attempts can restore pre-existing DOM
35
+ // elements (e.g. <canvas> elements) that renderFn depends on.
36
+ // Note: restore uses innerHTML, so child element references held by callers
37
+ // are not preserved across retries — they will point to recreated nodes.
38
+ const originalHTML = container.innerHTML;
39
+ let inFlight = false;
40
+ let isFirstAttempt = true;
41
+ const attempt = async () => {
42
+ if (inFlight) {
43
+ // Prevent overlapping attempts that could cause race conditions.
44
+ return;
45
+ }
46
+ inFlight = true;
47
+ // On retry, restore the original markup so any required child elements
48
+ // (e.g. <canvas> targets) are present for the re-render. The first
49
+ // attempt skips this to preserve existing DOM element references held
50
+ // by the caller.
51
+ if (!isFirstAttempt) {
52
+ container.innerHTML = originalHTML;
53
+ }
54
+ isFirstAttempt = false;
55
+ // Append a dedicated loading overlay so the skeleton stays visible while
56
+ // the async render is in progress without destroying required children.
57
+ const loadingOverlay = document.createElement('div');
58
+ loadingOverlay.setAttribute('data-error-boundary-loading', 'true');
59
+ loadingOverlay.setAttribute('aria-busy', 'true');
60
+ loadingOverlay.className = 'error-boundary-loading-overlay';
61
+ // Ensure the container provides a positioning context for the overlay.
62
+ // Capture the prior inline value so it can be restored in the finally block.
63
+ const priorInlinePosition = container.style.position;
64
+ const currentPosition = getComputedStyle(container).position;
65
+ if (currentPosition === '' || currentPosition === 'static') {
66
+ container.style.position = 'relative';
67
+ }
68
+ // Style the overlay to cover the container without affecting layout.
69
+ loadingOverlay.style.position = 'absolute';
70
+ loadingOverlay.style.top = '0';
71
+ loadingOverlay.style.right = '0';
72
+ loadingOverlay.style.bottom = '0';
73
+ loadingOverlay.style.left = '0';
74
+ loadingOverlay.style.display = 'flex';
75
+ loadingOverlay.style.alignItems = 'center';
76
+ loadingOverlay.style.justifyContent = 'center';
77
+ loadingOverlay.style.zIndex = '1';
78
+ loadingOverlay.style.pointerEvents = 'none';
79
+ renderLoadingFallback(loadingOverlay, options.loadingLabel);
80
+ container.appendChild(loadingOverlay);
81
+ try {
82
+ await Promise.resolve(renderFn());
83
+ }
84
+ catch (err) {
85
+ logger.error('[ErrorBoundary] Render failed:', err);
86
+ renderErrorFallback(container, fallbackMessage, attempt, options.retryLabel);
87
+ }
88
+ finally {
89
+ // Remove the overlay once the attempt finishes (success or failure).
90
+ if (loadingOverlay.parentNode === container) {
91
+ container.removeChild(loadingOverlay);
92
+ }
93
+ // Restore the container's original inline position value to avoid
94
+ // permanently altering its stacking context after the overlay is gone.
95
+ container.style.position = priorInlinePosition;
96
+ inFlight = false;
97
+ }
98
+ };
99
+ await attempt();
100
+ }
101
+ //# sourceMappingURL=error-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-boundary.js","sourceRoot":"","sources":["../../src/browser/shared/error-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAc9E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,SAAsB,EACtB,QAAoC,EACpC,eA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fallback UI renderers for dashboard error and loading states.
4
+ * Provides consistent error and loading state presentation with optional retry capability.
5
+ *
6
+ * @intelligence Intelligence platform resilience layer — standardised fallback states
7
+ * (error cards, loading skeletons) ensure uninterrupted intelligence consumption even when
8
+ * individual data sources fail. Each component degrades gracefully without disrupting other
9
+ * dashboard panels.
10
+ *
11
+ * @business User experience consistency — unified error and loading states prevent user
12
+ * frustration and reduce support requests. Retry buttons maximise data recovery rate.
13
+ *
14
+ * @marketing Developer experience asset — reusable fallback components reduce time-to-market
15
+ * for new dashboard panels and maintain visual consistency across all 14 language variants.
16
+ */
17
+ /**
18
+ * Replace the contents of `container` with an accessible error card.
19
+ * An optional `retryFn` receives a retry button the user can click.
20
+ * An optional `retryLabel` overrides the default "Retry" button text for localised UIs.
21
+ */
22
+ export declare function renderErrorFallback(container: HTMLElement, message?: string, retryFn?: () => void, retryLabel?: string): void;
23
+ /**
24
+ * Replace the contents of `container` with a CSS-only skeleton loading animation.
25
+ * The optional `loadingLabel` allows localized ARIA text for screen readers.
26
+ */
27
+ export declare function renderLoadingFallback(container: HTMLElement, loadingLabel?: string): void;
28
+ //# sourceMappingURL=fallback-ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallback-ui.d.ts","sourceRoot":"","sources":["../../src/browser/shared/fallback-ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,WAAW,EACtB,OAAO,SAAiC,EACxC,OAAO,CAAC,EAAE,MAAM,IAAI,EACpB,UAAU,SAAU,GACnB,IAAI,CA8BN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,WAAW,EAAE,YAAY,SAAa,GAAG,IAAI,CAgB7F"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @module Shared/FallbackUI
3
+ * @description Centralized fallback UI renderers for dashboard error and loading states.
4
+ * Provides consistent error and loading state presentation with optional retry capability.
5
+ *
6
+ * @intelligence Intelligence platform resilience layer — standardised fallback states
7
+ * (error cards, loading skeletons) ensure uninterrupted intelligence consumption even when
8
+ * individual data sources fail. Each component degrades gracefully without disrupting other
9
+ * dashboard panels.
10
+ *
11
+ * @business User experience consistency — unified error and loading states prevent user
12
+ * frustration and reduce support requests. Retry buttons maximise data recovery rate.
13
+ *
14
+ * @marketing Developer experience asset — reusable fallback components reduce time-to-market
15
+ * for new dashboard panels and maintain visual consistency across all 14 language variants.
16
+ */
17
+ /**
18
+ * Replace the contents of `container` with an accessible error card.
19
+ * An optional `retryFn` receives a retry button the user can click.
20
+ * An optional `retryLabel` overrides the default "Retry" button text for localised UIs.
21
+ */
22
+ export function renderErrorFallback(container, message = 'Data temporarily unavailable', retryFn, retryLabel = 'Retry') {
23
+ container.innerHTML = '';
24
+ const card = document.createElement('div');
25
+ card.className = 'fallback-error-card';
26
+ card.setAttribute('role', 'alert');
27
+ card.setAttribute('aria-live', 'assertive');
28
+ const icon = document.createElement('span');
29
+ icon.className = 'fallback-icon';
30
+ icon.setAttribute('aria-hidden', 'true');
31
+ icon.textContent = '⚠';
32
+ const text = document.createElement('p');
33
+ text.className = 'fallback-message';
34
+ text.textContent = message;
35
+ card.appendChild(icon);
36
+ card.appendChild(text);
37
+ if (retryFn) {
38
+ const btn = document.createElement('button');
39
+ btn.className = 'fallback-retry-btn';
40
+ btn.type = 'button';
41
+ btn.textContent = retryLabel;
42
+ btn.addEventListener('click', retryFn);
43
+ card.appendChild(btn);
44
+ }
45
+ container.appendChild(card);
46
+ }
47
+ /**
48
+ * Replace the contents of `container` with a CSS-only skeleton loading animation.
49
+ * The optional `loadingLabel` allows localized ARIA text for screen readers.
50
+ */
51
+ export function renderLoadingFallback(container, loadingLabel = 'Loading…') {
52
+ container.innerHTML = '';
53
+ const wrapper = document.createElement('div');
54
+ wrapper.className = 'fallback-loading-skeleton';
55
+ wrapper.setAttribute('role', 'status');
56
+ wrapper.setAttribute('aria-live', 'polite');
57
+ wrapper.setAttribute('aria-label', loadingLabel);
58
+ for (let i = 0; i < 3; i++) {
59
+ const bar = document.createElement('div');
60
+ bar.className = 'skeleton-bar';
61
+ wrapper.appendChild(bar);
62
+ }
63
+ container.appendChild(wrapper);
64
+ }
65
+ //# sourceMappingURL=fallback-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallback-ui.js","sourceRoot":"","sources":["../../src/browser/shared/fallback-ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAsB,EACtB,OAAO,GAAG,8BAA8B,EACxC,OAAoB,EACpB,UAAU,GAAG,OAAO;IAEpB,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;IAEzB,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,CAAC,SAAS,GAAG,qBAAqB,CAAC;IACvC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAE5C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;IACjC,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACzC,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;IAEvB,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,SAAS,GAAG,kBAAkB,CAAC;IACpC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;IAE3B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEvB,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC7C,GAAG,CAAC,SAAS,GAAG,oBAAoB,CAAC;QACrC,GAAG,CAAC,IAAI,GAAG,QAAQ,CAAC;QACpB,GAAG,CAAC,WAAW,GAAG,UAAU,CAAC;QAC7B,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAsB,EAAE,YAAY,GAAG,UAAU;IACrF,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;IAEzB,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CAAC,SAAS,GAAG,2BAA2B,CAAC;IAChD,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvC,OAAO,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC5C,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAEjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,SAAS,GAAG,cAAc,CAAC;QAC/B,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @module Shared
3
+ * @description Barrel export for all shared browser modules.
4
+
5
+ *
6
+ * @intelligence Intelligence module aggregation — barrel export providing clean import surface for all shared analytical infrastructure components.
7
+ *
8
+ * @business API surface management — clean module exports reduce coupling and enable future package extraction. Supports modular architecture for enterprise customization.
9
+ *
10
+ * @marketing Developer ecosystem enablement — clean imports make the codebase approachable for open-source contributors. Lower barrier to contribution increases community engagement.
11
+ * */
12
+ export * from './types.js';
13
+ export * from './theme.js';
14
+ export * from './logger.js';
15
+ export * from './dom-utils.js';
16
+ export * from './data-loader.js';
17
+ export * from './chart-factory.js';
18
+ export * from './fallback-ui.js';
19
+ export * from './error-boundary.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;KAUK;AAEL,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @module Shared
3
+ * @description Barrel export for all shared browser modules.
4
+
5
+ *
6
+ * @intelligence Intelligence module aggregation — barrel export providing clean import surface for all shared analytical infrastructure components.
7
+ *
8
+ * @business API surface management — clean module exports reduce coupling and enable future package extraction. Supports modular architecture for enterprise customization.
9
+ *
10
+ * @marketing Developer ecosystem enablement — clean imports make the codebase approachable for open-source contributors. Lower barrier to contribution increases community engagement.
11
+ * */
12
+ export * from './types.js';
13
+ export * from './theme.js';
14
+ export * from './logger.js';
15
+ export * from './dom-utils.js';
16
+ export * from './data-loader.js';
17
+ export * from './chart-factory.js';
18
+ export * from './fallback-ui.js';
19
+ export * from './error-boundary.js';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;KAUK;AAEL,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @module Shared/Logger
3
+ * @description Debug logger gated by ?debug URL parameter.
4
+ * Only logs when debug mode is enabled to keep production console clean.
5
+
6
+ *
7
+ * @intelligence Intelligence operations monitoring — conditional debug logging (?debug URL parameter) for production diagnostics without exposing operational details. Supports incident analysis and performance investigation.
8
+ *
9
+ * @business Operational cost reduction — debug-gated logging keeps production console clean, reducing noise in error monitoring. Enables field debugging for support teams without code changes or redeployment.
10
+ *
11
+ * @marketing Developer experience feature — debug mode is demonstrable in technical blog posts and documentation. Positions the platform as developer-friendly for open-source community engagement.
12
+ * */
13
+ export declare const logger: {
14
+ debug(...args: unknown[]): void;
15
+ info(...args: unknown[]): void;
16
+ warn(...args: unknown[]): void;
17
+ error(...args: unknown[]): void;
18
+ };
19
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/browser/shared/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAKL,eAAO,MAAM,MAAM;mBACF,OAAO,EAAE,GAAG,IAAI;kBAGjB,OAAO,EAAE,GAAG,IAAI;kBAGhB,OAAO,EAAE,GAAG,IAAI;mBAGf,OAAO,EAAE,GAAG,IAAI;CAGhC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module Shared/Logger
3
+ * @description Debug logger gated by ?debug URL parameter.
4
+ * Only logs when debug mode is enabled to keep production console clean.
5
+
6
+ *
7
+ * @intelligence Intelligence operations monitoring — conditional debug logging (?debug URL parameter) for production diagnostics without exposing operational details. Supports incident analysis and performance investigation.
8
+ *
9
+ * @business Operational cost reduction — debug-gated logging keeps production console clean, reducing noise in error monitoring. Enables field debugging for support teams without code changes or redeployment.
10
+ *
11
+ * @marketing Developer experience feature — debug mode is demonstrable in technical blog posts and documentation. Positions the platform as developer-friendly for open-source community engagement.
12
+ * */
13
+ const isDebug = typeof window !== 'undefined' &&
14
+ new URLSearchParams(window.location?.search).has('debug');
15
+ export const logger = {
16
+ debug(...args) {
17
+ if (isDebug)
18
+ console.debug('[RDM]', ...args);
19
+ },
20
+ info(...args) {
21
+ if (isDebug)
22
+ console.info('[RDM]', ...args);
23
+ },
24
+ warn(...args) {
25
+ console.warn('[RDM]', ...args);
26
+ },
27
+ error(...args) {
28
+ console.error('[RDM]', ...args);
29
+ },
30
+ };
31
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/browser/shared/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;KAWK;AAEL,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,WAAW;IAC3C,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,CAAC,GAAG,IAAe;QACtB,IAAI,OAAO;YAAE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,CAAC,GAAG,IAAe;QACrB,IAAI,OAAO;YAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,CAAC,GAAG,IAAe;QACrB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,KAAK,CAAC,GAAG,IAAe;QACtB,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAClC,CAAC;CACF,CAAC"}