* Minimal keybinding provider for static/headless renders. * Provides keybinding context without the ChordInterceptor (which uses useInput * and would hang in headless renders with no stdin).
({
children
}: {
children: React.ReactNode;
})
| 15 | * and would hang in headless renders with no stdin). |
| 16 | */ |
| 17 | function StaticKeybindingProvider({ |
| 18 | children |
| 19 | }: { |
| 20 | children: React.ReactNode; |
| 21 | }): React.ReactNode { |
| 22 | const { |
| 23 | bindings |
| 24 | } = loadKeybindingsSyncWithWarnings(); |
| 25 | const pendingChordRef = useRef(null); |
| 26 | const handlerRegistryRef = useRef(new Map()); |
| 27 | const activeContexts = useRef(new Set<KeybindingContextName>()).current; |
| 28 | return <KeybindingProvider bindings={bindings} pendingChordRef={pendingChordRef} pendingChord={null} setPendingChord={() => {}} activeContexts={activeContexts} registerActiveContext={() => {}} unregisterActiveContext={() => {}} handlerRegistryRef={handlerRegistryRef}> |
| 29 | {children} |
| 30 | </KeybindingProvider>; |
| 31 | } |
| 32 | |
| 33 | // Upper-bound how many NormalizedMessages a Message can produce. |
| 34 | // normalizeMessages splits one Message with N content blocks into N |
nothing calls this directly
no test coverage detected