+ {/* Header */}
+
+
+
+ Build Diagnostics
+
+ {status === 'building' && (
+
+ Building...
+
+ )}
+
+
+ {/* Filter toggles */}
+
+ {anyFilterInactive && (
+
+ )}
+ {errors > 0 && (
+
toggleFilter('errors')}
+ icon={}
+ count={errors}
+ label="errors"
+ colorClass="bg-red"
+ />
+ )}
+ {warnings > 0 && (
+ toggleFilter('warnings')}
+ icon={}
+ count={warnings}
+ label="warnings"
+ colorClass="bg-yellow"
+ />
+ )}
+ {hints > 0 && (
+ toggleFilter('hints')}
+ icon={}
+ count={hints}
+ label="hints"
+ colorClass="bg-blue-elastic"
+ />
+ )}
+ {errors === 0 &&
+ warnings === 0 &&
+ hints === 0 &&
+ status === 'complete' && (
+
+ No issues found
+
+ )}
+
+
+
+
+
+
+
+ {/* Diagnostics list */}
+
+ {filteredDiagnostics.length === 0 ? (
+
+ {status === 'building'
+ ? 'Waiting for diagnostics...'
+ : diagnostics.length === 0
+ ? 'No diagnostics to display'
+ : 'No diagnostics match the current filters'}
+
+ ) : (
+ filteredDiagnostics.map((diagnostic) => (
+
+ ))
+ )}
+
+
+ )
+}
diff --git a/src/Elastic.Documentation.Site/Assets/web-components/Diagnostics/diagnostics.store.ts b/src/Elastic.Documentation.Site/Assets/web-components/Diagnostics/diagnostics.store.ts
new file mode 100644
index 000000000..8ec6f90a9
--- /dev/null
+++ b/src/Elastic.Documentation.Site/Assets/web-components/Diagnostics/diagnostics.store.ts
@@ -0,0 +1,120 @@
+import { create } from 'zustand'
+
+export type BuildStatus = 'idle' | 'building' | 'complete'
+
+// SessionStorage key for persisting HUD open state
+const HUD_OPEN_KEY = 'diagnostics-hud-open'
+
+// Helper to get persisted HUD state
+function getPersistedHudOpen(): boolean {
+ try {
+ return sessionStorage.getItem(HUD_OPEN_KEY) === 'true'
+ } catch {
+ return false
+ }
+}
+
+// Helper to persist HUD state
+function persistHudOpen(open: boolean): void {
+ try {
+ sessionStorage.setItem(HUD_OPEN_KEY, String(open))
+ } catch {
+ // Ignore storage errors
+ }
+}
+
+export type DiagnosticSeverity = 'error' | 'warning' | 'hint'
+
+export interface DiagnosticItem {
+ id: string
+ severity: DiagnosticSeverity
+ file: string
+ message: string
+ line?: number
+ column?: number
+ timestamp: number
+}
+
+export interface FilterState {
+ errors: boolean
+ warnings: boolean
+ hints: boolean
+}
+
+export interface DiagnosticsState {
+ status: BuildStatus
+ errors: number
+ warnings: number
+ hints: number
+ diagnostics: DiagnosticItem[]
+ isHudOpen: boolean
+ isConnected: boolean
+ filters: FilterState
+
+ // Actions
+ setStatus: (status: BuildStatus) => void
+ setCounts: (errors: number, warnings: number, hints: number) => void
+ addDiagnostic: (diagnostic: DiagnosticItem) => void
+ clearDiagnostics: () => void
+ toggleHud: () => void
+ setHudOpen: (open: boolean) => void
+ setConnected: (connected: boolean) => void
+ toggleFilter: (filter: keyof FilterState) => void
+ showAllFilters: () => void
+ reset: () => void
+}
+
+export const useDiagnosticsStore = create