@thehoneyjar/sigil-hud 0.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/LICENSE.md +660 -0
- package/README.md +146 -0
- package/dist/index.d.ts +911 -0
- package/dist/index.js +3079 -0
- package/package.json +68 -0
- package/src/components/DataSourceIndicator.tsx +185 -0
- package/src/components/DiagnosticsPanel.tsx +444 -0
- package/src/components/FeedbackPrompt.tsx +348 -0
- package/src/components/HudPanel.tsx +179 -0
- package/src/components/HudTrigger.tsx +81 -0
- package/src/components/IssueList.tsx +228 -0
- package/src/components/LensPanel.tsx +286 -0
- package/src/components/ObservationCaptureModal.tsx +502 -0
- package/src/components/PhysicsAnalysis.tsx +273 -0
- package/src/components/SimulationPanel.tsx +173 -0
- package/src/components/StateComparison.tsx +238 -0
- package/src/hooks/useDataSource.ts +324 -0
- package/src/hooks/useKeyboardShortcuts.ts +125 -0
- package/src/hooks/useObservationCapture.ts +154 -0
- package/src/hooks/useSignalCapture.ts +138 -0
- package/src/index.ts +112 -0
- package/src/providers/HudProvider.tsx +115 -0
- package/src/store.ts +60 -0
- package/src/styles/theme.ts +256 -0
- package/src/types.ts +276 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,911 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import * as zustand_middleware from 'zustand/middleware';
|
|
3
|
+
import * as zustand from 'zustand';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @sigil/hud
|
|
8
|
+
*
|
|
9
|
+
* Types for the diagnostic HUD.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface LensState {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
impersonatedAddress: string | null;
|
|
15
|
+
realAddress: string | null;
|
|
16
|
+
savedAddresses: Array<{
|
|
17
|
+
address: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
interface LensService {
|
|
22
|
+
getState(): LensState;
|
|
23
|
+
setImpersonatedAddress(address: string): void;
|
|
24
|
+
clearImpersonation(): void;
|
|
25
|
+
saveAddress(entry: {
|
|
26
|
+
address: string;
|
|
27
|
+
label: string;
|
|
28
|
+
}): void;
|
|
29
|
+
enable(): void;
|
|
30
|
+
disable(): void;
|
|
31
|
+
}
|
|
32
|
+
interface ForkState {
|
|
33
|
+
active: boolean;
|
|
34
|
+
chainId?: number;
|
|
35
|
+
blockNumber?: number;
|
|
36
|
+
snapshotCount?: number;
|
|
37
|
+
rpcUrl?: string;
|
|
38
|
+
}
|
|
39
|
+
interface ForkService {
|
|
40
|
+
getState(): ForkState;
|
|
41
|
+
}
|
|
42
|
+
interface SimulationState {
|
|
43
|
+
isRunning: boolean;
|
|
44
|
+
lastResult: unknown | null;
|
|
45
|
+
}
|
|
46
|
+
interface SimulationService {
|
|
47
|
+
getState(): SimulationState;
|
|
48
|
+
}
|
|
49
|
+
interface DiagnosticIssue {
|
|
50
|
+
severity: 'error' | 'warning' | 'info';
|
|
51
|
+
code: string;
|
|
52
|
+
message: string;
|
|
53
|
+
suggestion?: string;
|
|
54
|
+
}
|
|
55
|
+
type EffectType = 'financial' | 'destructive' | 'soft-delete' | 'standard' | 'local' | 'navigation' | 'query';
|
|
56
|
+
interface BehavioralCompliance {
|
|
57
|
+
sync: string;
|
|
58
|
+
timing: number;
|
|
59
|
+
confirmation: boolean;
|
|
60
|
+
compliant: boolean;
|
|
61
|
+
}
|
|
62
|
+
interface AnimationCompliance {
|
|
63
|
+
easing: string;
|
|
64
|
+
duration: number;
|
|
65
|
+
compliant: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface MaterialCompliance {
|
|
68
|
+
surface: string;
|
|
69
|
+
shadow: string;
|
|
70
|
+
compliant: boolean;
|
|
71
|
+
}
|
|
72
|
+
interface ComplianceResult {
|
|
73
|
+
behavioral: BehavioralCompliance;
|
|
74
|
+
animation: AnimationCompliance;
|
|
75
|
+
material: MaterialCompliance;
|
|
76
|
+
}
|
|
77
|
+
interface DiagnosticResult {
|
|
78
|
+
component: string;
|
|
79
|
+
effect: EffectType;
|
|
80
|
+
issues: DiagnosticIssue[];
|
|
81
|
+
compliance: ComplianceResult;
|
|
82
|
+
suggestions: string[];
|
|
83
|
+
}
|
|
84
|
+
interface DiagnosticsService {
|
|
85
|
+
analyze(component: string, code?: string): Promise<DiagnosticResult>;
|
|
86
|
+
diagnose(symptom: string): string;
|
|
87
|
+
checkCompliance(effect: string, physics: unknown): boolean;
|
|
88
|
+
detectEffect(keywords: string[], types?: string[]): string;
|
|
89
|
+
}
|
|
90
|
+
type AnchorClient = unknown;
|
|
91
|
+
/**
|
|
92
|
+
* HUD panel position
|
|
93
|
+
*/
|
|
94
|
+
type HudPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
95
|
+
/**
|
|
96
|
+
* HUD configuration
|
|
97
|
+
*/
|
|
98
|
+
interface HudConfig {
|
|
99
|
+
/** Enable keyboard shortcuts */
|
|
100
|
+
shortcuts?: boolean;
|
|
101
|
+
/** Default panel position */
|
|
102
|
+
position?: HudPosition;
|
|
103
|
+
/** Persist panel state to localStorage */
|
|
104
|
+
persist?: boolean;
|
|
105
|
+
/** Enable observation capture */
|
|
106
|
+
observationCapture?: boolean;
|
|
107
|
+
/** Enable signal capture */
|
|
108
|
+
signalCapture?: boolean;
|
|
109
|
+
/** Default panel to open */
|
|
110
|
+
defaultPanel?: HudPanelType;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* HUD panel types
|
|
114
|
+
*/
|
|
115
|
+
type HudPanelType = 'lens' | 'simulation' | 'diagnostics' | 'state' | 'signals';
|
|
116
|
+
/**
|
|
117
|
+
* HUD state
|
|
118
|
+
*/
|
|
119
|
+
interface HudState {
|
|
120
|
+
/** Whether HUD is open */
|
|
121
|
+
isOpen: boolean;
|
|
122
|
+
/** Current active panel */
|
|
123
|
+
activePanel: HudPanelType | null;
|
|
124
|
+
/** Panel position */
|
|
125
|
+
position: HudPosition;
|
|
126
|
+
/** Whether HUD is minimized */
|
|
127
|
+
isMinimized: boolean;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* HUD actions
|
|
131
|
+
*/
|
|
132
|
+
interface HudActions {
|
|
133
|
+
/** Open the HUD */
|
|
134
|
+
open: () => void;
|
|
135
|
+
/** Close the HUD */
|
|
136
|
+
close: () => void;
|
|
137
|
+
/** Toggle HUD visibility */
|
|
138
|
+
toggle: () => void;
|
|
139
|
+
/** Set active panel */
|
|
140
|
+
setActivePanel: (panel: HudPanelType | null) => void;
|
|
141
|
+
/** Set position */
|
|
142
|
+
setPosition: (position: HudPosition) => void;
|
|
143
|
+
/** Toggle minimized state */
|
|
144
|
+
toggleMinimized: () => void;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* HUD context value
|
|
148
|
+
*/
|
|
149
|
+
interface HudContextValue extends HudState, HudActions {
|
|
150
|
+
/** Lens service instance (if available) */
|
|
151
|
+
lensService: LensService | null;
|
|
152
|
+
/** Fork service instance (if available) */
|
|
153
|
+
forkService: ForkService | null;
|
|
154
|
+
/** Simulation service instance (if available) */
|
|
155
|
+
simulationService: SimulationService | null;
|
|
156
|
+
/** Diagnostics service instance (if available) */
|
|
157
|
+
diagnosticsService: DiagnosticsService | null;
|
|
158
|
+
/** Anchor client instance (if available) */
|
|
159
|
+
anchorClient: AnchorClient | null;
|
|
160
|
+
/** HUD configuration */
|
|
161
|
+
config: HudConfig;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* HUD provider props
|
|
165
|
+
*/
|
|
166
|
+
interface HudProviderProps {
|
|
167
|
+
children: ReactNode;
|
|
168
|
+
config?: HudConfig;
|
|
169
|
+
/** Optional package instances (for composition) */
|
|
170
|
+
lensService?: LensService;
|
|
171
|
+
forkService?: ForkService;
|
|
172
|
+
simulationService?: SimulationService;
|
|
173
|
+
diagnosticsService?: DiagnosticsService;
|
|
174
|
+
anchorClient?: AnchorClient;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Observation for capturing user insights
|
|
178
|
+
*/
|
|
179
|
+
interface Observation {
|
|
180
|
+
id: string;
|
|
181
|
+
timestamp: string;
|
|
182
|
+
type: 'user-truth' | 'issue' | 'insight';
|
|
183
|
+
content: string;
|
|
184
|
+
tags: string[];
|
|
185
|
+
context?: {
|
|
186
|
+
component?: string;
|
|
187
|
+
effect?: string;
|
|
188
|
+
lensAddress?: string;
|
|
189
|
+
screenshot?: string;
|
|
190
|
+
};
|
|
191
|
+
linkedSignals?: string[];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Taste signal for learning user preferences
|
|
195
|
+
*/
|
|
196
|
+
interface Signal {
|
|
197
|
+
timestamp: string;
|
|
198
|
+
signal: 'ACCEPT' | 'MODIFY' | 'REJECT';
|
|
199
|
+
source: 'cli' | 'toolbar' | 'hud';
|
|
200
|
+
component: {
|
|
201
|
+
name: string;
|
|
202
|
+
effect: string;
|
|
203
|
+
craft_type: 'generate' | 'diagnose' | 'repair';
|
|
204
|
+
};
|
|
205
|
+
physics?: {
|
|
206
|
+
behavioral?: {
|
|
207
|
+
sync: string;
|
|
208
|
+
timing: string;
|
|
209
|
+
confirmation: string;
|
|
210
|
+
};
|
|
211
|
+
animation?: {
|
|
212
|
+
easing: string;
|
|
213
|
+
duration: string;
|
|
214
|
+
};
|
|
215
|
+
material?: {
|
|
216
|
+
surface: string;
|
|
217
|
+
shadow: string;
|
|
218
|
+
radius: string;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
hud_context?: {
|
|
222
|
+
panel_visible: boolean;
|
|
223
|
+
diagnostics_shown: boolean;
|
|
224
|
+
observation_linked?: string;
|
|
225
|
+
};
|
|
226
|
+
change?: {
|
|
227
|
+
from: string;
|
|
228
|
+
to: string;
|
|
229
|
+
};
|
|
230
|
+
learning?: {
|
|
231
|
+
inference: string;
|
|
232
|
+
recommendation?: string;
|
|
233
|
+
};
|
|
234
|
+
rejection_reason?: string;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Default HUD state
|
|
238
|
+
*/
|
|
239
|
+
declare const DEFAULT_HUD_STATE: HudState;
|
|
240
|
+
/**
|
|
241
|
+
* Default HUD config
|
|
242
|
+
*/
|
|
243
|
+
declare const DEFAULT_HUD_CONFIG: HudConfig;
|
|
244
|
+
/**
|
|
245
|
+
* Default lens state for when lens service is not available
|
|
246
|
+
*/
|
|
247
|
+
declare const DEFAULT_LENS_STATE: LensState;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Combined HUD store type
|
|
251
|
+
*/
|
|
252
|
+
type HudStore = HudState & HudActions;
|
|
253
|
+
/**
|
|
254
|
+
* Create the HUD store
|
|
255
|
+
*/
|
|
256
|
+
declare const useHudStore: zustand.UseBoundStore<Omit<zustand.StoreApi<HudStore>, "persist"> & {
|
|
257
|
+
persist: {
|
|
258
|
+
setOptions: (options: Partial<zustand_middleware.PersistOptions<HudStore, {
|
|
259
|
+
position: HudPosition;
|
|
260
|
+
isMinimized: boolean;
|
|
261
|
+
}>>) => void;
|
|
262
|
+
clearStorage: () => void;
|
|
263
|
+
rehydrate: () => void | Promise<void>;
|
|
264
|
+
hasHydrated: () => boolean;
|
|
265
|
+
onHydrate: (fn: (state: HudStore) => void) => () => void;
|
|
266
|
+
onFinishHydration: (fn: (state: HudStore) => void) => () => void;
|
|
267
|
+
getOptions: () => Partial<zustand_middleware.PersistOptions<HudStore, {
|
|
268
|
+
position: HudPosition;
|
|
269
|
+
isMinimized: boolean;
|
|
270
|
+
}>>;
|
|
271
|
+
};
|
|
272
|
+
}>;
|
|
273
|
+
/**
|
|
274
|
+
* Get HUD store state (for non-React contexts)
|
|
275
|
+
*/
|
|
276
|
+
declare function getHudState(): HudState;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* HUD Provider component
|
|
280
|
+
*/
|
|
281
|
+
declare function HudProvider({ children, config, lensService, forkService, simulationService, diagnosticsService, anchorClient, }: HudProviderProps): react_jsx_runtime.JSX.Element;
|
|
282
|
+
/**
|
|
283
|
+
* Hook to access HUD context
|
|
284
|
+
*
|
|
285
|
+
* @throws Error if used outside HudProvider
|
|
286
|
+
*/
|
|
287
|
+
declare function useHud(): HudContextValue;
|
|
288
|
+
/**
|
|
289
|
+
* Hook to access HUD context (returns null if not in provider)
|
|
290
|
+
*/
|
|
291
|
+
declare function useHudOptional(): HudContextValue | null;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Props for HudPanel
|
|
295
|
+
*/
|
|
296
|
+
interface HudPanelProps {
|
|
297
|
+
/** Panel content */
|
|
298
|
+
children?: ReactNode;
|
|
299
|
+
/** Custom class name */
|
|
300
|
+
className?: string;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Main HUD panel component
|
|
304
|
+
*/
|
|
305
|
+
declare function HudPanel({ children, className }: HudPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Props for HudTrigger
|
|
309
|
+
*/
|
|
310
|
+
interface HudTriggerProps {
|
|
311
|
+
/** Custom class name */
|
|
312
|
+
className?: string;
|
|
313
|
+
/** Custom children (replaces default icon) */
|
|
314
|
+
children?: ReactNode;
|
|
315
|
+
/** Override position (defaults to HUD position) */
|
|
316
|
+
position?: HudPosition;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Floating trigger button to open the HUD
|
|
320
|
+
*/
|
|
321
|
+
declare function HudTrigger({ className, children, position: overridePosition, }: HudTriggerProps): react_jsx_runtime.JSX.Element | null;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Lens Panel Component
|
|
325
|
+
*
|
|
326
|
+
* Panel for address impersonation controls.
|
|
327
|
+
* FR-005 fix: All hooks called unconditionally at top level.
|
|
328
|
+
*/
|
|
329
|
+
/**
|
|
330
|
+
* Props for LensPanel
|
|
331
|
+
*/
|
|
332
|
+
interface LensPanelProps {
|
|
333
|
+
/** Custom class name */
|
|
334
|
+
className?: string;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Lens panel for address impersonation
|
|
338
|
+
*/
|
|
339
|
+
declare function LensPanel({ className }: LensPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Simulation Panel Component
|
|
343
|
+
*
|
|
344
|
+
* Panel for transaction simulation controls.
|
|
345
|
+
*/
|
|
346
|
+
/**
|
|
347
|
+
* Props for SimulationPanel
|
|
348
|
+
*/
|
|
349
|
+
interface SimulationPanelProps {
|
|
350
|
+
/** Custom class name */
|
|
351
|
+
className?: string;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Simulation panel for transaction dry-runs
|
|
355
|
+
*/
|
|
356
|
+
declare function SimulationPanel({ className }: SimulationPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Diagnostics Panel Component
|
|
360
|
+
*
|
|
361
|
+
* Panel for physics compliance checking and issue detection.
|
|
362
|
+
* Implements TASK-201 requirements:
|
|
363
|
+
* - Physics analysis display
|
|
364
|
+
* - Data source indicators
|
|
365
|
+
* - Issue detection
|
|
366
|
+
* - Quick action buttons
|
|
367
|
+
*/
|
|
368
|
+
/**
|
|
369
|
+
* Props for DiagnosticsPanel
|
|
370
|
+
*/
|
|
371
|
+
interface DiagnosticsPanelProps {
|
|
372
|
+
/** Custom class name */
|
|
373
|
+
className?: string;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Diagnostics panel for physics analysis
|
|
377
|
+
*/
|
|
378
|
+
declare function DiagnosticsPanel({ className }: DiagnosticsPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Props for PhysicsAnalysis
|
|
382
|
+
*/
|
|
383
|
+
interface PhysicsAnalysisProps {
|
|
384
|
+
/** Detected effect type */
|
|
385
|
+
effect: EffectType | null;
|
|
386
|
+
/** Physics compliance result */
|
|
387
|
+
compliance?: ComplianceResult | null;
|
|
388
|
+
/** Whether analysis is loading */
|
|
389
|
+
isLoading?: boolean;
|
|
390
|
+
/** Custom class name */
|
|
391
|
+
className?: string;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Physics Analysis component
|
|
395
|
+
*/
|
|
396
|
+
declare function PhysicsAnalysis({ effect, compliance, isLoading, className, }: PhysicsAnalysisProps): react_jsx_runtime.JSX.Element;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Props for IssueList
|
|
400
|
+
*/
|
|
401
|
+
interface IssueListProps {
|
|
402
|
+
/** Issues to display */
|
|
403
|
+
issues: DiagnosticIssue[];
|
|
404
|
+
/** Maximum issues to show (expandable) */
|
|
405
|
+
maxVisible?: number;
|
|
406
|
+
/** Callback when issue is clicked */
|
|
407
|
+
onIssueClick?: (issue: DiagnosticIssue) => void;
|
|
408
|
+
/** Custom class name */
|
|
409
|
+
className?: string;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Issue List component
|
|
413
|
+
*/
|
|
414
|
+
declare function IssueList({ issues, maxVisible, onIssueClick, className, }: IssueListProps): react_jsx_runtime.JSX.Element;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Data Source Indicator Component
|
|
418
|
+
*
|
|
419
|
+
* Shows the source and staleness of displayed data values.
|
|
420
|
+
* Full implementation in TASK-202.
|
|
421
|
+
*/
|
|
422
|
+
/**
|
|
423
|
+
* Data source type
|
|
424
|
+
*/
|
|
425
|
+
type DataSourceType = 'on-chain' | 'indexed' | 'cached' | 'unknown';
|
|
426
|
+
/**
|
|
427
|
+
* Props for DataSourceIndicator
|
|
428
|
+
*/
|
|
429
|
+
interface DataSourceIndicatorProps {
|
|
430
|
+
/** Data source type */
|
|
431
|
+
source: DataSourceType;
|
|
432
|
+
/** Block number for on-chain data */
|
|
433
|
+
blockNumber?: number;
|
|
434
|
+
/** Current block for staleness calculation */
|
|
435
|
+
currentBlock?: number;
|
|
436
|
+
/** Timestamp for time-based staleness */
|
|
437
|
+
timestamp?: number;
|
|
438
|
+
/** Whether to show expanded details */
|
|
439
|
+
expanded?: boolean;
|
|
440
|
+
/** Callback when clicked */
|
|
441
|
+
onClick?: () => void;
|
|
442
|
+
/** Custom class name */
|
|
443
|
+
className?: string;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Data Source Indicator component
|
|
447
|
+
*/
|
|
448
|
+
declare function DataSourceIndicator({ source, blockNumber, currentBlock, timestamp, expanded, onClick, className, }: DataSourceIndicatorProps): react_jsx_runtime.JSX.Element;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* State Comparison Component
|
|
452
|
+
*
|
|
453
|
+
* Compare state between real and impersonated addresses.
|
|
454
|
+
*/
|
|
455
|
+
/**
|
|
456
|
+
* Props for StateComparison
|
|
457
|
+
*/
|
|
458
|
+
interface StateComparisonProps {
|
|
459
|
+
/** Custom class name */
|
|
460
|
+
className?: string;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* State comparison panel
|
|
464
|
+
*/
|
|
465
|
+
declare function StateComparison({ className }: StateComparisonProps): react_jsx_runtime.JSX.Element | null;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Props for ObservationCaptureModal
|
|
469
|
+
*/
|
|
470
|
+
interface ObservationCaptureModalProps {
|
|
471
|
+
/** Whether the modal is visible */
|
|
472
|
+
isOpen: boolean;
|
|
473
|
+
/** Callback to close the modal */
|
|
474
|
+
onClose: () => void;
|
|
475
|
+
/** Callback when observation is captured */
|
|
476
|
+
onCapture?: (observation: Observation) => void;
|
|
477
|
+
/** Current component context */
|
|
478
|
+
componentContext?: {
|
|
479
|
+
name?: string;
|
|
480
|
+
effect?: string;
|
|
481
|
+
lensAddress?: string;
|
|
482
|
+
};
|
|
483
|
+
/** Custom class name */
|
|
484
|
+
className?: string;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Observation Capture Modal
|
|
488
|
+
*/
|
|
489
|
+
declare function ObservationCaptureModal({ isOpen, onClose, onCapture, componentContext, className, }: ObservationCaptureModalProps): react_jsx_runtime.JSX.Element | null;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Feedback option
|
|
493
|
+
*/
|
|
494
|
+
interface FeedbackOption {
|
|
495
|
+
id: string;
|
|
496
|
+
label: string;
|
|
497
|
+
description: string;
|
|
498
|
+
signal: 'ACCEPT' | 'MODIFY' | 'REJECT';
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Props for FeedbackPrompt
|
|
502
|
+
*/
|
|
503
|
+
interface FeedbackPromptProps {
|
|
504
|
+
/** Component name being reviewed */
|
|
505
|
+
componentName: string;
|
|
506
|
+
/** Detected effect type */
|
|
507
|
+
effect: string;
|
|
508
|
+
/** Current physics values */
|
|
509
|
+
physics?: {
|
|
510
|
+
behavioral?: {
|
|
511
|
+
sync: string;
|
|
512
|
+
timing: string;
|
|
513
|
+
confirmation: string;
|
|
514
|
+
};
|
|
515
|
+
animation?: {
|
|
516
|
+
easing: string;
|
|
517
|
+
duration: string;
|
|
518
|
+
};
|
|
519
|
+
material?: {
|
|
520
|
+
surface: string;
|
|
521
|
+
shadow: string;
|
|
522
|
+
radius: string;
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
/** Custom feedback options */
|
|
526
|
+
options?: FeedbackOption[];
|
|
527
|
+
/** Callback when feedback is submitted */
|
|
528
|
+
onFeedback?: (signal: Signal, observation?: Observation) => void;
|
|
529
|
+
/** Callback to close the prompt */
|
|
530
|
+
onClose?: () => void;
|
|
531
|
+
/** Whether to show the prompt */
|
|
532
|
+
visible?: boolean;
|
|
533
|
+
/** Custom class name */
|
|
534
|
+
className?: string;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Feedback Prompt Component
|
|
538
|
+
*/
|
|
539
|
+
declare function FeedbackPrompt({ componentName, effect, physics, options, onFeedback, onClose, visible, className, }: FeedbackPromptProps): react_jsx_runtime.JSX.Element | null;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Keyboard Shortcuts Hook
|
|
543
|
+
*
|
|
544
|
+
* Handle keyboard shortcuts for HUD navigation.
|
|
545
|
+
*/
|
|
546
|
+
/**
|
|
547
|
+
* Props for useKeyboardShortcuts
|
|
548
|
+
*/
|
|
549
|
+
interface UseKeyboardShortcutsProps {
|
|
550
|
+
/** Whether shortcuts are enabled */
|
|
551
|
+
enabled?: boolean;
|
|
552
|
+
/** Custom shortcuts to add */
|
|
553
|
+
customShortcuts?: Record<string, () => void>;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Hook to handle keyboard shortcuts for HUD
|
|
557
|
+
*/
|
|
558
|
+
declare function useKeyboardShortcuts({ enabled, customShortcuts, }?: UseKeyboardShortcutsProps): void;
|
|
559
|
+
/**
|
|
560
|
+
* Get keyboard shortcut help text
|
|
561
|
+
*/
|
|
562
|
+
declare function getShortcutHelp(): Array<{
|
|
563
|
+
keys: string;
|
|
564
|
+
description: string;
|
|
565
|
+
}>;
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Signal Capture Hook
|
|
569
|
+
*
|
|
570
|
+
* Capture taste signals from HUD interactions.
|
|
571
|
+
*/
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Props for useSignalCapture
|
|
575
|
+
*/
|
|
576
|
+
interface UseSignalCaptureProps {
|
|
577
|
+
/** Whether signal capture is enabled */
|
|
578
|
+
enabled?: boolean;
|
|
579
|
+
/** Callback when signal is captured */
|
|
580
|
+
onSignal?: (signal: Signal) => void;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Hook to capture taste signals from HUD
|
|
584
|
+
*/
|
|
585
|
+
declare function useSignalCapture({ enabled, onSignal, }?: UseSignalCaptureProps): {
|
|
586
|
+
appendSignal: (signalData: Omit<Signal, 'timestamp' | 'source'>) => Promise<void>;
|
|
587
|
+
accept: (component: string, effect: string, craftType?: Signal['component']['craft_type']) => Promise<void>;
|
|
588
|
+
modify: (component: string, effect: string, change: {
|
|
589
|
+
from: string;
|
|
590
|
+
to: string;
|
|
591
|
+
}, learning?: {
|
|
592
|
+
inference: string;
|
|
593
|
+
recommendation?: string;
|
|
594
|
+
}) => Promise<void>;
|
|
595
|
+
reject: (component: string, effect: string, reason: string) => Promise<void>;
|
|
596
|
+
getSignals: () => Signal[];
|
|
597
|
+
clearSignals: () => void;
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Observation Capture Hook
|
|
602
|
+
*
|
|
603
|
+
* Capture user observations and insights from HUD.
|
|
604
|
+
*/
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Props for useObservationCapture
|
|
608
|
+
*/
|
|
609
|
+
interface UseObservationCaptureProps {
|
|
610
|
+
/** Whether observation capture is enabled */
|
|
611
|
+
enabled?: boolean;
|
|
612
|
+
/** Callback when observation is captured */
|
|
613
|
+
onObservation?: (observation: Observation) => void;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Hook to capture observations from HUD
|
|
617
|
+
*/
|
|
618
|
+
declare function useObservationCapture({ enabled, onObservation, }?: UseObservationCaptureProps): {
|
|
619
|
+
capture: (content: string, type?: Observation['type'], context?: Observation['context'], tags?: string[]) => Promise<Observation>;
|
|
620
|
+
captureUserTruth: (content: string, context?: Observation['context']) => Promise<Observation>;
|
|
621
|
+
captureIssue: (content: string, context?: Observation['context']) => Promise<Observation>;
|
|
622
|
+
captureInsight: (content: string, context?: Observation['context']) => Promise<Observation>;
|
|
623
|
+
linkToSignals: (observationId: string, signalIds: string[]) => void;
|
|
624
|
+
getObservations: () => Observation[];
|
|
625
|
+
getObservationsByType: (type: Observation['type']) => Observation[];
|
|
626
|
+
clearObservations: () => void;
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Data Source Hook
|
|
631
|
+
*
|
|
632
|
+
* Track data source and staleness for displayed values.
|
|
633
|
+
* Implements TASK-202: State source tracing.
|
|
634
|
+
*/
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Data source metadata
|
|
638
|
+
*/
|
|
639
|
+
interface DataSourceMeta {
|
|
640
|
+
/** Data source type */
|
|
641
|
+
source: DataSourceType;
|
|
642
|
+
/** When the data was fetched */
|
|
643
|
+
fetchedAt: number;
|
|
644
|
+
/** Block number (for on-chain data) */
|
|
645
|
+
blockNumber?: number;
|
|
646
|
+
/** Current block (for staleness calculation) */
|
|
647
|
+
currentBlock?: number;
|
|
648
|
+
/** Whether the data is stale */
|
|
649
|
+
isStale: boolean;
|
|
650
|
+
/** Staleness level */
|
|
651
|
+
stalenessLevel: 'fresh' | 'stale' | 'very-stale';
|
|
652
|
+
/** Human-readable staleness label */
|
|
653
|
+
stalenessLabel: string;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Props for useDataSource
|
|
657
|
+
*/
|
|
658
|
+
interface UseDataSourceProps {
|
|
659
|
+
/** Data source type */
|
|
660
|
+
source: DataSourceType;
|
|
661
|
+
/** Block number for on-chain data */
|
|
662
|
+
blockNumber?: number;
|
|
663
|
+
/** Interval to check staleness (ms) */
|
|
664
|
+
pollInterval?: number;
|
|
665
|
+
/** Threshold for "stale" in seconds (for time-based) */
|
|
666
|
+
staleThresholdSeconds?: number;
|
|
667
|
+
/** Threshold for "very stale" in seconds (for time-based) */
|
|
668
|
+
veryStaleThresholdSeconds?: number;
|
|
669
|
+
/** Threshold for "stale" in blocks (for block-based) */
|
|
670
|
+
staleThresholdBlocks?: number;
|
|
671
|
+
/** Threshold for "very stale" in blocks (for block-based) */
|
|
672
|
+
veryStaleThresholdBlocks?: number;
|
|
673
|
+
/** Callback when data becomes stale */
|
|
674
|
+
onStale?: () => void;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Hook to track data source and staleness
|
|
678
|
+
*/
|
|
679
|
+
declare function useDataSource({ source, blockNumber, pollInterval, staleThresholdSeconds, veryStaleThresholdSeconds, staleThresholdBlocks, veryStaleThresholdBlocks, onStale, }: UseDataSourceProps): {
|
|
680
|
+
meta: DataSourceMeta;
|
|
681
|
+
markRefreshed: (newBlockNumber?: number) => void;
|
|
682
|
+
updateCurrentBlock: (newCurrentBlock: number) => void;
|
|
683
|
+
recalculateStaleness: () => void;
|
|
684
|
+
};
|
|
685
|
+
/**
|
|
686
|
+
* Props for multiple data sources
|
|
687
|
+
*/
|
|
688
|
+
interface DataSourceEntry {
|
|
689
|
+
/** Unique key for this data source */
|
|
690
|
+
key: string;
|
|
691
|
+
/** Data source type */
|
|
692
|
+
source: DataSourceType;
|
|
693
|
+
/** Block number (for on-chain) */
|
|
694
|
+
blockNumber?: number;
|
|
695
|
+
/** Label for display */
|
|
696
|
+
label?: string;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Hook to track multiple data sources
|
|
700
|
+
*/
|
|
701
|
+
declare function useMultipleDataSources(entries: DataSourceEntry[]): {
|
|
702
|
+
sources: Map<string, DataSourceMeta>;
|
|
703
|
+
markRefreshed: (key: string, newBlockNumber?: number) => void;
|
|
704
|
+
getMeta: (key: string) => DataSourceMeta | undefined;
|
|
705
|
+
getStaleSources: () => string[];
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* HUD Theme Constants
|
|
710
|
+
*
|
|
711
|
+
* Shared design tokens for consistent styling across HUD components.
|
|
712
|
+
* Implements TASK-205 styling requirements.
|
|
713
|
+
*/
|
|
714
|
+
/**
|
|
715
|
+
* Color palette
|
|
716
|
+
*/
|
|
717
|
+
declare const colors: {
|
|
718
|
+
readonly primary: "#10b981";
|
|
719
|
+
readonly primaryLight: "rgba(16, 185, 129, 0.2)";
|
|
720
|
+
readonly primaryBorder: "rgba(16, 185, 129, 0.3)";
|
|
721
|
+
readonly success: "#22c55e";
|
|
722
|
+
readonly successLight: "rgba(34, 197, 94, 0.1)";
|
|
723
|
+
readonly successBorder: "rgba(34, 197, 94, 0.3)";
|
|
724
|
+
readonly warning: "#eab308";
|
|
725
|
+
readonly warningLight: "rgba(234, 179, 8, 0.1)";
|
|
726
|
+
readonly warningBorder: "rgba(234, 179, 8, 0.3)";
|
|
727
|
+
readonly error: "#ef4444";
|
|
728
|
+
readonly errorLight: "rgba(239, 68, 68, 0.1)";
|
|
729
|
+
readonly errorBorder: "rgba(239, 68, 68, 0.3)";
|
|
730
|
+
readonly info: "#3b82f6";
|
|
731
|
+
readonly infoLight: "rgba(59, 130, 246, 0.1)";
|
|
732
|
+
readonly infoBorder: "rgba(59, 130, 246, 0.3)";
|
|
733
|
+
readonly text: "#fff";
|
|
734
|
+
readonly textMuted: "#888";
|
|
735
|
+
readonly textDim: "#666";
|
|
736
|
+
readonly textDisabled: "#555";
|
|
737
|
+
readonly background: "rgba(0, 0, 0, 0.9)";
|
|
738
|
+
readonly backgroundElevated: "rgba(26, 26, 26, 1)";
|
|
739
|
+
readonly backgroundHover: "rgba(255, 255, 255, 0.05)";
|
|
740
|
+
readonly backgroundActive: "rgba(255, 255, 255, 0.08)";
|
|
741
|
+
readonly backgroundInput: "rgba(255, 255, 255, 0.02)";
|
|
742
|
+
readonly border: "rgba(255, 255, 255, 0.1)";
|
|
743
|
+
readonly borderSubtle: "rgba(255, 255, 255, 0.05)";
|
|
744
|
+
readonly borderStrong: "rgba(255, 255, 255, 0.2)";
|
|
745
|
+
readonly financial: "#ef4444";
|
|
746
|
+
readonly destructive: "#f97316";
|
|
747
|
+
readonly softDelete: "#eab308";
|
|
748
|
+
readonly standard: "#22c55e";
|
|
749
|
+
readonly local: "#3b82f6";
|
|
750
|
+
readonly navigation: "#8b5cf6";
|
|
751
|
+
readonly query: "#06b6d4";
|
|
752
|
+
};
|
|
753
|
+
/**
|
|
754
|
+
* Typography
|
|
755
|
+
*/
|
|
756
|
+
declare const typography: {
|
|
757
|
+
readonly fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace";
|
|
758
|
+
readonly fontFamilySans: "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif";
|
|
759
|
+
readonly xs: "10px";
|
|
760
|
+
readonly sm: "11px";
|
|
761
|
+
readonly base: "12px";
|
|
762
|
+
readonly md: "13px";
|
|
763
|
+
readonly lg: "14px";
|
|
764
|
+
readonly normal: 400;
|
|
765
|
+
readonly medium: 500;
|
|
766
|
+
readonly semibold: 600;
|
|
767
|
+
readonly bold: 700;
|
|
768
|
+
readonly lineHeightTight: 1.25;
|
|
769
|
+
readonly lineHeightNormal: 1.5;
|
|
770
|
+
readonly lineHeightRelaxed: 1.6;
|
|
771
|
+
readonly letterSpacingTight: "-0.02em";
|
|
772
|
+
readonly letterSpacingNormal: "0";
|
|
773
|
+
readonly letterSpacingWide: "0.5px";
|
|
774
|
+
};
|
|
775
|
+
/**
|
|
776
|
+
* Spacing
|
|
777
|
+
*/
|
|
778
|
+
declare const spacing: {
|
|
779
|
+
readonly xs: "4px";
|
|
780
|
+
readonly sm: "6px";
|
|
781
|
+
readonly md: "8px";
|
|
782
|
+
readonly lg: "12px";
|
|
783
|
+
readonly xl: "16px";
|
|
784
|
+
readonly '2xl': "20px";
|
|
785
|
+
readonly '3xl': "24px";
|
|
786
|
+
};
|
|
787
|
+
/**
|
|
788
|
+
* Border radius
|
|
789
|
+
*/
|
|
790
|
+
declare const radii: {
|
|
791
|
+
readonly sm: "4px";
|
|
792
|
+
readonly md: "6px";
|
|
793
|
+
readonly lg: "8px";
|
|
794
|
+
readonly xl: "12px";
|
|
795
|
+
readonly full: "9999px";
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* Shadows
|
|
799
|
+
*/
|
|
800
|
+
declare const shadows: {
|
|
801
|
+
readonly sm: "0 2px 4px rgba(0, 0, 0, 0.2)";
|
|
802
|
+
readonly md: "0 4px 12px rgba(0, 0, 0, 0.3)";
|
|
803
|
+
readonly lg: "0 8px 20px rgba(0, 0, 0, 0.4)";
|
|
804
|
+
readonly xl: "0 20px 40px rgba(0, 0, 0, 0.5)";
|
|
805
|
+
readonly primary: "0 4px 12px rgba(16, 185, 129, 0.3)";
|
|
806
|
+
readonly primaryHover: "0 6px 16px rgba(16, 185, 129, 0.4)";
|
|
807
|
+
};
|
|
808
|
+
/**
|
|
809
|
+
* Transitions
|
|
810
|
+
*/
|
|
811
|
+
declare const transitions: {
|
|
812
|
+
readonly fast: "0.1s ease-out";
|
|
813
|
+
readonly normal: "0.15s ease-out";
|
|
814
|
+
readonly slow: "0.2s ease-out";
|
|
815
|
+
readonly spring: "0.3s cubic-bezier(0.34, 1.56, 0.64, 1)";
|
|
816
|
+
};
|
|
817
|
+
/**
|
|
818
|
+
* Z-index
|
|
819
|
+
*/
|
|
820
|
+
declare const zIndex: {
|
|
821
|
+
readonly base: 1;
|
|
822
|
+
readonly dropdown: 100;
|
|
823
|
+
readonly sticky: 1000;
|
|
824
|
+
readonly fixed: 5000;
|
|
825
|
+
readonly modal: 10000;
|
|
826
|
+
readonly tooltip: 15000;
|
|
827
|
+
};
|
|
828
|
+
/**
|
|
829
|
+
* Common style patterns
|
|
830
|
+
*/
|
|
831
|
+
declare const patterns: {
|
|
832
|
+
readonly button: {
|
|
833
|
+
readonly base: {
|
|
834
|
+
readonly padding: "8px 12px";
|
|
835
|
+
readonly borderRadius: "6px";
|
|
836
|
+
readonly fontSize: "11px";
|
|
837
|
+
readonly fontWeight: 500;
|
|
838
|
+
readonly cursor: "pointer";
|
|
839
|
+
readonly transition: "0.15s ease-out";
|
|
840
|
+
readonly border: "1px solid";
|
|
841
|
+
};
|
|
842
|
+
readonly primary: {
|
|
843
|
+
readonly backgroundColor: "rgba(16, 185, 129, 0.2)";
|
|
844
|
+
readonly borderColor: "rgba(16, 185, 129, 0.3)";
|
|
845
|
+
readonly color: "#10b981";
|
|
846
|
+
};
|
|
847
|
+
readonly secondary: {
|
|
848
|
+
readonly backgroundColor: "rgba(255, 255, 255, 0.02)";
|
|
849
|
+
readonly borderColor: "rgba(255, 255, 255, 0.1)";
|
|
850
|
+
readonly color: "#888";
|
|
851
|
+
};
|
|
852
|
+
readonly danger: {
|
|
853
|
+
readonly backgroundColor: "rgba(239, 68, 68, 0.1)";
|
|
854
|
+
readonly borderColor: "rgba(239, 68, 68, 0.3)";
|
|
855
|
+
readonly color: "#ef4444";
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
readonly input: {
|
|
859
|
+
readonly base: {
|
|
860
|
+
readonly padding: "8px";
|
|
861
|
+
readonly backgroundColor: "rgba(255, 255, 255, 0.02)";
|
|
862
|
+
readonly border: "1px solid rgba(255, 255, 255, 0.1)";
|
|
863
|
+
readonly borderRadius: "6px";
|
|
864
|
+
readonly color: "#fff";
|
|
865
|
+
readonly fontSize: "11px";
|
|
866
|
+
readonly fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace";
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
readonly card: {
|
|
870
|
+
readonly base: {
|
|
871
|
+
readonly padding: "12px";
|
|
872
|
+
readonly backgroundColor: "rgba(0, 0, 0, 0.2)";
|
|
873
|
+
readonly borderRadius: "8px";
|
|
874
|
+
readonly border: "1px solid rgba(255, 255, 255, 0.05)";
|
|
875
|
+
};
|
|
876
|
+
};
|
|
877
|
+
readonly label: {
|
|
878
|
+
readonly base: {
|
|
879
|
+
readonly fontSize: "10px";
|
|
880
|
+
readonly fontWeight: 600;
|
|
881
|
+
readonly color: "#888";
|
|
882
|
+
readonly textTransform: "uppercase";
|
|
883
|
+
readonly letterSpacing: "0.5px";
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
readonly badge: {
|
|
887
|
+
readonly base: {
|
|
888
|
+
readonly padding: "2px 6px";
|
|
889
|
+
readonly borderRadius: "4px";
|
|
890
|
+
readonly fontSize: "9px";
|
|
891
|
+
readonly fontWeight: 600;
|
|
892
|
+
readonly border: "1px solid";
|
|
893
|
+
readonly textTransform: "uppercase";
|
|
894
|
+
readonly letterSpacing: "0.3px";
|
|
895
|
+
};
|
|
896
|
+
};
|
|
897
|
+
};
|
|
898
|
+
/**
|
|
899
|
+
* Effect type to color mapping
|
|
900
|
+
*/
|
|
901
|
+
declare const effectColors: Record<string, string>;
|
|
902
|
+
/**
|
|
903
|
+
* Get effect color
|
|
904
|
+
*/
|
|
905
|
+
declare function getEffectColor(effect: string): string;
|
|
906
|
+
/**
|
|
907
|
+
* Create CSS properties object
|
|
908
|
+
*/
|
|
909
|
+
declare function createStyles<T extends Record<string, React.CSSProperties>>(styles: T): T;
|
|
910
|
+
|
|
911
|
+
export { type AnimationCompliance, type BehavioralCompliance, type ComplianceResult, DEFAULT_HUD_CONFIG, DEFAULT_HUD_STATE, DEFAULT_LENS_STATE, type DataSourceEntry, DataSourceIndicator, type DataSourceIndicatorProps, type DataSourceMeta, type DataSourceType, type DiagnosticIssue, type DiagnosticResult, DiagnosticsPanel, type DiagnosticsPanelProps, type DiagnosticsService, type EffectType, FeedbackPrompt, type FeedbackPromptProps, type ForkService, type ForkState, type HudActions, type HudConfig, type HudContextValue, HudPanel, type HudPanelProps, type HudPanelType, type HudPosition, HudProvider, type HudProviderProps, type HudState, type HudStore, HudTrigger, type HudTriggerProps, IssueList, type IssueListProps, LensPanel, type LensPanelProps, type LensService, type LensState, type MaterialCompliance, type Observation, ObservationCaptureModal, type ObservationCaptureModalProps, PhysicsAnalysis, type PhysicsAnalysisProps, type Signal, SimulationPanel, type SimulationPanelProps, type SimulationService, type SimulationState, StateComparison, type StateComparisonProps, type UseDataSourceProps, type UseKeyboardShortcutsProps, type UseObservationCaptureProps, type UseSignalCaptureProps, colors, createStyles, effectColors, getEffectColor, getHudState, getShortcutHelp, patterns, radii, shadows, spacing, transitions, typography, useDataSource, useHud, useHudOptional, useHudStore, useKeyboardShortcuts, useMultipleDataSources, useObservationCapture, useSignalCapture, zIndex };
|