@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/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# @sigil/hud
|
|
2
|
+
|
|
3
|
+
Diagnostic HUD for Sigil - composable React components for development.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @sigil/hud
|
|
9
|
+
|
|
10
|
+
# Optional: Install packages you want to use
|
|
11
|
+
pnpm add @sigil/lens @sigil/fork @sigil/simulation @sigil/diagnostics
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
### Basic Setup
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { HudProvider, HudPanel, HudTrigger } from '@sigil/hud'
|
|
20
|
+
import { createLensService } from '@sigil/lens'
|
|
21
|
+
import { createDiagnosticsService } from '@sigil/diagnostics'
|
|
22
|
+
|
|
23
|
+
const lensService = createLensService()
|
|
24
|
+
const diagnosticsService = createDiagnosticsService()
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
27
|
+
return (
|
|
28
|
+
<HudProvider
|
|
29
|
+
lensService={lensService}
|
|
30
|
+
diagnosticsService={diagnosticsService}
|
|
31
|
+
config={{
|
|
32
|
+
shortcuts: true,
|
|
33
|
+
position: 'bottom-right',
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<YourApp />
|
|
37
|
+
<HudTrigger />
|
|
38
|
+
<HudPanel>
|
|
39
|
+
<LensPanel />
|
|
40
|
+
<DiagnosticsPanel />
|
|
41
|
+
</HudPanel>
|
|
42
|
+
</HudProvider>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Keyboard Shortcuts
|
|
48
|
+
|
|
49
|
+
| Shortcut | Action |
|
|
50
|
+
|----------|--------|
|
|
51
|
+
| `⌘⇧D` | Toggle HUD |
|
|
52
|
+
| `1-5` | Switch panels (when open) |
|
|
53
|
+
| `Esc` | Close HUD |
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { useKeyboardShortcuts } from '@sigil/hud'
|
|
57
|
+
|
|
58
|
+
function MyComponent() {
|
|
59
|
+
useKeyboardShortcuts({ enabled: true })
|
|
60
|
+
// ...
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Signal Capture
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { useSignalCapture } from '@sigil/hud'
|
|
68
|
+
|
|
69
|
+
function MyComponent() {
|
|
70
|
+
const { accept, modify, reject } = useSignalCapture()
|
|
71
|
+
|
|
72
|
+
const handleAccept = () => {
|
|
73
|
+
accept('ClaimButton', 'financial')
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const handleModify = () => {
|
|
77
|
+
modify('ClaimButton', 'financial', {
|
|
78
|
+
from: '800ms',
|
|
79
|
+
to: '500ms',
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Observation Capture
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { useObservationCapture } from '@sigil/hud'
|
|
89
|
+
|
|
90
|
+
function MyComponent() {
|
|
91
|
+
const { captureUserTruth, captureIssue } = useObservationCapture()
|
|
92
|
+
|
|
93
|
+
const handleFeedback = () => {
|
|
94
|
+
captureUserTruth('This button feels too slow for power users', {
|
|
95
|
+
component: 'ClaimButton',
|
|
96
|
+
effect: 'financial',
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Components
|
|
103
|
+
|
|
104
|
+
| Component | Description |
|
|
105
|
+
|-----------|-------------|
|
|
106
|
+
| `HudProvider` | Context provider for HUD state and services |
|
|
107
|
+
| `HudPanel` | Main panel container |
|
|
108
|
+
| `HudTrigger` | Floating button to open HUD |
|
|
109
|
+
| `LensPanel` | Address impersonation controls |
|
|
110
|
+
| `SimulationPanel` | Transaction simulation info |
|
|
111
|
+
| `DiagnosticsPanel` | Physics compliance checking |
|
|
112
|
+
| `StateComparison` | Compare real vs impersonated state |
|
|
113
|
+
|
|
114
|
+
## Hooks
|
|
115
|
+
|
|
116
|
+
| Hook | Description |
|
|
117
|
+
|------|-------------|
|
|
118
|
+
| `useHud()` | Access HUD context |
|
|
119
|
+
| `useKeyboardShortcuts()` | Enable keyboard shortcuts |
|
|
120
|
+
| `useSignalCapture()` | Capture taste signals |
|
|
121
|
+
| `useObservationCapture()` | Capture observations |
|
|
122
|
+
|
|
123
|
+
## Progressive Enhancement
|
|
124
|
+
|
|
125
|
+
The HUD works with any subset of packages. Features gracefully degrade when packages are not installed:
|
|
126
|
+
|
|
127
|
+
- No `@sigil/lens` → Lens panel shows "not available" message
|
|
128
|
+
- No `@sigil/simulation` → Simulation panel shows "not available" message
|
|
129
|
+
- No `@sigil/diagnostics` → Diagnostics panel shows "not available" message
|
|
130
|
+
|
|
131
|
+
## Configuration
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
interface HudConfig {
|
|
135
|
+
shortcuts?: boolean // Enable keyboard shortcuts
|
|
136
|
+
position?: HudPosition // 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'
|
|
137
|
+
persist?: boolean // Persist state to localStorage
|
|
138
|
+
observationCapture?: boolean
|
|
139
|
+
signalCapture?: boolean
|
|
140
|
+
defaultPanel?: HudPanelType
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
MIT
|